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