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

BluetoothGATTGetDescriptorValue

関数
GATTディスクリプタの値を読み取り取得する。
DLLBluetoothApis.dll呼出規約winapi対応OSwindows8.0

シグネチャ

// BluetoothApis.dll
#include <windows.h>

HRESULT BluetoothGATTGetDescriptorValue(
    HANDLE hDevice,
    BTH_LE_GATT_DESCRIPTOR* Descriptor,
    DWORD DescriptorValueDataSize,
    BTH_LE_GATT_DESCRIPTOR_VALUE* DescriptorValue,   // optional
    WORD* DescriptorValueSizeRequired,   // optional
    DWORD Flags
);

パラメーター

名前方向
hDeviceHANDLEin
DescriptorBTH_LE_GATT_DESCRIPTOR*in
DescriptorValueDataSizeDWORDin
DescriptorValueBTH_LE_GATT_DESCRIPTOR_VALUE*outoptional
DescriptorValueSizeRequiredWORD*outoptional
FlagsDWORDin

戻り値の型: HRESULT

各言語での呼び出し定義

// BluetoothApis.dll
#include <windows.h>

HRESULT BluetoothGATTGetDescriptorValue(
    HANDLE hDevice,
    BTH_LE_GATT_DESCRIPTOR* Descriptor,
    DWORD DescriptorValueDataSize,
    BTH_LE_GATT_DESCRIPTOR_VALUE* DescriptorValue,   // optional
    WORD* DescriptorValueSizeRequired,   // optional
    DWORD Flags
);
[DllImport("BluetoothApis.dll", ExactSpelling = true)]
static extern int BluetoothGATTGetDescriptorValue(
    IntPtr hDevice,   // HANDLE
    IntPtr Descriptor,   // BTH_LE_GATT_DESCRIPTOR*
    uint DescriptorValueDataSize,   // DWORD
    IntPtr DescriptorValue,   // BTH_LE_GATT_DESCRIPTOR_VALUE* optional, out
    IntPtr DescriptorValueSizeRequired,   // WORD* optional, out
    uint Flags   // DWORD
);
<DllImport("BluetoothApis.dll", ExactSpelling:=True)>
Public Shared Function BluetoothGATTGetDescriptorValue(
    hDevice As IntPtr,   ' HANDLE
    Descriptor As IntPtr,   ' BTH_LE_GATT_DESCRIPTOR*
    DescriptorValueDataSize As UInteger,   ' DWORD
    DescriptorValue As IntPtr,   ' BTH_LE_GATT_DESCRIPTOR_VALUE* optional, out
    DescriptorValueSizeRequired As IntPtr,   ' WORD* optional, out
    Flags As UInteger   ' DWORD
) As Integer
End Function
' hDevice : HANDLE
' Descriptor : BTH_LE_GATT_DESCRIPTOR*
' DescriptorValueDataSize : DWORD
' DescriptorValue : BTH_LE_GATT_DESCRIPTOR_VALUE* optional, out
' DescriptorValueSizeRequired : WORD* optional, out
' Flags : DWORD
Declare PtrSafe Function BluetoothGATTGetDescriptorValue Lib "bluetoothapis" ( _
    ByVal hDevice As LongPtr, _
    ByVal Descriptor As LongPtr, _
    ByVal DescriptorValueDataSize As Long, _
    ByVal DescriptorValue As LongPtr, _
    ByVal DescriptorValueSizeRequired As LongPtr, _
    ByVal Flags As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

BluetoothGATTGetDescriptorValue = ctypes.windll.bluetoothapis.BluetoothGATTGetDescriptorValue
BluetoothGATTGetDescriptorValue.restype = ctypes.c_int
BluetoothGATTGetDescriptorValue.argtypes = [
    wintypes.HANDLE,  # hDevice : HANDLE
    ctypes.c_void_p,  # Descriptor : BTH_LE_GATT_DESCRIPTOR*
    wintypes.DWORD,  # DescriptorValueDataSize : DWORD
    ctypes.c_void_p,  # DescriptorValue : BTH_LE_GATT_DESCRIPTOR_VALUE* optional, out
    ctypes.POINTER(ctypes.c_ushort),  # DescriptorValueSizeRequired : WORD* optional, out
    wintypes.DWORD,  # Flags : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('BluetoothApis.dll')
BluetoothGATTGetDescriptorValue = Fiddle::Function.new(
  lib['BluetoothGATTGetDescriptorValue'],
  [
    Fiddle::TYPE_VOIDP,  # hDevice : HANDLE
    Fiddle::TYPE_VOIDP,  # Descriptor : BTH_LE_GATT_DESCRIPTOR*
    -Fiddle::TYPE_INT,  # DescriptorValueDataSize : DWORD
    Fiddle::TYPE_VOIDP,  # DescriptorValue : BTH_LE_GATT_DESCRIPTOR_VALUE* optional, out
    Fiddle::TYPE_VOIDP,  # DescriptorValueSizeRequired : WORD* optional, out
    -Fiddle::TYPE_INT,  # Flags : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "bluetoothapis")]
extern "system" {
    fn BluetoothGATTGetDescriptorValue(
        hDevice: *mut core::ffi::c_void,  // HANDLE
        Descriptor: *mut BTH_LE_GATT_DESCRIPTOR,  // BTH_LE_GATT_DESCRIPTOR*
        DescriptorValueDataSize: u32,  // DWORD
        DescriptorValue: *mut BTH_LE_GATT_DESCRIPTOR_VALUE,  // BTH_LE_GATT_DESCRIPTOR_VALUE* optional, out
        DescriptorValueSizeRequired: *mut u16,  // WORD* optional, out
        Flags: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("BluetoothApis.dll")]
public static extern int BluetoothGATTGetDescriptorValue(IntPtr hDevice, IntPtr Descriptor, uint DescriptorValueDataSize, IntPtr DescriptorValue, IntPtr DescriptorValueSizeRequired, uint Flags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'BluetoothApis_BluetoothGATTGetDescriptorValue' -Namespace Win32 -PassThru
# $api::BluetoothGATTGetDescriptorValue(hDevice, Descriptor, DescriptorValueDataSize, DescriptorValue, DescriptorValueSizeRequired, Flags)
#uselib "BluetoothApis.dll"
#func global BluetoothGATTGetDescriptorValue "BluetoothGATTGetDescriptorValue" sptr, sptr, sptr, sptr, sptr, sptr
; BluetoothGATTGetDescriptorValue hDevice, varptr(Descriptor), DescriptorValueDataSize, varptr(DescriptorValue), varptr(DescriptorValueSizeRequired), Flags   ; 戻り値は stat
; hDevice : HANDLE -> "sptr"
; Descriptor : BTH_LE_GATT_DESCRIPTOR* -> "sptr"
; DescriptorValueDataSize : DWORD -> "sptr"
; DescriptorValue : BTH_LE_GATT_DESCRIPTOR_VALUE* optional, out -> "sptr"
; DescriptorValueSizeRequired : WORD* optional, out -> "sptr"
; Flags : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "BluetoothApis.dll"
#cfunc global BluetoothGATTGetDescriptorValue "BluetoothGATTGetDescriptorValue" sptr, var, int, var, var, int
; res = BluetoothGATTGetDescriptorValue(hDevice, Descriptor, DescriptorValueDataSize, DescriptorValue, DescriptorValueSizeRequired, Flags)
; hDevice : HANDLE -> "sptr"
; Descriptor : BTH_LE_GATT_DESCRIPTOR* -> "var"
; DescriptorValueDataSize : DWORD -> "int"
; DescriptorValue : BTH_LE_GATT_DESCRIPTOR_VALUE* optional, out -> "var"
; DescriptorValueSizeRequired : WORD* optional, out -> "var"
; Flags : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT BluetoothGATTGetDescriptorValue(HANDLE hDevice, BTH_LE_GATT_DESCRIPTOR* Descriptor, DWORD DescriptorValueDataSize, BTH_LE_GATT_DESCRIPTOR_VALUE* DescriptorValue, WORD* DescriptorValueSizeRequired, DWORD Flags)
#uselib "BluetoothApis.dll"
#cfunc global BluetoothGATTGetDescriptorValue "BluetoothGATTGetDescriptorValue" intptr, var, int, var, var, int
; res = BluetoothGATTGetDescriptorValue(hDevice, Descriptor, DescriptorValueDataSize, DescriptorValue, DescriptorValueSizeRequired, Flags)
; hDevice : HANDLE -> "intptr"
; Descriptor : BTH_LE_GATT_DESCRIPTOR* -> "var"
; DescriptorValueDataSize : DWORD -> "int"
; DescriptorValue : BTH_LE_GATT_DESCRIPTOR_VALUE* optional, out -> "var"
; DescriptorValueSizeRequired : WORD* optional, out -> "var"
; Flags : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	bluetoothapis = windows.NewLazySystemDLL("BluetoothApis.dll")
	procBluetoothGATTGetDescriptorValue = bluetoothapis.NewProc("BluetoothGATTGetDescriptorValue")
)

// hDevice (HANDLE), Descriptor (BTH_LE_GATT_DESCRIPTOR*), DescriptorValueDataSize (DWORD), DescriptorValue (BTH_LE_GATT_DESCRIPTOR_VALUE* optional, out), DescriptorValueSizeRequired (WORD* optional, out), Flags (DWORD)
r1, _, err := procBluetoothGATTGetDescriptorValue.Call(
	uintptr(hDevice),
	uintptr(Descriptor),
	uintptr(DescriptorValueDataSize),
	uintptr(DescriptorValue),
	uintptr(DescriptorValueSizeRequired),
	uintptr(Flags),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function BluetoothGATTGetDescriptorValue(
  hDevice: THandle;   // HANDLE
  Descriptor: Pointer;   // BTH_LE_GATT_DESCRIPTOR*
  DescriptorValueDataSize: DWORD;   // DWORD
  DescriptorValue: Pointer;   // BTH_LE_GATT_DESCRIPTOR_VALUE* optional, out
  DescriptorValueSizeRequired: Pointer;   // WORD* optional, out
  Flags: DWORD   // DWORD
): Integer; stdcall;
  external 'BluetoothApis.dll' name 'BluetoothGATTGetDescriptorValue';
result := DllCall("BluetoothApis\BluetoothGATTGetDescriptorValue"
    , "Ptr", hDevice   ; HANDLE
    , "Ptr", Descriptor   ; BTH_LE_GATT_DESCRIPTOR*
    , "UInt", DescriptorValueDataSize   ; DWORD
    , "Ptr", DescriptorValue   ; BTH_LE_GATT_DESCRIPTOR_VALUE* optional, out
    , "Ptr", DescriptorValueSizeRequired   ; WORD* optional, out
    , "UInt", Flags   ; DWORD
    , "Int")   ; return: HRESULT
●BluetoothGATTGetDescriptorValue(hDevice, Descriptor, DescriptorValueDataSize, DescriptorValue, DescriptorValueSizeRequired, Flags) = DLL("BluetoothApis.dll", "int BluetoothGATTGetDescriptorValue(void*, void*, dword, void*, void*, dword)")
# 呼び出し: BluetoothGATTGetDescriptorValue(hDevice, Descriptor, DescriptorValueDataSize, DescriptorValue, DescriptorValueSizeRequired, Flags)
# hDevice : HANDLE -> "void*"
# Descriptor : BTH_LE_GATT_DESCRIPTOR* -> "void*"
# DescriptorValueDataSize : DWORD -> "dword"
# DescriptorValue : BTH_LE_GATT_DESCRIPTOR_VALUE* optional, out -> "void*"
# DescriptorValueSizeRequired : WORD* optional, out -> "void*"
# Flags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。