Class: Selenium::DevTools::V137::BluetoothEmulation
- Inherits:
-
Object
- Object
- Selenium::DevTools::V137::BluetoothEmulation
- Defined in:
- lib/selenium/devtools/v137/bluetooth_emulation.rb
Constant Summary collapse
- EVENTS =
{ gatt_operation_received: 'gattOperationReceived', characteristic_operation_received: 'characteristicOperationReceived', }.freeze
Instance Method Summary collapse
- #add_characteristic(service_id:, characteristic_uuid:, properties:) ⇒ Object
- #add_descriptor(characteristic_id:, descriptor_uuid:) ⇒ Object
- #add_service(address:, service_uuid:) ⇒ Object
- #disable ⇒ Object
- #enable(state:, le_supported:) ⇒ Object
-
#initialize(devtools) ⇒ BluetoothEmulation
constructor
A new instance of BluetoothEmulation.
- #on(event, &block) ⇒ Object
- #remove_characteristic(characteristic_id:) ⇒ Object
- #remove_descriptor(descriptor_id:) ⇒ Object
- #remove_service(service_id:) ⇒ Object
- #set_simulated_central_state(state:) ⇒ Object
- #simulate_advertisement(entry:) ⇒ Object
- #simulate_characteristic_operation_response(characteristic_id:, type:, code:, data: nil) ⇒ Object
- #simulate_gatt_operation_response(address:, type:, code:) ⇒ Object
- #simulate_preconnected_peripheral(address:, name:, manufacturer_data:, known_service_uuids:) ⇒ Object
Constructor Details
#initialize(devtools) ⇒ BluetoothEmulation
Returns a new instance of BluetoothEmulation.
30 31 32 |
# File 'lib/selenium/devtools/v137/bluetooth_emulation.rb', line 30 def initialize(devtools) @devtools = devtools end |
Instance Method Details
#add_characteristic(service_id:, characteristic_uuid:, properties:) ⇒ Object
93 94 95 96 97 98 |
# File 'lib/selenium/devtools/v137/bluetooth_emulation.rb', line 93 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
105 106 107 108 109 |
# File 'lib/selenium/devtools/v137/bluetooth_emulation.rb', line 105 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
82 83 84 85 86 |
# File 'lib/selenium/devtools/v137/bluetooth_emulation.rb', line 82 def add_service(address:, service_uuid:) @devtools.send_cmd('BluetoothEmulation.addService', address: address, serviceUuid: service_uuid) end |
#disable ⇒ Object
50 51 52 |
# File 'lib/selenium/devtools/v137/bluetooth_emulation.rb', line 50 def disable @devtools.send_cmd('BluetoothEmulation.disable') end |
#enable(state:, le_supported:) ⇒ Object
39 40 41 42 43 |
# File 'lib/selenium/devtools/v137/bluetooth_emulation.rb', line 39 def enable(state:, le_supported:) @devtools.send_cmd('BluetoothEmulation.enable', state: state, leSupported: le_supported) end |
#on(event, &block) ⇒ Object
34 35 36 37 |
# File 'lib/selenium/devtools/v137/bluetooth_emulation.rb', line 34 def on(event, &block) event = EVENTS[event] if event.is_a?(Symbol) @devtools.callbacks["BluetoothEmulation.#{event}"] << block end |
#remove_characteristic(characteristic_id:) ⇒ Object
100 101 102 103 |
# File 'lib/selenium/devtools/v137/bluetooth_emulation.rb', line 100 def remove_characteristic(characteristic_id:) @devtools.send_cmd('BluetoothEmulation.removeCharacteristic', characteristicId: characteristic_id) end |
#remove_descriptor(descriptor_id:) ⇒ Object
111 112 113 114 |
# File 'lib/selenium/devtools/v137/bluetooth_emulation.rb', line 111 def remove_descriptor(descriptor_id:) @devtools.send_cmd('BluetoothEmulation.removeDescriptor', descriptorId: descriptor_id) end |
#remove_service(service_id:) ⇒ Object
88 89 90 91 |
# File 'lib/selenium/devtools/v137/bluetooth_emulation.rb', line 88 def remove_service(service_id:) @devtools.send_cmd('BluetoothEmulation.removeService', serviceId: service_id) end |
#set_simulated_central_state(state:) ⇒ Object
45 46 47 48 |
# File 'lib/selenium/devtools/v137/bluetooth_emulation.rb', line 45 def set_simulated_central_state(state:) @devtools.send_cmd('BluetoothEmulation.setSimulatedCentralState', state: state) end |
#simulate_advertisement(entry:) ⇒ Object
62 63 64 65 |
# File 'lib/selenium/devtools/v137/bluetooth_emulation.rb', line 62 def simulate_advertisement(entry:) @devtools.send_cmd('BluetoothEmulation.simulateAdvertisement', entry: entry) end |
#simulate_characteristic_operation_response(characteristic_id:, type:, code:, data: nil) ⇒ Object
74 75 76 77 78 79 80 |
# File 'lib/selenium/devtools/v137/bluetooth_emulation.rb', line 74 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_gatt_operation_response(address:, type:, code:) ⇒ Object
67 68 69 70 71 72 |
# File 'lib/selenium/devtools/v137/bluetooth_emulation.rb', line 67 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
54 55 56 57 58 59 60 |
# File 'lib/selenium/devtools/v137/bluetooth_emulation.rb', line 54 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 |