Documentation
¶
Overview ¶
Package winbt provides a thin layer over the WinRT Bluetooth interfaces. It is not designed to be used directly by applications: the bluetooth package will wrap the API exposed here in a nice platform-independent way.
You can find the original *.idl and *.h files in a directory like this, after installing the Windows SDK:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\winrt
Some helpful articles to understand WinRT at a low level: https://blog.xojo.com/2019/07/02/accessing-windows-runtime-winrt/ https://docs.microsoft.com/en-us/archive/msdn-magazine/2013/august/windows-with-c-the-windows-runtime-application-model https://blog.magnusmontin.net/2017/12/30/minimal-uwp-wrl-xaml-app/ https://yizhang82.dev/what-is-winrt https://www.slideshare.net/goldshtn/deep-dive-into-winrt
Index ¶
- Variables
- type Event
- type IBluetoothLEAdvertisement
- type IBluetoothLEAdvertisementDataSection
- type IBluetoothLEAdvertisementDataSectionVtbl
- type IBluetoothLEAdvertisementReceivedEventArgs
- func (v *IBluetoothLEAdvertisementReceivedEventArgs) Advertisement() (advertisement *IBluetoothLEAdvertisement)
- func (v *IBluetoothLEAdvertisementReceivedEventArgs) BluetoothAddress() (address uint64)
- func (v *IBluetoothLEAdvertisementReceivedEventArgs) RawSignalStrengthInDBm() (rssi int16)
- func (v *IBluetoothLEAdvertisementReceivedEventArgs) VTable() *IBluetoothLEAdvertisementReceivedEventArgsVtbl
- type IBluetoothLEAdvertisementReceivedEventArgsVtbl
- type IBluetoothLEAdvertisementVtbl
- type IBluetoothLEAdvertisementWatcher
- func (v *IBluetoothLEAdvertisementWatcher) AddReceivedEvent(...) (err error)
- func (v *IBluetoothLEAdvertisementWatcher) AddStoppedEvent(handler func(*IBluetoothLEAdvertisementWatcher, ...)) (err error)
- func (v *IBluetoothLEAdvertisementWatcher) Start() error
- func (v *IBluetoothLEAdvertisementWatcher) Status() WatcherStatus
- func (v *IBluetoothLEAdvertisementWatcher) Stop() error
- func (v *IBluetoothLEAdvertisementWatcher) VTable() *IBluetoothLEAdvertisementWatcherVtbl
- type IBluetoothLEAdvertisementWatcherStoppedEventArgs
- type IBluetoothLEAdvertisementWatcherVtbl
- type IVector
- type IVectorVtbl
- type WatcherStatus
Constants ¶
This section is empty.
Variables ¶
var ( IID_IBluetoothLEAdvertisementReceivedEventArgs = ole.NewGUID("27987DDF-E596-41BE-8D43-9E6731D4A913") IID_IBluetoothLEAdvertisementWatcherStoppedEventArgs = ole.NewGUID("DD40F84D-E7B9-43E3-9C04-0685D085FD8C") )
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
ole.IUnknown
IID *ole.GUID
Callback func(*Event, *ole.IInspectable)
// contains filtered or unexported fields
}
Event implements event handler interfaces (ITypedEventHandler). This is therefore a valid COM object, derived from IUnknown.
type IBluetoothLEAdvertisement ¶
type IBluetoothLEAdvertisement struct {
ole.IInspectable
}
func (*IBluetoothLEAdvertisement) DataSections ¶
func (v *IBluetoothLEAdvertisement) DataSections() (vector *IVector)
func (*IBluetoothLEAdvertisement) LocalName ¶
func (v *IBluetoothLEAdvertisement) LocalName() string
func (*IBluetoothLEAdvertisement) VTable ¶
func (v *IBluetoothLEAdvertisement) VTable() *IBluetoothLEAdvertisementVtbl
type IBluetoothLEAdvertisementDataSection ¶
type IBluetoothLEAdvertisementDataSection struct {
ole.IInspectable
}
func (*IBluetoothLEAdvertisementDataSection) DataType ¶
func (v *IBluetoothLEAdvertisementDataSection) DataType() (value byte)
func (*IBluetoothLEAdvertisementDataSection) VTable ¶
func (v *IBluetoothLEAdvertisementDataSection) VTable() *IBluetoothLEAdvertisementDataSectionVtbl
type IBluetoothLEAdvertisementDataSectionVtbl ¶
type IBluetoothLEAdvertisementDataSectionVtbl struct {
ole.IInspectableVtbl
GetDataType uintptr // ([out] [retval] BYTE* value)
SetDataType uintptr // ([in] BYTE value)
GetData uintptr // ([out] [retval] Windows.Storage.Streams.IBuffer** value)
SetData uintptr // ([in] Windows.Storage.Streams.IBuffer* value)
}
type IBluetoothLEAdvertisementReceivedEventArgs ¶
type IBluetoothLEAdvertisementReceivedEventArgs struct {
ole.IInspectable
}
func (*IBluetoothLEAdvertisementReceivedEventArgs) Advertisement ¶
func (v *IBluetoothLEAdvertisementReceivedEventArgs) Advertisement() (advertisement *IBluetoothLEAdvertisement)
func (*IBluetoothLEAdvertisementReceivedEventArgs) BluetoothAddress ¶
func (v *IBluetoothLEAdvertisementReceivedEventArgs) BluetoothAddress() (address uint64)
func (*IBluetoothLEAdvertisementReceivedEventArgs) RawSignalStrengthInDBm ¶
func (v *IBluetoothLEAdvertisementReceivedEventArgs) RawSignalStrengthInDBm() (rssi int16)
type IBluetoothLEAdvertisementReceivedEventArgsVtbl ¶
type IBluetoothLEAdvertisementReceivedEventArgsVtbl struct {
ole.IInspectableVtbl
RawSignalStrengthInDBm uintptr // ([out] [retval] INT16* value);
BluetoothAddress uintptr // ([out] [retval] UINT64* value);
AdvertisementType uintptr // ([out] [retval] Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementType* value);
Timestamp uintptr // ([out] [retval] Windows.Foundation.DateTime* value);
Advertisement uintptr // ([out] [retval] Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisement** value);
}
type IBluetoothLEAdvertisementVtbl ¶
type IBluetoothLEAdvertisementVtbl struct {
ole.IInspectableVtbl
GetFlags uintptr // ([out] [retval] Windows.Foundation.IReference<Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementFlags>** value);
SetFlags uintptr // ([in] Windows.Foundation.IReference<Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementFlags>* value);
GetLocalName uintptr // ([out] [retval] HSTRING* value);
SetLocalName uintptr // ([in] HSTRING value);
GetServiceUuids uintptr // ([out] [retval] Windows.Foundation.Collections.IVector<GUID>** value);
GetManufacturerData uintptr // ([out] [retval] Windows.Foundation.Collections.IVector<Windows.Devices.Bluetooth.Advertisement.BluetoothLEManufacturerData*>** value);
GetDataSections uintptr // ([out] [retval] Windows.Foundation.Collections.IVector<Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementDataSection*>** value);
GetManufacturerDataByCompanyId uintptr // ([in] UINT16 companyId, [out] [retval] Windows.Foundation.Collections.IVectorView<Windows.Devices.Bluetooth.Advertisement.BluetoothLEManufacturerData*>** dataList);
GetSectionsByType uintptr // ([in] BYTE type, [out] [retval] Windows.Foundation.Collections.IVectorView<Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementDataSection*>** sectionList);
}
type IBluetoothLEAdvertisementWatcher ¶
type IBluetoothLEAdvertisementWatcher struct {
ole.IInspectable
}
func NewBluetoothLEAdvertisementWatcher ¶
func NewBluetoothLEAdvertisementWatcher() (*IBluetoothLEAdvertisementWatcher, error)
func (*IBluetoothLEAdvertisementWatcher) AddReceivedEvent ¶
func (v *IBluetoothLEAdvertisementWatcher) AddReceivedEvent(handler func(*IBluetoothLEAdvertisementWatcher, *IBluetoothLEAdvertisementReceivedEventArgs)) (err error)
func (*IBluetoothLEAdvertisementWatcher) AddStoppedEvent ¶
func (v *IBluetoothLEAdvertisementWatcher) AddStoppedEvent(handler func(*IBluetoothLEAdvertisementWatcher, *IBluetoothLEAdvertisementWatcherStoppedEventArgs)) (err error)
func (*IBluetoothLEAdvertisementWatcher) Start ¶
func (v *IBluetoothLEAdvertisementWatcher) Start() error
func (*IBluetoothLEAdvertisementWatcher) Status ¶
func (v *IBluetoothLEAdvertisementWatcher) Status() WatcherStatus
func (*IBluetoothLEAdvertisementWatcher) Stop ¶
func (v *IBluetoothLEAdvertisementWatcher) Stop() error
func (*IBluetoothLEAdvertisementWatcher) VTable ¶
func (v *IBluetoothLEAdvertisementWatcher) VTable() *IBluetoothLEAdvertisementWatcherVtbl
type IBluetoothLEAdvertisementWatcherStoppedEventArgs ¶
type IBluetoothLEAdvertisementWatcherStoppedEventArgs struct {
ole.IInspectable
}
type IBluetoothLEAdvertisementWatcherVtbl ¶
type IBluetoothLEAdvertisementWatcherVtbl struct {
ole.IInspectableVtbl
GetMinSamplingInterval uintptr // ([out] [retval] Windows.Foundation.TimeSpan* value);
GetMaxSamplingInterval uintptr // ([out] [retval] Windows.Foundation.TimeSpan* value);
GetMinOutOfRangeTimeout uintptr // ([out] [retval] Windows.Foundation.TimeSpan* value);
GetMaxOutOfRangeTimeout uintptr // ([out] [retval] Windows.Foundation.TimeSpan* value);
GetStatus uintptr // ([out] [retval] Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementWatcherStatus* value);
GetScanningMode uintptr // ([out] [retval] Windows.Devices.Bluetooth.Advertisement.BluetoothLEScanningMode* value);
SetScanningMode uintptr // ([in] Windows.Devices.Bluetooth.Advertisement.BluetoothLEScanningMode value);
GetSignalStrengthFilter uintptr // ([out] [retval] Windows.Devices.Bluetooth.BluetoothSignalStrengthFilter** value);
SetSignalStrengthFilter uintptr // ([in] Windows.Devices.Bluetooth.BluetoothSignalStrengthFilter* value);
GetAdvertisementFilter uintptr // ([out] [retval] Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementFilter** value);
SetAdvertisementFilter uintptr // ([in] Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementFilter* value);
Start uintptr // ();
Stop uintptr // ();
AddReceivedEvent uintptr // ([in] Windows.Foundation.TypedEventHandler<Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementWatcher*, Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementReceivedEventArgs*>* handler, [out] [retval] EventRegistrationToken* token);
RemoveReceivedEvent uintptr // ([in] EventRegistrationToken token);
AddStoppedEvent uintptr // ([in] Windows.Foundation.TypedEventHandler<Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementWatcher*, Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementWatcherStoppedEventArgs*>* handler, [out] [retval] EventRegistrationToken* token);
RemoveStoppedEvent uintptr // ([in] EventRegistrationToken token);
}
type IVector ¶
type IVector struct {
ole.IInspectable
}
func (*IVector) VTable ¶
func (v *IVector) VTable() *IVectorVtbl
type IVectorVtbl ¶
type IVectorVtbl struct {
ole.IInspectableVtbl
// read methods
GetAt uintptr // (_In_opt_ unsigned index, _Out_ T_abi *item)
GetSize uintptr // (_Out_ unsigned *size)
GetView uintptr // (_Outptr_result_maybenull_ IVectorView<T_logical> **view)
IndexOf uintptr // (_In_opt_ T_abi value, _Out_ unsigned *index, _Out_ boolean *found)
// write methods
SetAt uintptr // (_In_ unsigned index, _In_opt_ T_abi item)
InsertAt uintptr // (_In_ unsigned index, _In_opt_ T_abi item)
RemoveAt uintptr // (_In_ unsigned index)
Append uintptr // (_In_opt_ T_abi item)
RemoveAtEnd uintptr // ()
Clear uintptr // ()
// bulk transfer methods
GetMany uintptr // (_In_ unsigned startIndex, _In_ unsigned capacity, _Out_writes_to_(capacity,*actual) T_abi *value, _Out_ unsigned *actual)
ReplaceAll uintptr // (_In_ unsigned count, _In_reads_(count) T_abi *value)
}
type WatcherStatus ¶
type WatcherStatus uint32
const ( WatcherStatusCreated WatcherStatus = 0 WatcherStatusStarted WatcherStatus = 1 WatcherStatusStopping WatcherStatus = 2 WatcherStatusStopped WatcherStatus = 3 WatcherStatusAborted WatcherStatus = 4 )