Win32 API 日本語リファレンス
ホームDevices.Bluetooth › BTH_RADIO_IN_RANGE

BTH_RADIO_IN_RANGE

構造体
サイズx64: 280 バイト / x86: 280 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
deviceInfoBTH_DEVICE_INFO272+0+0範囲内で検出されたデバイスの情報を保持するBTH_DEVICE_INFO構造体。
previousDeviceFlagsDWORD4+272+272前回検出時のデバイスフラグを示す。状態変化の検出に用いる。

各言語での定義

#include <windows.h>

// BTH_DEVICE_INFO  (x64 272 / x86 272 バイト)
typedef struct BTH_DEVICE_INFO {
    DWORD flags;
    ULONGLONG address;
    DWORD classOfDevice;
    CHAR name[248];
} BTH_DEVICE_INFO;

// BTH_RADIO_IN_RANGE  (x64 280 / x86 280 バイト)
typedef struct BTH_RADIO_IN_RANGE {
    BTH_DEVICE_INFO deviceInfo;
    DWORD previousDeviceFlags;
} BTH_RADIO_IN_RANGE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct BTH_DEVICE_INFO
{
    public uint flags;
    public ulong address;
    public uint classOfDevice;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 248)] public sbyte[] name;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct BTH_RADIO_IN_RANGE
{
    public BTH_DEVICE_INFO deviceInfo;
    public uint previousDeviceFlags;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure BTH_DEVICE_INFO
    Public flags As UInteger
    Public address As ULong
    Public classOfDevice As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=248)> Public name() As SByte
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure BTH_RADIO_IN_RANGE
    Public deviceInfo As BTH_DEVICE_INFO
    Public previousDeviceFlags As UInteger
End Structure
import ctypes
from ctypes import wintypes

class BTH_DEVICE_INFO(ctypes.Structure):
    _fields_ = [
        ("flags", wintypes.DWORD),
        ("address", ctypes.c_ulonglong),
        ("classOfDevice", wintypes.DWORD),
        ("name", ctypes.c_byte * 248),
    ]

class BTH_RADIO_IN_RANGE(ctypes.Structure):
    _fields_ = [
        ("deviceInfo", BTH_DEVICE_INFO),
        ("previousDeviceFlags", wintypes.DWORD),
    ]
#[repr(C)]
pub struct BTH_DEVICE_INFO {
    pub flags: u32,
    pub address: u64,
    pub classOfDevice: u32,
    pub name: [i8; 248],
}

#[repr(C)]
pub struct BTH_RADIO_IN_RANGE {
    pub deviceInfo: BTH_DEVICE_INFO,
    pub previousDeviceFlags: u32,
}
import "golang.org/x/sys/windows"

type BTH_DEVICE_INFO struct {
	flags uint32
	address uint64
	classOfDevice uint32
	name [248]int8
}

type BTH_RADIO_IN_RANGE struct {
	deviceInfo BTH_DEVICE_INFO
	previousDeviceFlags uint32
}
type
  BTH_DEVICE_INFO = record
    flags: DWORD;
    address: UInt64;
    classOfDevice: DWORD;
    name: array[0..247] of Shortint;
  end;

  BTH_RADIO_IN_RANGE = record
    deviceInfo: BTH_DEVICE_INFO;
    previousDeviceFlags: DWORD;
  end;
const BTH_DEVICE_INFO = extern struct {
    flags: u32,
    address: u64,
    classOfDevice: u32,
    name: [248]i8,
};

const BTH_RADIO_IN_RANGE = extern struct {
    deviceInfo: BTH_DEVICE_INFO,
    previousDeviceFlags: u32,
};
type
  BTH_DEVICE_INFO {.bycopy.} = object
    flags: uint32
    address: uint64
    classOfDevice: uint32
    name: array[248, int8]

  BTH_RADIO_IN_RANGE {.bycopy.} = object
    deviceInfo: BTH_DEVICE_INFO
    previousDeviceFlags: uint32
struct BTH_DEVICE_INFO
{
    uint flags;
    ulong address;
    uint classOfDevice;
    byte[248] name;
}

struct BTH_RADIO_IN_RANGE
{
    BTH_DEVICE_INFO deviceInfo;
    uint previousDeviceFlags;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; BTH_RADIO_IN_RANGE サイズ: 280 バイト(x64)
dim st, 70    ; 4byte整数×70(構造体サイズ 280 / 4 切り上げ)
; deviceInfo : BTH_DEVICE_INFO (+0, 272byte)  varptr(st)+0 を基点に操作(272byte:入れ子/配列)
; previousDeviceFlags : DWORD (+272, 4byte)  st.68 = 値  /  値 = st.68   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global BTH_DEVICE_INFO
    #field int flags
    #field int64 address
    #field int classOfDevice
    #field byte name 248
#endstruct

#defstruct global BTH_RADIO_IN_RANGE
    #field BTH_DEVICE_INFO deviceInfo
    #field int previousDeviceFlags
#endstruct

stdim st, BTH_RADIO_IN_RANGE        ; NSTRUCT 変数を確保
st->previousDeviceFlags = 100
mes "previousDeviceFlags=" + st->previousDeviceFlags