Class: Selenium::DevTools::V138::BluetoothEmulation

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v138/bluetooth_emulation.rb

Constant Summary collapse

EVENTS =
{
  gatt_operation_received: 'gattOperationReceived',
  characteristic_operation_received: 'characteristicOperationReceived',
  descriptor_operation_received: 'descriptorOperationReceived',
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ BluetoothEmulation

Returns a new instance of BluetoothEmulation.



31
32
33
# File 'lib/selenium/devtools/v138/bluetooth_emulation.rb', line 31

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#add_characteristic(service_id:, characteristic_uuid:, properties:) ⇒ Object



102
103
104
105
106
107
# File 'lib/selenium/devtools/v138/bluetooth_emulation.rb', line 102

def add_characteristic(service_id:, characteristic_uuid:, properties:)
  @devtools.send_cmd('BluetoothEmulation.addCharacteristic',
                     serviceId: service_id,
                     characteristicUuid: characteristic_uuid,
                     properties: properties)
end

#add_descriptor(characteristic_id:, descriptor_uuid:) ⇒ Object



114
115
116
117
118
# File 'lib/selenium/devtools/v138/bluetooth_emulation.rb', line 114

def add_descriptor(characteristic_id:, descriptor_uuid:)
  @devtools.send_cmd('BluetoothEmulation.addDescriptor',
                     characteristicId: characteristic_id,
                     descriptorUuid: descriptor_uuid)
end

#add_service(address:, service_uuid:) ⇒ Object



91
92
93
94
95
# File 'lib/selenium/devtools/v138/bluetooth_emulation.rb', line 91

def add_service(address:, service_uuid:)
  @devtools.send_cmd('BluetoothEmulation.addService',
                     address: address,
                     serviceUuid: service_uuid)
end

#disableObject



51
52
53
# File 'lib/selenium/devtools/v138/bluetooth_emulation.rb', line 51

def disable
  @devtools.send_cmd('BluetoothEmulation.disable')
end

#enable(state:, le_supported:) ⇒ Object



40
41
42
43
44
# File 'lib/selenium/devtools/v138/bluetooth_emulation.rb', line 40

def enable(state:, le_supported:)
  @devtools.send_cmd('BluetoothEmulation.enable',
                     state: state,
                     leSupported: le_supported)
end

#on(event, &block) ⇒ Object



35
36
37
38
# File 'lib/selenium/devtools/v138/bluetooth_emulation.rb', line 35

def on(event, &block)
  event = EVENTS[event] if event.is_a?(Symbol)
  @devtools.callbacks["BluetoothEmulation.#{event}"] << block
end

#remove_characteristic(characteristic_id:) ⇒ Object



109
110
111
112
# File 'lib/selenium/devtools/v138/bluetooth_emulation.rb', line 109

def remove_characteristic(characteristic_id:)
  @devtools.send_cmd('BluetoothEmulation.removeCharacteristic',
                     characteristicId: characteristic_id)
end

#remove_descriptor(descriptor_id:) ⇒ Object



120
121
122
123
# File 'lib/selenium/devtools/v138/bluetooth_emulation.rb', line 120

def remove_descriptor(descriptor_id:)
  @devtools.send_cmd('BluetoothEmulation.removeDescriptor',
                     descriptorId: descriptor_id)
end

#remove_service(service_id:) ⇒ Object



97
98
99
100
# File 'lib/selenium/devtools/v138/bluetooth_emulation.rb', line 97

def remove_service(service_id:)
  @devtools.send_cmd('BluetoothEmulation.removeService',
                     serviceId: service_id)
end

#set_simulated_central_state(state:) ⇒ Object



46
47
48
49
# File 'lib/selenium/devtools/v138/bluetooth_emulation.rb', line 46

def set_simulated_central_state(state:)
  @devtools.send_cmd('BluetoothEmulation.setSimulatedCentralState',
                     state: state)
end

#simulate_advertisement(entry:) ⇒ Object



63
64
65
66
# File 'lib/selenium/devtools/v138/bluetooth_emulation.rb', line 63

def simulate_advertisement(entry:)
  @devtools.send_cmd('BluetoothEmulation.simulateAdvertisement',
                     entry: entry)
end

#simulate_characteristic_operation_response(characteristic_id:, type:, code:, data: nil) ⇒ Object



75
76
77
78
79
80
81
# File 'lib/selenium/devtools/v138/bluetooth_emulation.rb', line 75

def simulate_characteristic_operation_response(characteristic_id:, type:, code:, data: nil)
  @devtools.send_cmd('BluetoothEmulation.simulateCharacteristicOperationResponse',
                     characteristicId: characteristic_id,
                     type: type,
                     code: code,
                     data: data)
end

#simulate_descriptor_operation_response(descriptor_id:, type:, code:, data: nil) ⇒ Object



83
84
85
86
87
88
89
# File 'lib/selenium/devtools/v138/bluetooth_emulation.rb', line 83

def simulate_descriptor_operation_response(descriptor_id:, type:, code:, data: nil)
  @devtools.send_cmd('BluetoothEmulation.simulateDescriptorOperationResponse',
                     descriptorId: descriptor_id,
                     type: type,
                     code: code,
                     data: data)
end

#simulate_gatt_disconnection(address:) ⇒ Object



125
126
127
128
# File 'lib/selenium/devtools/v138/bluetooth_emulation.rb', line 125

def simulate_gatt_disconnection(address:)
  @devtools.send_cmd('BluetoothEmulation.simulateGATTDisconnection',
                     address: address)
end

#simulate_gatt_operation_response(address:, type:, code:) ⇒ Object



68
69
70
71
72
73
# File 'lib/selenium/devtools/v138/bluetooth_emulation.rb', line 68

def simulate_gatt_operation_response(address:, type:, code:)
  @devtools.send_cmd('BluetoothEmulation.simulateGATTOperationResponse',
                     address: address,
                     type: type,
                     code: code)
end

#simulate_preconnected_peripheral(address:, name:, manufacturer_data:, known_service_uuids:) ⇒ Object



55
56
57
58
59
60
61
# File 'lib/selenium/devtools/v138/bluetooth_emulation.rb', line 55

def simulate_preconnected_peripheral(address:, name:, manufacturer_data:, known_service_uuids:)
  @devtools.send_cmd('BluetoothEmulation.simulatePreconnectedPeripheral',
                     address: address,
                     name: name,
                     manufacturerData: manufacturer_data,
                     knownServiceUuids: known_service_uuids)
end