forked from auracaster/bumble_mirror
Advertising Set Info Transfer
This commit is contained in:
@@ -794,6 +794,17 @@ class AdvertisingSet(EventEmitter):
|
|||||||
)
|
)
|
||||||
del self.device.extended_advertising_sets[self.advertising_handle]
|
del self.device.extended_advertising_sets[self.advertising_handle]
|
||||||
|
|
||||||
|
async def transfer_periodic_info(
|
||||||
|
self, connection: Connection, service_data: int = 0
|
||||||
|
) -> None:
|
||||||
|
if not self.periodic_enabled:
|
||||||
|
raise core.InvalidStateError(
|
||||||
|
f"Periodic Advertising is not enabled on Advertising Set 0x{self.advertising_handle:02X}"
|
||||||
|
)
|
||||||
|
await connection.transfer_periodic_set_info(
|
||||||
|
self.advertising_handle, service_data
|
||||||
|
)
|
||||||
|
|
||||||
def on_termination(self, status: int) -> None:
|
def on_termination(self, status: int) -> None:
|
||||||
self.enabled = False
|
self.enabled = False
|
||||||
self.emit('termination', status)
|
self.emit('termination', status)
|
||||||
@@ -1782,6 +1793,13 @@ class Connection(CompositeEventEmitter):
|
|||||||
) -> None:
|
) -> None:
|
||||||
await self.device.transfer_periodic_sync(self, sync_handle, service_data)
|
await self.device.transfer_periodic_sync(self, sync_handle, service_data)
|
||||||
|
|
||||||
|
async def transfer_periodic_set_info(
|
||||||
|
self, advertising_handle: int, service_data: int = 0
|
||||||
|
) -> None:
|
||||||
|
await self.device.transfer_periodic_set_info(
|
||||||
|
self, advertising_handle, service_data
|
||||||
|
)
|
||||||
|
|
||||||
# [Classic only]
|
# [Classic only]
|
||||||
async def request_remote_name(self):
|
async def request_remote_name(self):
|
||||||
return await self.device.request_remote_name(self)
|
return await self.device.request_remote_name(self)
|
||||||
@@ -4001,6 +4019,18 @@ class Device(CompositeEventEmitter):
|
|||||||
check_result=True,
|
check_result=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
async def transfer_periodic_set_info(
|
||||||
|
self, connection: Connection, advertising_handle: int, service_data: int = 0
|
||||||
|
) -> None:
|
||||||
|
return await self.send_command(
|
||||||
|
hci.HCI_LE_Periodic_Advertising_Set_Info_Transfer_Command(
|
||||||
|
connection_handle=connection.handle,
|
||||||
|
service_data=service_data,
|
||||||
|
advertising_handle=advertising_handle,
|
||||||
|
),
|
||||||
|
check_result=True,
|
||||||
|
)
|
||||||
|
|
||||||
async def find_peer_by_name(self, name, transport=BT_LE_TRANSPORT):
|
async def find_peer_by_name(self, name, transport=BT_LE_TRANSPORT):
|
||||||
"""
|
"""
|
||||||
Scan for a peer with a given name and return its address.
|
Scan for a peer with a given name and return its address.
|
||||||
|
|||||||
@@ -4883,6 +4883,20 @@ class HCI_LE_Periodic_Advertising_Sync_Transfer_Command(HCI_Command):
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
@HCI_Command.command(
|
||||||
|
fields=[('connection_handle', 2), ('service_data', 2), ('advertising_handle', 1)],
|
||||||
|
return_parameters_fields=[
|
||||||
|
('status', STATUS_SPEC),
|
||||||
|
('connection_handle', 2),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
class HCI_LE_Periodic_Advertising_Set_Info_Transfer_Command(HCI_Command):
|
||||||
|
'''
|
||||||
|
See Bluetooth spec @ 7.8.90 LE Periodic Advertising Set Info Transfer Command
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
@HCI_Command.command(
|
@HCI_Command.command(
|
||||||
fields=[
|
fields=[
|
||||||
|
|||||||
Reference in New Issue
Block a user