ホーム › Devices.Bluetooth › BLUETOOTH_RADIO_INFO
BLUETOOTH_RADIO_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwSize | DWORD | 4 | +0 | +0 | この構造体のバイト単位サイズ。呼び出し前に設定する必要がある。 |
| address | BLUETOOTH_ADDRESS | 8 | +8 | +8 | ローカルラジオのBluetoothアドレス。 |
| szName | WCHAR | 496 | +16 | +16 | ラジオのフレンドリ名を保持するワイド文字配列。 |
| ulClassofDevice | DWORD | 4 | +512 | +512 | ローカルラジオのClass of Device値。機器種別を示す。 |
| lmpSubversion | WORD | 2 | +516 | +516 | ラジオファームウェアのLMPサブバージョンを示す製造元定義値。 |
| manufacturer | WORD | 2 | +518 | +518 | ラジオ製造元を示すBluetooth SIG割当の企業ID。 |
各言語での定義
#include <windows.h>
// BLUETOOTH_ADDRESS (x64 8 / x86 8 バイト)
typedef struct BLUETOOTH_ADDRESS {
_Anonymous_e__Union Anonymous;
} BLUETOOTH_ADDRESS;
// BLUETOOTH_RADIO_INFO (x64 520 / x86 520 バイト)
typedef struct BLUETOOTH_RADIO_INFO {
DWORD dwSize;
BLUETOOTH_ADDRESS address;
WCHAR szName[248];
DWORD ulClassofDevice;
WORD lmpSubversion;
WORD manufacturer;
} BLUETOOTH_RADIO_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct BLUETOOTH_ADDRESS
{
public _Anonymous_e__Union Anonymous;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct BLUETOOTH_RADIO_INFO
{
public uint dwSize;
public BLUETOOTH_ADDRESS address;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 248)] public string szName;
public uint ulClassofDevice;
public ushort lmpSubversion;
public ushort manufacturer;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure BLUETOOTH_ADDRESS
Public Anonymous As _Anonymous_e__Union
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure BLUETOOTH_RADIO_INFO
Public dwSize As UInteger
Public address As BLUETOOTH_ADDRESS
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=248)> Public szName As String
Public ulClassofDevice As UInteger
Public lmpSubversion As UShort
Public manufacturer As UShort
End Structureimport ctypes
from ctypes import wintypes
class BLUETOOTH_ADDRESS(ctypes.Structure):
_fields_ = [
("Anonymous", _Anonymous_e__Union),
]
class BLUETOOTH_RADIO_INFO(ctypes.Structure):
_fields_ = [
("dwSize", wintypes.DWORD),
("address", BLUETOOTH_ADDRESS),
("szName", ctypes.c_wchar * 248),
("ulClassofDevice", wintypes.DWORD),
("lmpSubversion", ctypes.c_ushort),
("manufacturer", ctypes.c_ushort),
]#[repr(C)]
pub struct BLUETOOTH_ADDRESS {
pub Anonymous: _Anonymous_e__Union,
}
#[repr(C)]
pub struct BLUETOOTH_RADIO_INFO {
pub dwSize: u32,
pub address: BLUETOOTH_ADDRESS,
pub szName: [u16; 248],
pub ulClassofDevice: u32,
pub lmpSubversion: u16,
pub manufacturer: u16,
}import "golang.org/x/sys/windows"
type BLUETOOTH_ADDRESS struct {
Anonymous _Anonymous_e__Union
}
type BLUETOOTH_RADIO_INFO struct {
dwSize uint32
address BLUETOOTH_ADDRESS
szName [248]uint16
ulClassofDevice uint32
lmpSubversion uint16
manufacturer uint16
}type
BLUETOOTH_ADDRESS = record
Anonymous: _Anonymous_e__Union;
end;
BLUETOOTH_RADIO_INFO = record
dwSize: DWORD;
address: BLUETOOTH_ADDRESS;
szName: array[0..247] of WideChar;
ulClassofDevice: DWORD;
lmpSubversion: Word;
manufacturer: Word;
end;const BLUETOOTH_ADDRESS = extern struct {
Anonymous: _Anonymous_e__Union,
};
const BLUETOOTH_RADIO_INFO = extern struct {
dwSize: u32,
address: BLUETOOTH_ADDRESS,
szName: [248]u16,
ulClassofDevice: u32,
lmpSubversion: u16,
manufacturer: u16,
};type
BLUETOOTH_ADDRESS {.bycopy.} = object
Anonymous: _Anonymous_e__Union
BLUETOOTH_RADIO_INFO {.bycopy.} = object
dwSize: uint32
address: BLUETOOTH_ADDRESS
szName: array[248, uint16]
ulClassofDevice: uint32
lmpSubversion: uint16
manufacturer: uint16struct BLUETOOTH_ADDRESS
{
_Anonymous_e__Union Anonymous;
}
struct BLUETOOTH_RADIO_INFO
{
uint dwSize;
BLUETOOTH_ADDRESS address;
wchar[248] szName;
uint ulClassofDevice;
ushort lmpSubversion;
ushort manufacturer;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; BLUETOOTH_RADIO_INFO サイズ: 520 バイト(x64)
dim st, 130 ; 4byte整数×130(構造体サイズ 520 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; address : BLUETOOTH_ADDRESS (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; szName : WCHAR (+16, 496byte) varptr(st)+16 を基点に操作(496byte:入れ子/配列)
; ulClassofDevice : DWORD (+512, 4byte) st.128 = 値 / 値 = st.128 (lpoke/lpeek も可)
; lmpSubversion : WORD (+516, 2byte) wpoke st,516,値 / 値 = wpeek(st,516)
; manufacturer : WORD (+518, 2byte) wpoke st,518,値 / 値 = wpeek(st,518)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global BLUETOOTH_ADDRESS
#field byte Anonymous 8
#endstruct
#defstruct global BLUETOOTH_RADIO_INFO
#field int dwSize
#field BLUETOOTH_ADDRESS address
#field wchar szName 248
#field int ulClassofDevice
#field short lmpSubversion
#field short manufacturer
#endstruct
stdim st, BLUETOOTH_RADIO_INFO ; NSTRUCT 変数を確保
st->dwSize = 100
mes "dwSize=" + st->dwSize