ホーム › Devices.Bluetooth › SdpQueryUuid
SdpQueryUuid
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| u | SdpQueryUuidUnion | 16 | +0 | +0 | UUID値を格納する共用体。128/32/16ビットのいずれかの形式を保持する。 |
| uuidType | WORD | 2 | +16 | +16 | uフィールドに格納されたUUIDの形式種別を示す。SDP_ST_UUID16等の値。 |
各言語での定義
#include <windows.h>
// SdpQueryUuidUnion (x64 16 / x86 16 バイト)
typedef struct SdpQueryUuidUnion {
GUID uuid128;
DWORD uuid32;
WORD uuid16;
} SdpQueryUuidUnion;
// SdpQueryUuid (x64 20 / x86 20 バイト)
typedef struct SdpQueryUuid {
SdpQueryUuidUnion u;
WORD uuidType;
} SdpQueryUuid;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SdpQueryUuidUnion
{
public Guid uuid128;
public uint uuid32;
public ushort uuid16;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SdpQueryUuid
{
public SdpQueryUuidUnion u;
public ushort uuidType;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SdpQueryUuidUnion
Public uuid128 As Guid
Public uuid32 As UInteger
Public uuid16 As UShort
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SdpQueryUuid
Public u As SdpQueryUuidUnion
Public uuidType As UShort
End Structureimport ctypes
from ctypes import wintypes
class SdpQueryUuidUnion(ctypes.Structure):
_fields_ = [
("uuid128", GUID),
("uuid32", wintypes.DWORD),
("uuid16", ctypes.c_ushort),
]
class SdpQueryUuid(ctypes.Structure):
_fields_ = [
("u", SdpQueryUuidUnion),
("uuidType", ctypes.c_ushort),
]#[repr(C)]
pub struct SdpQueryUuidUnion {
pub uuid128: GUID,
pub uuid32: u32,
pub uuid16: u16,
}
#[repr(C)]
pub struct SdpQueryUuid {
pub u: SdpQueryUuidUnion,
pub uuidType: u16,
}import "golang.org/x/sys/windows"
type SdpQueryUuidUnion struct {
uuid128 windows.GUID
uuid32 uint32
uuid16 uint16
}
type SdpQueryUuid struct {
u SdpQueryUuidUnion
uuidType uint16
}type
SdpQueryUuidUnion = record
uuid128: TGUID;
uuid32: DWORD;
uuid16: Word;
end;
SdpQueryUuid = record
u: SdpQueryUuidUnion;
uuidType: Word;
end;const SdpQueryUuidUnion = extern struct {
uuid128: GUID,
uuid32: u32,
uuid16: u16,
};
const SdpQueryUuid = extern struct {
u: SdpQueryUuidUnion,
uuidType: u16,
};type
SdpQueryUuidUnion {.bycopy.} = object
uuid128: GUID
uuid32: uint32
uuid16: uint16
SdpQueryUuid {.bycopy.} = object
u: SdpQueryUuidUnion
uuidType: uint16struct SdpQueryUuidUnion
{
GUID uuid128;
uint uuid32;
ushort uuid16;
}
struct SdpQueryUuid
{
SdpQueryUuidUnion u;
ushort uuidType;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SdpQueryUuid サイズ: 20 バイト(x64)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; u : SdpQueryUuidUnion (+0, 16byte) varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; uuidType : WORD (+16, 2byte) wpoke st,16,値 / 値 = wpeek(st,16)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SdpQueryUuid
#field byte u 16
#field short uuidType
#endstruct
stdim st, SdpQueryUuid ; NSTRUCT 変数を確保
st->uuidType = 100
mes "uuidType=" + st->uuidType
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。