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

BluetoothGATTGetIncludedServices

関数
指定サービスに含まれるGATTインクルードサービスを取得する。
DLLBluetoothApis.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

HRESULT BluetoothGATTGetIncludedServices(
    HANDLE hDevice,
    BTH_LE_GATT_SERVICE* ParentService,   // optional
    WORD IncludedServicesBufferCount,
    BTH_LE_GATT_SERVICE* IncludedServicesBuffer,   // optional
    WORD* IncludedServicesBufferActual,
    DWORD Flags
);

パラメーター

名前方向
hDeviceHANDLEin
ParentServiceBTH_LE_GATT_SERVICE*inoptional
IncludedServicesBufferCountWORDin
IncludedServicesBufferBTH_LE_GATT_SERVICE*outoptional
IncludedServicesBufferActualWORD*out
FlagsDWORDin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT BluetoothGATTGetIncludedServices(
    HANDLE hDevice,
    BTH_LE_GATT_SERVICE* ParentService,   // optional
    WORD IncludedServicesBufferCount,
    BTH_LE_GATT_SERVICE* IncludedServicesBuffer,   // optional
    WORD* IncludedServicesBufferActual,
    DWORD Flags
);
[DllImport("BluetoothApis.dll", ExactSpelling = true)]
static extern int BluetoothGATTGetIncludedServices(
    IntPtr hDevice,   // HANDLE
    IntPtr ParentService,   // BTH_LE_GATT_SERVICE* optional
    ushort IncludedServicesBufferCount,   // WORD
    IntPtr IncludedServicesBuffer,   // BTH_LE_GATT_SERVICE* optional, out
    out ushort IncludedServicesBufferActual,   // WORD* out
    uint Flags   // DWORD
);
<DllImport("BluetoothApis.dll", ExactSpelling:=True)>
Public Shared Function BluetoothGATTGetIncludedServices(
    hDevice As IntPtr,   ' HANDLE
    ParentService As IntPtr,   ' BTH_LE_GATT_SERVICE* optional
    IncludedServicesBufferCount As UShort,   ' WORD
    IncludedServicesBuffer As IntPtr,   ' BTH_LE_GATT_SERVICE* optional, out
    <Out> ByRef IncludedServicesBufferActual As UShort,   ' WORD* out
    Flags As UInteger   ' DWORD
) As Integer
End Function
' hDevice : HANDLE
' ParentService : BTH_LE_GATT_SERVICE* optional
' IncludedServicesBufferCount : WORD
' IncludedServicesBuffer : BTH_LE_GATT_SERVICE* optional, out
' IncludedServicesBufferActual : WORD* out
' Flags : DWORD
Declare PtrSafe Function BluetoothGATTGetIncludedServices Lib "bluetoothapis" ( _
    ByVal hDevice As LongPtr, _
    ByVal ParentService As LongPtr, _
    ByVal IncludedServicesBufferCount As Integer, _
    ByVal IncludedServicesBuffer As LongPtr, _
    ByRef IncludedServicesBufferActual As Integer, _
    ByVal Flags As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

BluetoothGATTGetIncludedServices = ctypes.windll.bluetoothapis.BluetoothGATTGetIncludedServices
BluetoothGATTGetIncludedServices.restype = ctypes.c_int
BluetoothGATTGetIncludedServices.argtypes = [
    wintypes.HANDLE,  # hDevice : HANDLE
    ctypes.c_void_p,  # ParentService : BTH_LE_GATT_SERVICE* optional
    ctypes.c_ushort,  # IncludedServicesBufferCount : WORD
    ctypes.c_void_p,  # IncludedServicesBuffer : BTH_LE_GATT_SERVICE* optional, out
    ctypes.POINTER(ctypes.c_ushort),  # IncludedServicesBufferActual : WORD* out
    wintypes.DWORD,  # Flags : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	bluetoothapis = windows.NewLazySystemDLL("BluetoothApis.dll")
	procBluetoothGATTGetIncludedServices = bluetoothapis.NewProc("BluetoothGATTGetIncludedServices")
)

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