ホーム › Devices.Bluetooth › BluetoothGATTBeginReliableWrite
BluetoothGATTBeginReliableWrite
関数GATTの信頼性書き込みトランザクションを開始する。
シグネチャ
// BluetoothApis.dll
#include <windows.h>
HRESULT BluetoothGATTBeginReliableWrite(
HANDLE hDevice,
ULONGLONG* ReliableWriteContext,
DWORD Flags
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hDevice | HANDLE | in |
| ReliableWriteContext | ULONGLONG* | out |
| Flags | DWORD | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// BluetoothApis.dll
#include <windows.h>
HRESULT BluetoothGATTBeginReliableWrite(
HANDLE hDevice,
ULONGLONG* ReliableWriteContext,
DWORD Flags
);[DllImport("BluetoothApis.dll", ExactSpelling = true)]
static extern int BluetoothGATTBeginReliableWrite(
IntPtr hDevice, // HANDLE
out ulong ReliableWriteContext, // ULONGLONG* out
uint Flags // DWORD
);<DllImport("BluetoothApis.dll", ExactSpelling:=True)>
Public Shared Function BluetoothGATTBeginReliableWrite(
hDevice As IntPtr, ' HANDLE
<Out> ByRef ReliableWriteContext As ULong, ' ULONGLONG* out
Flags As UInteger ' DWORD
) As Integer
End Function' hDevice : HANDLE
' ReliableWriteContext : ULONGLONG* out
' Flags : DWORD
Declare PtrSafe Function BluetoothGATTBeginReliableWrite Lib "bluetoothapis" ( _
ByVal hDevice As LongPtr, _
ByRef ReliableWriteContext As LongLong, _
ByVal Flags As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
BluetoothGATTBeginReliableWrite = ctypes.windll.bluetoothapis.BluetoothGATTBeginReliableWrite
BluetoothGATTBeginReliableWrite.restype = ctypes.c_int
BluetoothGATTBeginReliableWrite.argtypes = [
wintypes.HANDLE, # hDevice : HANDLE
ctypes.POINTER(ctypes.c_ulonglong), # ReliableWriteContext : ULONGLONG* out
wintypes.DWORD, # Flags : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('BluetoothApis.dll')
BluetoothGATTBeginReliableWrite = Fiddle::Function.new(
lib['BluetoothGATTBeginReliableWrite'],
[
Fiddle::TYPE_VOIDP, # hDevice : HANDLE
Fiddle::TYPE_VOIDP, # ReliableWriteContext : ULONGLONG* out
-Fiddle::TYPE_INT, # Flags : DWORD
],
Fiddle::TYPE_INT)#[link(name = "bluetoothapis")]
extern "system" {
fn BluetoothGATTBeginReliableWrite(
hDevice: *mut core::ffi::c_void, // HANDLE
ReliableWriteContext: *mut u64, // ULONGLONG* out
Flags: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("BluetoothApis.dll")]
public static extern int BluetoothGATTBeginReliableWrite(IntPtr hDevice, out ulong ReliableWriteContext, uint Flags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'BluetoothApis_BluetoothGATTBeginReliableWrite' -Namespace Win32 -PassThru
# $api::BluetoothGATTBeginReliableWrite(hDevice, ReliableWriteContext, Flags)#uselib "BluetoothApis.dll"
#func global BluetoothGATTBeginReliableWrite "BluetoothGATTBeginReliableWrite" sptr, sptr, sptr
; BluetoothGATTBeginReliableWrite hDevice, varptr(ReliableWriteContext), Flags ; 戻り値は stat
; hDevice : HANDLE -> "sptr"
; ReliableWriteContext : ULONGLONG* out -> "sptr"
; Flags : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "BluetoothApis.dll" #cfunc global BluetoothGATTBeginReliableWrite "BluetoothGATTBeginReliableWrite" sptr, var, int ; res = BluetoothGATTBeginReliableWrite(hDevice, ReliableWriteContext, Flags) ; hDevice : HANDLE -> "sptr" ; ReliableWriteContext : ULONGLONG* out -> "var" ; Flags : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "BluetoothApis.dll" #cfunc global BluetoothGATTBeginReliableWrite "BluetoothGATTBeginReliableWrite" sptr, sptr, int ; res = BluetoothGATTBeginReliableWrite(hDevice, varptr(ReliableWriteContext), Flags) ; hDevice : HANDLE -> "sptr" ; ReliableWriteContext : ULONGLONG* out -> "sptr" ; Flags : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT BluetoothGATTBeginReliableWrite(HANDLE hDevice, ULONGLONG* ReliableWriteContext, DWORD Flags) #uselib "BluetoothApis.dll" #cfunc global BluetoothGATTBeginReliableWrite "BluetoothGATTBeginReliableWrite" intptr, var, int ; res = BluetoothGATTBeginReliableWrite(hDevice, ReliableWriteContext, Flags) ; hDevice : HANDLE -> "intptr" ; ReliableWriteContext : ULONGLONG* out -> "var" ; Flags : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT BluetoothGATTBeginReliableWrite(HANDLE hDevice, ULONGLONG* ReliableWriteContext, DWORD Flags) #uselib "BluetoothApis.dll" #cfunc global BluetoothGATTBeginReliableWrite "BluetoothGATTBeginReliableWrite" intptr, intptr, int ; res = BluetoothGATTBeginReliableWrite(hDevice, varptr(ReliableWriteContext), Flags) ; hDevice : HANDLE -> "intptr" ; ReliableWriteContext : ULONGLONG* out -> "intptr" ; Flags : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
bluetoothapis = windows.NewLazySystemDLL("BluetoothApis.dll")
procBluetoothGATTBeginReliableWrite = bluetoothapis.NewProc("BluetoothGATTBeginReliableWrite")
)
// hDevice (HANDLE), ReliableWriteContext (ULONGLONG* out), Flags (DWORD)
r1, _, err := procBluetoothGATTBeginReliableWrite.Call(
uintptr(hDevice),
uintptr(ReliableWriteContext),
uintptr(Flags),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction BluetoothGATTBeginReliableWrite(
hDevice: THandle; // HANDLE
ReliableWriteContext: Pointer; // ULONGLONG* out
Flags: DWORD // DWORD
): Integer; stdcall;
external 'BluetoothApis.dll' name 'BluetoothGATTBeginReliableWrite';result := DllCall("BluetoothApis\BluetoothGATTBeginReliableWrite"
, "Ptr", hDevice ; HANDLE
, "Ptr", ReliableWriteContext ; ULONGLONG* out
, "UInt", Flags ; DWORD
, "Int") ; return: HRESULT●BluetoothGATTBeginReliableWrite(hDevice, ReliableWriteContext, Flags) = DLL("BluetoothApis.dll", "int BluetoothGATTBeginReliableWrite(void*, void*, dword)")
# 呼び出し: BluetoothGATTBeginReliableWrite(hDevice, ReliableWriteContext, Flags)
# hDevice : HANDLE -> "void*"
# ReliableWriteContext : ULONGLONG* out -> "void*"
# Flags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。