Documentation
¶
Overview ¶
Package bluetoothemulation implements the BluetoothEmulation domain. This domain allows configuring virtual Bluetooth devices to test the web-bluetooth API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CentralState ¶
type CentralState string
CentralState Indicates the various states of Central.
const ( CentralStateNotSet CentralState = "" CentralStateAbsent CentralState = "absent" CentralStatePoweredOff CentralState = "powered-off" CentralStatePoweredOn CentralState = "powered-on" )
CentralState as enums.
func (CentralState) String ¶
func (e CentralState) String() string
func (CentralState) Valid ¶
func (e CentralState) Valid() bool
type EnableArgs ¶
type EnableArgs struct {
State CentralState `json:"state"` // State of the simulated central.
}
EnableArgs represents the arguments for Enable in the BluetoothEmulation domain.
func NewEnableArgs ¶
func NewEnableArgs(state CentralState) *EnableArgs
NewEnableArgs initializes EnableArgs with the required arguments.
type ManufacturerData ¶
type ManufacturerData struct {
Key int `json:"key"` // Company identifier https://bitbucket.org/bluetooth-SIG/public/src/main/assigned_numbers/company_identifiers/company_identifiers.yaml https://usb.org/developers
Data []byte `json:"data"` // Manufacturer-specific data (Encoded as a base64 string when passed over JSON)
}
ManufacturerData Stores the manufacturer data
type ScanEntry ¶
type ScanEntry struct {
DeviceAddress string `json:"deviceAddress"` // No description.
RSSI int `json:"rssi"` // No description.
ScanRecord ScanRecord `json:"scanRecord"` // No description.
}
ScanEntry Stores the advertisement packet information that is sent by a Bluetooth device.
type ScanRecord ¶
type ScanRecord struct {
Name *string `json:"name,omitempty"` // No description.
UUIDs []string `json:"uuids,omitempty"` // No description.
Appearance *int `json:"appearance,omitempty"` // Stores the external appearance description of the device.
TxPower *int `json:"txPower,omitempty"` // Stores the transmission power of a broadcasting device.
ManufacturerData []ManufacturerData `json:"manufacturerData,omitempty"` // Key is the company identifier and the value is an array of bytes of manufacturer specific data.
}
ScanRecord Stores the byte data of the advertisement packet sent by a Bluetooth device.
type SimulateAdvertisementArgs ¶
type SimulateAdvertisementArgs struct {
Entry ScanEntry `json:"entry"` // No description.
}
SimulateAdvertisementArgs represents the arguments for SimulateAdvertisement in the BluetoothEmulation domain.
func NewSimulateAdvertisementArgs ¶
func NewSimulateAdvertisementArgs(entry ScanEntry) *SimulateAdvertisementArgs
NewSimulateAdvertisementArgs initializes SimulateAdvertisementArgs with the required arguments.
type SimulatePreconnectedPeripheralArgs ¶
type SimulatePreconnectedPeripheralArgs struct {
Address string `json:"address"` // No description.
Name string `json:"name"` // No description.
ManufacturerData []ManufacturerData `json:"manufacturerData"` // No description.
KnownServiceUUIDs []string `json:"knownServiceUuids"` // No description.
}
SimulatePreconnectedPeripheralArgs represents the arguments for SimulatePreconnectedPeripheral in the BluetoothEmulation domain.
func NewSimulatePreconnectedPeripheralArgs ¶
func NewSimulatePreconnectedPeripheralArgs(address string, name string, manufacturerData []ManufacturerData, knownServiceUUIDs []string) *SimulatePreconnectedPeripheralArgs
NewSimulatePreconnectedPeripheralArgs initializes SimulatePreconnectedPeripheralArgs with the required arguments.