Class: Selenium::DevTools::V150::BluetoothEmulation

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v150/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.



32
33
34
# File 'lib/selenium/devtools/v150/bluetooth_emulation.rb', line 32

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

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



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

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



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

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



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

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

#disableObject



52
53
54
# File 'lib/selenium/devtools/v150/bluetooth_emulation.rb', line 52

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

#enable(state:, le_supported:) ⇒ Object



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

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

#on(event, &block) ⇒ Object



36
37
38
39
# File 'lib/selenium/devtools/v150/bluetooth_emulation.rb', line 36

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

#remove_characteristic(characteristic_id:) ⇒ Object



110
111
112
113
# File 'lib/selenium/devtools/v150/bluetooth_emulation.rb', line 110

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

#remove_descriptor(descriptor_id:) ⇒ Object



121
122
123
124
# File 'lib/selenium/devtools/v150/bluetooth_emulation.rb', line 121

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

#remove_service(service_id:) ⇒ Object



98
99
100
101
# File 'lib/selenium/devtools/v150/bluetooth_emulation.rb', line 98

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

#set_simulated_central_state(state:) ⇒ Object



47
48
49
50
# File 'lib/selenium/devtools/v150/bluetooth_emulation.rb', line 47

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

#simulate_advertisement(entry:) ⇒ Object



64
65
66
67
# File 'lib/selenium/devtools/v150/bluetooth_emulation.rb', line 64

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

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



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

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



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

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



126
127
128
129
# File 'lib/selenium/devtools/v150/bluetooth_emulation.rb', line 126

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

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



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

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



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

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