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
- type AddCharacteristicParams
- type AddCharacteristicReturns
- type AddDescriptorParams
- type AddDescriptorReturns
- type AddServiceParams
- type AddServiceReturns
- type CentralState
- type CharacteristicOperationType
- type CharacteristicProperties
- type CharacteristicWriteType
- type DescriptorOperationType
- type DisableParams
- type EnableParams
- type EventCharacteristicOperationReceived
- type EventDescriptorOperationReceived
- type EventGattOperationReceived
- type GATTOperationType
- type ManufacturerData
- type RemoveCharacteristicParams
- type RemoveDescriptorParams
- type RemoveServiceParams
- type ScanEntry
- type ScanRecord
- type SetSimulatedCentralStateParams
- type SimulateAdvertisementParams
- type SimulateCharacteristicOperationResponseParams
- type SimulateDescriptorOperationResponseParams
- type SimulateGATTDisconnectionParams
- type SimulateGATTOperationResponseParams
- type SimulatePreconnectedPeripheralParams
Constants ¶
const ( CommandEnable = "BluetoothEmulation.enable" CommandSetSimulatedCentralState = "BluetoothEmulation.setSimulatedCentralState" CommandDisable = "BluetoothEmulation.disable" CommandSimulatePreconnectedPeripheral = "BluetoothEmulation.simulatePreconnectedPeripheral" CommandSimulateAdvertisement = "BluetoothEmulation.simulateAdvertisement" CommandSimulateGATTOperationResponse = "BluetoothEmulation.simulateGATTOperationResponse" CommandSimulateCharacteristicOperationResponse = "BluetoothEmulation.simulateCharacteristicOperationResponse" CommandSimulateDescriptorOperationResponse = "BluetoothEmulation.simulateDescriptorOperationResponse" CommandAddService = "BluetoothEmulation.addService" CommandRemoveService = "BluetoothEmulation.removeService" CommandAddCharacteristic = "BluetoothEmulation.addCharacteristic" CommandRemoveCharacteristic = "BluetoothEmulation.removeCharacteristic" CommandAddDescriptor = "BluetoothEmulation.addDescriptor" CommandRemoveDescriptor = "BluetoothEmulation.removeDescriptor" CommandSimulateGATTDisconnection = "BluetoothEmulation.simulateGATTDisconnection" )
Command names.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddCharacteristicParams ¶
type AddCharacteristicParams struct {
ServiceID string `json:"serviceId"`
CharacteristicUUID string `json:"characteristicUuid"`
Properties *CharacteristicProperties `json:"properties"`
}
AddCharacteristicParams adds a characteristic with |characteristicUuid| and |properties| to the service represented by |serviceId|.
func AddCharacteristic ¶
func AddCharacteristic(serviceID string, characteristicUUID string, properties *CharacteristicProperties) *AddCharacteristicParams
AddCharacteristic adds a characteristic with |characteristicUuid| and |properties| to the service represented by |serviceId|.
See: https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation#method-addCharacteristic
parameters:
serviceID characteristicUUID properties
type AddCharacteristicReturns ¶
type AddCharacteristicReturns struct {
CharacteristicID string `json:"characteristicId,omitempty,omitzero"` // An identifier that uniquely represents this characteristic.
}
AddCharacteristicReturns return values.
type AddDescriptorParams ¶
type AddDescriptorParams struct {
CharacteristicID string `json:"characteristicId"`
DescriptorUUID string `json:"descriptorUuid"`
}
AddDescriptorParams adds a descriptor with |descriptorUuid| to the characteristic respresented by |characteristicId|.
func AddDescriptor ¶
func AddDescriptor(characteristicID string, descriptorUUID string) *AddDescriptorParams
AddDescriptor adds a descriptor with |descriptorUuid| to the characteristic respresented by |characteristicId|.
See: https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation#method-addDescriptor
parameters:
characteristicID descriptorUUID
type AddDescriptorReturns ¶
type AddDescriptorReturns struct {
DescriptorID string `json:"descriptorId,omitempty,omitzero"` // An identifier that uniquely represents this descriptor.
}
AddDescriptorReturns return values.
type AddServiceParams ¶
type AddServiceParams struct {
Address string `json:"address"`
ServiceUUID string `json:"serviceUuid"`
}
AddServiceParams adds a service with |serviceUuid| to the peripheral with |address|.
func AddService ¶
func AddService(address string, serviceUUID string) *AddServiceParams
AddService adds a service with |serviceUuid| to the peripheral with |address|.
See: https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation#method-addService
parameters:
address serviceUUID
type AddServiceReturns ¶
type AddServiceReturns struct {
ServiceID string `json:"serviceId,omitempty,omitzero"` // An identifier that uniquely represents this service.
}
AddServiceReturns return values.
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 CharacteristicOperationType ¶
type CharacteristicOperationType string
CharacteristicOperationType indicates the various types of characteristic operation.
const ( CharacteristicOperationTypeRead CharacteristicOperationType = "read" CharacteristicOperationTypeWrite CharacteristicOperationType = "write" CharacteristicOperationTypeSubscribeToNotifications CharacteristicOperationType = "subscribe-to-notifications" CharacteristicOperationTypeUnsubscribeFromNotifications CharacteristicOperationType = "unsubscribe-from-notifications" )
CharacteristicOperationType values.
func (CharacteristicOperationType) String ¶
func (t CharacteristicOperationType) String() string
String returns the CharacteristicOperationType as string value.
func (*CharacteristicOperationType) UnmarshalJSON ¶
func (t *CharacteristicOperationType) UnmarshalJSON(buf []byte) error
UnmarshalJSON satisfies [json.Unmarshaler].
type CharacteristicProperties ¶
type CharacteristicProperties struct {
Broadcast bool `json:"broadcast"`
Read bool `json:"read"`
WriteWithoutResponse bool `json:"writeWithoutResponse"`
Write bool `json:"write"`
Notify bool `json:"notify"`
Indicate bool `json:"indicate"`
AuthenticatedSignedWrites bool `json:"authenticatedSignedWrites"`
ExtendedProperties bool `json:"extendedProperties"`
}
CharacteristicProperties describes the properties of a characteristic. This follows Bluetooth Core Specification BT 4.2 Vol 3 Part G 3.3.1. Characteristic Properties.
type CharacteristicWriteType ¶
type CharacteristicWriteType string
CharacteristicWriteType indicates the various types of characteristic write.
const ( CharacteristicWriteTypeWriteDefaultDeprecated CharacteristicWriteType = "write-default-deprecated" CharacteristicWriteTypeWriteWithResponse CharacteristicWriteType = "write-with-response" CharacteristicWriteTypeWriteWithoutResponse CharacteristicWriteType = "write-without-response" )
CharacteristicWriteType values.
func (CharacteristicWriteType) String ¶
func (t CharacteristicWriteType) String() string
String returns the CharacteristicWriteType as string value.
func (*CharacteristicWriteType) UnmarshalJSON ¶
func (t *CharacteristicWriteType) UnmarshalJSON(buf []byte) error
UnmarshalJSON satisfies [json.Unmarshaler].
type DescriptorOperationType ¶
type DescriptorOperationType string
DescriptorOperationType indicates the various types of descriptor operation.
const ( DescriptorOperationTypeRead DescriptorOperationType = "read" DescriptorOperationTypeWrite DescriptorOperationType = "write" )
DescriptorOperationType values.
func (DescriptorOperationType) String ¶
func (t DescriptorOperationType) String() string
String returns the DescriptorOperationType as string value.
func (*DescriptorOperationType) UnmarshalJSON ¶
func (t *DescriptorOperationType) 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
type EnableParams ¶
type EnableParams struct {
State CentralState `json:"state"` // State of the simulated central.
LeSupported bool `json:"leSupported"` // If the simulated central supports low-energy.
}
EnableParams enable the BluetoothEmulation domain.
func Enable ¶
func Enable(state CentralState, leSupported bool) *EnableParams
Enable enable the BluetoothEmulation domain.
See: https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation#method-enable
parameters:
state - State of the simulated central. leSupported - If the simulated central supports low-energy.
type EventCharacteristicOperationReceived ¶
type EventCharacteristicOperationReceived struct {
CharacteristicID string `json:"characteristicId"`
Type CharacteristicOperationType `json:"type"`
Data string `json:"data,omitempty,omitzero"`
WriteType CharacteristicWriteType `json:"writeType,omitempty,omitzero"`
}
EventCharacteristicOperationReceived event for when a characteristic operation of |type| to the characteristic respresented by |characteristicId| happened. |data| and |writeType| is expected to exist when |type| is write.
type EventDescriptorOperationReceived ¶
type EventDescriptorOperationReceived struct {
DescriptorID string `json:"descriptorId"`
Type DescriptorOperationType `json:"type"`
Data string `json:"data,omitempty,omitzero"`
}
EventDescriptorOperationReceived event for when a descriptor operation of |type| to the descriptor respresented by |descriptorId| happened. |data| is expected to exist when |type| is write.
type EventGattOperationReceived ¶
type EventGattOperationReceived struct {
Address string `json:"address"`
Type GATTOperationType `json:"type"`
}
EventGattOperationReceived event for when a GATT operation of |type| to the peripheral with |address| happened.
type GATTOperationType ¶
type GATTOperationType string
GATTOperationType indicates the various types of GATT event.
See: https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation#type-GATTOperationType
const ( GATTOperationTypeConnection GATTOperationType = "connection" GATTOperationTypeDiscovery GATTOperationType = "discovery" )
GATTOperationType values.
func (GATTOperationType) String ¶
func (t GATTOperationType) String() string
String returns the GATTOperationType as string value.
func (*GATTOperationType) UnmarshalJSON ¶
func (t *GATTOperationType) UnmarshalJSON(buf []byte) error
UnmarshalJSON satisfies [json.Unmarshaler].
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 RemoveCharacteristicParams ¶
type RemoveCharacteristicParams struct {
CharacteristicID string `json:"characteristicId"`
}
RemoveCharacteristicParams removes the characteristic respresented by |characteristicId| from the simulated central.
func RemoveCharacteristic ¶
func RemoveCharacteristic(characteristicID string) *RemoveCharacteristicParams
RemoveCharacteristic removes the characteristic respresented by |characteristicId| from the simulated central.
parameters:
characteristicID
type RemoveDescriptorParams ¶
type RemoveDescriptorParams struct {
DescriptorID string `json:"descriptorId"`
}
RemoveDescriptorParams removes the descriptor with |descriptorId| from the simulated central.
func RemoveDescriptor ¶
func RemoveDescriptor(descriptorID string) *RemoveDescriptorParams
RemoveDescriptor removes the descriptor with |descriptorId| from the simulated central.
See: https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation#method-removeDescriptor
parameters:
descriptorID
type RemoveServiceParams ¶
type RemoveServiceParams struct {
ServiceID string `json:"serviceId"`
}
RemoveServiceParams removes the service respresented by |serviceId| from the simulated central.
func RemoveService ¶
func RemoveService(serviceID string) *RemoveServiceParams
RemoveService removes the service respresented by |serviceId| from the simulated central.
See: https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation#method-removeService
parameters:
serviceID
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 SetSimulatedCentralStateParams ¶
type SetSimulatedCentralStateParams struct {
State CentralState `json:"state"` // State of the simulated central.
}
SetSimulatedCentralStateParams set the state of the simulated central.
func SetSimulatedCentralState ¶
func SetSimulatedCentralState(state CentralState) *SetSimulatedCentralStateParams
SetSimulatedCentralState set the state of the simulated central.
parameters:
state - State of the simulated central.
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.
parameters:
entry
type SimulateCharacteristicOperationResponseParams ¶
type SimulateCharacteristicOperationResponseParams struct {
CharacteristicID string `json:"characteristicId"`
Type CharacteristicOperationType `json:"type"`
Code int64 `json:"code"`
Data string `json:"data,omitempty,omitzero"`
}
SimulateCharacteristicOperationResponseParams simulates the response from the characteristic with |characteristicId| for a characteristic operation of |type|. The |code| value follows the Error Codes from Bluetooth Core Specification Vol 3 Part F 3.4.1.1 Error Response. The |data| is expected to exist when simulating a successful read operation response.
func SimulateCharacteristicOperationResponse ¶
func SimulateCharacteristicOperationResponse(characteristicID string, typeVal CharacteristicOperationType, code int64) *SimulateCharacteristicOperationResponseParams
SimulateCharacteristicOperationResponse simulates the response from the characteristic with |characteristicId| for a characteristic operation of |type|. The |code| value follows the Error Codes from Bluetooth Core Specification Vol 3 Part F 3.4.1.1 Error Response. The |data| is expected to exist when simulating a successful read operation response.
parameters:
characteristicID type code
func (*SimulateCharacteristicOperationResponseParams) Do ¶
func (p *SimulateCharacteristicOperationResponseParams) Do(ctx context.Context) (err error)
Do executes BluetoothEmulation.simulateCharacteristicOperationResponse against the provided context.
func (SimulateCharacteristicOperationResponseParams) WithData ¶
func (p SimulateCharacteristicOperationResponseParams) WithData(data string) *SimulateCharacteristicOperationResponseParams
WithData [no description].
type SimulateDescriptorOperationResponseParams ¶
type SimulateDescriptorOperationResponseParams struct {
DescriptorID string `json:"descriptorId"`
Type DescriptorOperationType `json:"type"`
Code int64 `json:"code"`
Data string `json:"data,omitempty,omitzero"`
}
SimulateDescriptorOperationResponseParams simulates the response from the descriptor with |descriptorId| for a descriptor operation of |type|. The |code| value follows the Error Codes from Bluetooth Core Specification Vol 3 Part F 3.4.1.1 Error Response. The |data| is expected to exist when simulating a successful read operation response.
func SimulateDescriptorOperationResponse ¶
func SimulateDescriptorOperationResponse(descriptorID string, typeVal DescriptorOperationType, code int64) *SimulateDescriptorOperationResponseParams
SimulateDescriptorOperationResponse simulates the response from the descriptor with |descriptorId| for a descriptor operation of |type|. The |code| value follows the Error Codes from Bluetooth Core Specification Vol 3 Part F 3.4.1.1 Error Response. The |data| is expected to exist when simulating a successful read operation response.
parameters:
descriptorID type code
func (*SimulateDescriptorOperationResponseParams) Do ¶
func (p *SimulateDescriptorOperationResponseParams) Do(ctx context.Context) (err error)
Do executes BluetoothEmulation.simulateDescriptorOperationResponse against the provided context.
func (SimulateDescriptorOperationResponseParams) WithData ¶
func (p SimulateDescriptorOperationResponseParams) WithData(data string) *SimulateDescriptorOperationResponseParams
WithData [no description].
type SimulateGATTDisconnectionParams ¶
type SimulateGATTDisconnectionParams struct {
Address string `json:"address"`
}
SimulateGATTDisconnectionParams simulates a GATT disconnection from the peripheral with |address|.
func SimulateGATTDisconnection ¶
func SimulateGATTDisconnection(address string) *SimulateGATTDisconnectionParams
SimulateGATTDisconnection simulates a GATT disconnection from the peripheral with |address|.
parameters:
address
type SimulateGATTOperationResponseParams ¶
type SimulateGATTOperationResponseParams struct {
Address string `json:"address"`
Type GATTOperationType `json:"type"`
Code int64 `json:"code"`
}
SimulateGATTOperationResponseParams simulates the response code from the peripheral with |address| for a GATT operation of |type|. The |code| value follows the HCI Error Codes from Bluetooth Core Specification Vol 2 Part D 1.3 List Of Error Codes.
func SimulateGATTOperationResponse ¶
func SimulateGATTOperationResponse(address string, typeVal GATTOperationType, code int64) *SimulateGATTOperationResponseParams
SimulateGATTOperationResponse simulates the response code from the peripheral with |address| for a GATT operation of |type|. The |code| value follows the HCI Error Codes from Bluetooth Core Specification Vol 2 Part D 1.3 List Of Error Codes.
parameters:
address type code
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.
parameters:
address name manufacturerData knownServiceUUIDs