bluetoothemulation

package
v0.0.0-...-64be311 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package bluetoothemulation provides the Chrome DevTools Protocol commands, types, and events for the BluetoothEmulation domain.

This domain allows configuring virtual Bluetooth devices to test the web-bluetooth API.

Generated by the cdproto-gen command.

Index

Constants

View Source
const (
	CommandEnable                         = "BluetoothEmulation.enable"
	CommandDisable                        = "BluetoothEmulation.disable"
	CommandSimulatePreconnectedPeripheral = "BluetoothEmulation.simulatePreconnectedPeripheral"
	CommandSimulateAdvertisement          = "BluetoothEmulation.simulateAdvertisement"
)

Command names.

Variables

This section is empty.

Functions

This section is empty.

Types

type CentralState

type CentralState string

CentralState indicates the various states of Central.

See: https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation#type-CentralState

const (
	CentralStateAbsent     CentralState = "absent"
	CentralStatePoweredOff CentralState = "powered-off"
	CentralStatePoweredOn  CentralState = "powered-on"
)

CentralState values.

func (CentralState) String

func (t CentralState) String() string

String returns the CentralState as string value.

func (*CentralState) UnmarshalJSON

func (t *CentralState) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies [json.Unmarshaler].

type DisableParams

type DisableParams struct{}

DisableParams disable the BluetoothEmulation domain.

func Disable

func Disable() *DisableParams

Disable disable the BluetoothEmulation domain.

See: https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation#method-disable

func (*DisableParams) Do

func (p *DisableParams) Do(ctx context.Context) (err error)

Do executes BluetoothEmulation.disable against the provided context.

type EnableParams

type EnableParams struct {
	State CentralState `json:"state"` // State of the simulated central.
}

EnableParams enable the BluetoothEmulation domain.

func Enable

func Enable(state CentralState) *EnableParams

Enable enable the BluetoothEmulation domain.

See: https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation#method-enable

parameters:

state - State of the simulated central.

func (*EnableParams) Do

func (p *EnableParams) Do(ctx context.Context) (err error)

Do executes BluetoothEmulation.enable against the provided context.

type ManufacturerData

type ManufacturerData struct {
	Key  int64  `json:"key"`  // Company identifier https://bitbucket.org/bluetooth-SIG/public/src/main/assigned_numbers/company_identifiers/company_identifiers.yaml https://usb.org/developers
	Data string `json:"data"` // Manufacturer-specific data
}

ManufacturerData stores the manufacturer data.

See: https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation#type-ManufacturerData

type ScanEntry

type ScanEntry struct {
	DeviceAddress string      `json:"deviceAddress"`
	Rssi          int64       `json:"rssi"`
	ScanRecord    *ScanRecord `json:"scanRecord"`
}

ScanEntry stores the advertisement packet information that is sent by a Bluetooth device.

See: https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation#type-ScanEntry

type ScanRecord

type ScanRecord struct {
	Name             string              `json:"name,omitempty,omitzero"`
	UUIDs            []string            `json:"uuids,omitempty,omitzero"`
	Appearance       int64               `json:"appearance,omitempty,omitzero"`       // Stores the external appearance description of the device.
	TxPower          int64               `json:"txPower,omitempty,omitzero"`          // Stores the transmission power of a broadcasting device.
	ManufacturerData []*ManufacturerData `json:"manufacturerData,omitempty,omitzero"` // 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.

See: https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation#type-ScanRecord

type SimulateAdvertisementParams

type SimulateAdvertisementParams struct {
	Entry *ScanEntry `json:"entry"`
}

SimulateAdvertisementParams simulates an advertisement packet described in |entry| being received by the central.

func SimulateAdvertisement

func SimulateAdvertisement(entry *ScanEntry) *SimulateAdvertisementParams

SimulateAdvertisement simulates an advertisement packet described in |entry| being received by the central.

See: https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation#method-simulateAdvertisement

parameters:

entry

func (*SimulateAdvertisementParams) Do

Do executes BluetoothEmulation.simulateAdvertisement against the provided context.

type SimulatePreconnectedPeripheralParams

type SimulatePreconnectedPeripheralParams struct {
	Address           string              `json:"address"`
	Name              string              `json:"name"`
	ManufacturerData  []*ManufacturerData `json:"manufacturerData"`
	KnownServiceUUIDs []string            `json:"knownServiceUuids"`
}

SimulatePreconnectedPeripheralParams simulates a peripheral with |address|, |name| and |knownServiceUuids| that has already been connected to the system.

func SimulatePreconnectedPeripheral

func SimulatePreconnectedPeripheral(address string, name string, manufacturerData []*ManufacturerData, knownServiceUUIDs []string) *SimulatePreconnectedPeripheralParams

SimulatePreconnectedPeripheral simulates a peripheral with |address|, |name| and |knownServiceUuids| that has already been connected to the system.

See: https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation#method-simulatePreconnectedPeripheral

parameters:

address
name
manufacturerData
knownServiceUUIDs

func (*SimulatePreconnectedPeripheralParams) Do

Do executes BluetoothEmulation.simulatePreconnectedPeripheral against the provided context.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL