mirror of
https://github.com/google/bumble.git
synced 2026-05-09 04:08:02 +00:00
support more commands in controller.py
This commit is contained in:
@@ -458,8 +458,8 @@ class Controller:
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Send a scan report
|
# Send a scan report
|
||||||
report = HCI_Object(
|
report = HCI_LE_Advertising_Report_Event.Report(
|
||||||
HCI_LE_Advertising_Report_Event.REPORT_FIELDS,
|
HCI_LE_Advertising_Report_Event.Report.FIELDS,
|
||||||
event_type=HCI_LE_Advertising_Report_Event.ADV_IND,
|
event_type=HCI_LE_Advertising_Report_Event.ADV_IND,
|
||||||
address_type=sender_address.address_type,
|
address_type=sender_address.address_type,
|
||||||
address=sender_address,
|
address=sender_address,
|
||||||
@@ -469,8 +469,8 @@ class Controller:
|
|||||||
self.send_hci_packet(HCI_LE_Advertising_Report_Event([report]))
|
self.send_hci_packet(HCI_LE_Advertising_Report_Event([report]))
|
||||||
|
|
||||||
# Simulate a scan response
|
# Simulate a scan response
|
||||||
report = HCI_Object(
|
report = HCI_LE_Advertising_Report_Event.Report(
|
||||||
HCI_LE_Advertising_Report_Event.REPORT_FIELDS,
|
HCI_LE_Advertising_Report_Event.Report.FIELDS,
|
||||||
event_type=HCI_LE_Advertising_Report_Event.SCAN_RSP,
|
event_type=HCI_LE_Advertising_Report_Event.SCAN_RSP,
|
||||||
address_type=sender_address.address_type,
|
address_type=sender_address.address_type,
|
||||||
address=sender_address,
|
address=sender_address,
|
||||||
@@ -738,10 +738,10 @@ class Controller:
|
|||||||
self.advertising_parameters = command
|
self.advertising_parameters = command
|
||||||
return bytes([HCI_SUCCESS])
|
return bytes([HCI_SUCCESS])
|
||||||
|
|
||||||
def on_hci_le_read_advertising_channel_tx_power_command(self, _command):
|
def on_hci_le_read_advertising_physical_channel_tx_power_command(self, _command):
|
||||||
'''
|
'''
|
||||||
See Bluetooth spec Vol 2, Part E - 7.8.6 LE Read Advertising Channel Tx Power
|
See Bluetooth spec Vol 2, Part E - 7.8.6 LE Read Advertising Physical Channel
|
||||||
Command
|
Tx Power Command
|
||||||
'''
|
'''
|
||||||
return bytes([HCI_SUCCESS, self.advertising_channel_tx_power])
|
return bytes([HCI_SUCCESS, self.advertising_channel_tx_power])
|
||||||
|
|
||||||
@@ -1008,7 +1008,7 @@ class Controller:
|
|||||||
|
|
||||||
def on_hci_le_read_phy_command(self, command):
|
def on_hci_le_read_phy_command(self, command):
|
||||||
'''
|
'''
|
||||||
See Bluetooth spec Vol 2, Part E - 7.8.47 LE Read PHY command
|
See Bluetooth spec Vol 2, Part E - 7.8.47 LE Read PHY Command
|
||||||
'''
|
'''
|
||||||
return struct.pack(
|
return struct.pack(
|
||||||
'<BHBB',
|
'<BHBB',
|
||||||
@@ -1028,3 +1028,9 @@ class Controller:
|
|||||||
'rx_phys': command.rx_phys,
|
'rx_phys': command.rx_phys,
|
||||||
}
|
}
|
||||||
return bytes([HCI_SUCCESS])
|
return bytes([HCI_SUCCESS])
|
||||||
|
|
||||||
|
def on_hci_le_read_transmit_power_command(self, command):
|
||||||
|
'''
|
||||||
|
See Bluetooth spec Vol 2, Part E - 7.8.74 LE Read Transmit Power Command
|
||||||
|
'''
|
||||||
|
return struct.pack('<BBB', HCI_SUCCESS, 0, 0)
|
||||||
|
|||||||
@@ -2393,11 +2393,10 @@ class Device(CompositeEventEmitter):
|
|||||||
# If supported, read which PHY we're connected with before
|
# If supported, read which PHY we're connected with before
|
||||||
# notifying listeners of the new connection.
|
# notifying listeners of the new connection.
|
||||||
if self.host.supports_command(HCI_LE_READ_PHY_COMMAND):
|
if self.host.supports_command(HCI_LE_READ_PHY_COMMAND):
|
||||||
|
|
||||||
async def read_phy():
|
async def read_phy():
|
||||||
result = await self.send_command(
|
result = await self.send_command(
|
||||||
HCI_LE_Read_PHY_Command(
|
HCI_LE_Read_PHY_Command(connection_handle=connection_handle),
|
||||||
connection_handle=connection_handle
|
|
||||||
),
|
|
||||||
check_result=True,
|
check_result=True,
|
||||||
)
|
)
|
||||||
connection.phy = ConnectionPHY(
|
connection.phy = ConnectionPHY(
|
||||||
|
|||||||
Reference in New Issue
Block a user