ホーム › Devices.Bluetooth › BTH_INFO_REQ
BTH_INFO_REQ
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| btAddr | ULONGLONG | 8 | +0 | +0 | 情報要求先デバイスの48ビットBluetoothアドレス。 |
| infoType | WORD | 2 | +8 | +8 | 要求する情報の種類を示す。接続MTUや拡張機能等を表す。 |
各言語での定義
#include <windows.h>
// BTH_INFO_REQ (x64 10 / x86 10 バイト)
#pragma pack(push, 1)
typedef struct BTH_INFO_REQ {
ULONGLONG btAddr;
WORD infoType;
} BTH_INFO_REQ;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct BTH_INFO_REQ
{
public ulong btAddr;
public ushort infoType;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure BTH_INFO_REQ
Public btAddr As ULong
Public infoType As UShort
End Structureimport ctypes
from ctypes import wintypes
class BTH_INFO_REQ(ctypes.Structure):
_pack_ = 1
_fields_ = [
("btAddr", ctypes.c_ulonglong),
("infoType", ctypes.c_ushort),
]#[repr(C, packed(1))]
pub struct BTH_INFO_REQ {
pub btAddr: u64,
pub infoType: u16,
}import "golang.org/x/sys/windows"
type BTH_INFO_REQ struct {
btAddr uint64
infoType uint16
}type
BTH_INFO_REQ = packed record
btAddr: UInt64;
infoType: Word;
end;const BTH_INFO_REQ = extern struct {
btAddr: u64,
infoType: u16,
};type
BTH_INFO_REQ {.packed.} = object
btAddr: uint64
infoType: uint16align(1)
struct BTH_INFO_REQ
{
ulong btAddr;
ushort infoType;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; BTH_INFO_REQ サイズ: 10 バイト(x64)
dim st, 3 ; 4byte整数×3(構造体サイズ 10 / 4 切り上げ)
; btAddr : ULONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; infoType : WORD (+8, 2byte) wpoke st,8,値 / 値 = wpeek(st,8)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global BTH_INFO_REQ, pack=1
#field int64 btAddr
#field short infoType
#endstruct
stdim st, BTH_INFO_REQ ; NSTRUCT 変数を確保
st->btAddr = 100
mes "btAddr=" + st->btAddr