bumble 0.0.203__py3-none-any.whl → 0.0.207__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bumble/_version.py +2 -2
- bumble/apps/auracast.py +626 -87
- bumble/apps/bench.py +227 -148
- bumble/apps/controller_info.py +23 -7
- bumble/apps/device_info.py +50 -4
- bumble/apps/lea_unicast/app.py +61 -201
- bumble/apps/pair.py +13 -8
- bumble/apps/show.py +6 -6
- bumble/att.py +10 -11
- bumble/audio/__init__.py +17 -0
- bumble/audio/io.py +553 -0
- bumble/controller.py +24 -9
- bumble/core.py +4 -1
- bumble/device.py +993 -48
- bumble/drivers/common.py +2 -0
- bumble/drivers/intel.py +593 -24
- bumble/gatt.py +67 -12
- bumble/gatt_client.py +14 -2
- bumble/gatt_server.py +12 -1
- bumble/hci.py +854 -33
- bumble/host.py +363 -64
- bumble/l2cap.py +3 -16
- bumble/pairing.py +3 -0
- bumble/profiles/aics.py +45 -80
- bumble/profiles/ascs.py +6 -18
- bumble/profiles/asha.py +5 -5
- bumble/profiles/bass.py +9 -21
- bumble/profiles/device_information_service.py +4 -1
- bumble/profiles/gatt_service.py +166 -0
- bumble/profiles/gmap.py +193 -0
- bumble/profiles/heart_rate_service.py +5 -6
- bumble/profiles/le_audio.py +87 -4
- bumble/profiles/pacs.py +48 -16
- bumble/profiles/tmap.py +3 -9
- bumble/profiles/{vcp.py → vcs.py} +33 -28
- bumble/profiles/vocs.py +299 -0
- bumble/sdp.py +223 -93
- bumble/smp.py +8 -3
- bumble/tools/intel_fw_download.py +130 -0
- bumble/tools/intel_util.py +154 -0
- bumble/transport/usb.py +8 -2
- bumble/utils.py +22 -7
- bumble/vendor/android/hci.py +29 -4
- {bumble-0.0.203.dist-info → bumble-0.0.207.dist-info}/METADATA +12 -10
- {bumble-0.0.203.dist-info → bumble-0.0.207.dist-info}/RECORD +49 -43
- {bumble-0.0.203.dist-info → bumble-0.0.207.dist-info}/WHEEL +1 -1
- {bumble-0.0.203.dist-info → bumble-0.0.207.dist-info}/entry_points.txt +3 -0
- bumble/apps/lea_unicast/liblc3.wasm +0 -0
- {bumble-0.0.203.dist-info → bumble-0.0.207.dist-info}/LICENSE +0 -0
- {bumble-0.0.203.dist-info → bumble-0.0.207.dist-info}/top_level.txt +0 -0
bumble/hci.py
CHANGED
|
@@ -129,6 +129,7 @@ HCI_VERSION_BLUETOOTH_CORE_5_1 = 10
|
|
|
129
129
|
HCI_VERSION_BLUETOOTH_CORE_5_2 = 11
|
|
130
130
|
HCI_VERSION_BLUETOOTH_CORE_5_3 = 12
|
|
131
131
|
HCI_VERSION_BLUETOOTH_CORE_5_4 = 13
|
|
132
|
+
HCI_VERSION_BLUETOOTH_CORE_6_0 = 14
|
|
132
133
|
|
|
133
134
|
HCI_VERSION_NAMES = {
|
|
134
135
|
HCI_VERSION_BLUETOOTH_CORE_1_0B: 'HCI_VERSION_BLUETOOTH_CORE_1_0B',
|
|
@@ -145,6 +146,7 @@ HCI_VERSION_NAMES = {
|
|
|
145
146
|
HCI_VERSION_BLUETOOTH_CORE_5_2: 'HCI_VERSION_BLUETOOTH_CORE_5_2',
|
|
146
147
|
HCI_VERSION_BLUETOOTH_CORE_5_3: 'HCI_VERSION_BLUETOOTH_CORE_5_3',
|
|
147
148
|
HCI_VERSION_BLUETOOTH_CORE_5_4: 'HCI_VERSION_BLUETOOTH_CORE_5_4',
|
|
149
|
+
HCI_VERSION_BLUETOOTH_CORE_6_0: 'HCI_VERSION_BLUETOOTH_CORE_6_0',
|
|
148
150
|
}
|
|
149
151
|
|
|
150
152
|
# LMP Version
|
|
@@ -273,7 +275,7 @@ HCI_LE_CS_READ_REMOTE_SUPPORTED_CAPABILITIES_COMPLETE_EVENT = 0x2C
|
|
|
273
275
|
HCI_LE_CS_READ_REMOTE_FAE_TABLE_COMPLETE_EVENT = 0x2D
|
|
274
276
|
HCI_LE_CS_SECURITY_ENABLE_COMPLETE_EVENT = 0x2E
|
|
275
277
|
HCI_LE_CS_CONFIG_COMPLETE_EVENT = 0x2F
|
|
276
|
-
|
|
278
|
+
HCI_LE_CS_PROCEDURE_ENABLE_COMPLETE_EVENT = 0x30
|
|
277
279
|
HCI_LE_CS_SUBEVENT_RESULT_EVENT = 0x31
|
|
278
280
|
HCI_LE_CS_SUBEVENT_RESULT_CONTINUE_EVENT = 0x32
|
|
279
281
|
HCI_LE_CS_TEST_END_COMPLETE_EVENT = 0x33
|
|
@@ -597,7 +599,7 @@ HCI_LE_READ_ALL_LOCAL_SUPPORTED_FEATURES_COMMAND = hci_c
|
|
|
597
599
|
HCI_LE_READ_ALL_REMOTE_FEATURES_COMMAND = hci_command_op_code(0x08, 0x0088)
|
|
598
600
|
HCI_LE_CS_READ_LOCAL_SUPPORTED_CAPABILITIES_COMMAND = hci_command_op_code(0x08, 0x0089)
|
|
599
601
|
HCI_LE_CS_READ_REMOTE_SUPPORTED_CAPABILITIES_COMMAND = hci_command_op_code(0x08, 0x008A)
|
|
600
|
-
|
|
602
|
+
HCI_LE_CS_WRITE_CACHED_REMOTE_SUPPORTED_CAPABILITIES_COMMAND = hci_command_op_code(0x08, 0x008B)
|
|
601
603
|
HCI_LE_CS_SECURITY_ENABLE_COMMAND = hci_command_op_code(0x08, 0x008C)
|
|
602
604
|
HCI_LE_CS_SET_DEFAULT_SETTINGS_COMMAND = hci_command_op_code(0x08, 0x008D)
|
|
603
605
|
HCI_LE_CS_READ_REMOTE_FAE_TABLE_COMMAND = hci_command_op_code(0x08, 0x008E)
|
|
@@ -749,6 +751,67 @@ class PhyBit(enum.IntFlag):
|
|
|
749
751
|
LE_CODED = 1 << HCI_LE_CODED_PHY_BIT
|
|
750
752
|
|
|
751
753
|
|
|
754
|
+
class CsRole(OpenIntEnum):
|
|
755
|
+
INITIATOR = 0x00
|
|
756
|
+
REFLECTOR = 0x01
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
class CsRoleMask(enum.IntFlag):
|
|
760
|
+
INITIATOR = 0x01
|
|
761
|
+
REFLECTOR = 0x02
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
class CsSyncPhy(OpenIntEnum):
|
|
765
|
+
LE_1M = 1
|
|
766
|
+
LE_2M = 2
|
|
767
|
+
LE_2M_2BT = 3
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
class CsSyncPhySupported(enum.IntFlag):
|
|
771
|
+
LE_2M = 0x01
|
|
772
|
+
LE_2M_2BT = 0x02
|
|
773
|
+
|
|
774
|
+
|
|
775
|
+
class RttType(OpenIntEnum):
|
|
776
|
+
AA_ONLY = 0x00
|
|
777
|
+
SOUNDING_SEQUENCE_32_BIT = 0x01
|
|
778
|
+
SOUNDING_SEQUENCE_96_BIT = 0x02
|
|
779
|
+
RANDOM_SEQUENCE_32_BIT = 0x03
|
|
780
|
+
RANDOM_SEQUENCE_64_BIT = 0x04
|
|
781
|
+
RANDOM_SEQUENCE_96_BIT = 0x05
|
|
782
|
+
RANDOM_SEQUENCE_128_BIT = 0x06
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
class CsSnr(OpenIntEnum):
|
|
786
|
+
SNR_18_DB = 0x00
|
|
787
|
+
SNR_21_DB = 0x01
|
|
788
|
+
SNR_24_DB = 0x02
|
|
789
|
+
SNR_27_DB = 0x03
|
|
790
|
+
SNR_30_DB = 0x04
|
|
791
|
+
NOT_APPLIED = 0xFF
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
class CsDoneStatus(OpenIntEnum):
|
|
795
|
+
ALL_RESULTS_COMPLETED = 0x00
|
|
796
|
+
PARTIAL = 0x01
|
|
797
|
+
ABORTED = 0x0F
|
|
798
|
+
|
|
799
|
+
|
|
800
|
+
class CsProcedureAbortReason(OpenIntEnum):
|
|
801
|
+
NO_ABORT = 0x00
|
|
802
|
+
LOCAL_HOST_OR_REMOTE_REQUEST = 0x01
|
|
803
|
+
CHANNEL_MAP_UPDATE_INSTANT_PASSED = 0x02
|
|
804
|
+
UNSPECIFIED = 0x0F
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
class CsSubeventAbortReason(OpenIntEnum):
|
|
808
|
+
NO_ABORT = 0x00
|
|
809
|
+
LOCAL_HOST_OR_REMOTE_REQUEST = 0x01
|
|
810
|
+
NO_CS_SYNC_RECEIVED = 0x02
|
|
811
|
+
SCHEDULING_CONFLICT_OR_LIMITED_RESOURCES = 0x03
|
|
812
|
+
UNSPECIFIED = 0x0F
|
|
813
|
+
|
|
814
|
+
|
|
752
815
|
# Connection Parameters
|
|
753
816
|
HCI_CONNECTION_INTERVAL_MS_PER_UNIT = 1.25
|
|
754
817
|
HCI_CONNECTION_LATENCY_MS_PER_UNIT = 1.25
|
|
@@ -969,7 +1032,7 @@ HCI_SUPPORTED_COMMANDS_MASKS = {
|
|
|
969
1032
|
HCI_READ_ENCRYPTION_KEY_SIZE_COMMAND : 1 << (20*8+4),
|
|
970
1033
|
HCI_LE_CS_READ_LOCAL_SUPPORTED_CAPABILITIES_COMMAND : 1 << (20*8+5),
|
|
971
1034
|
HCI_LE_CS_READ_REMOTE_SUPPORTED_CAPABILITIES_COMMAND : 1 << (20*8+6),
|
|
972
|
-
|
|
1035
|
+
HCI_LE_CS_WRITE_CACHED_REMOTE_SUPPORTED_CAPABILITIES_COMMAND : 1 << (20*8+7),
|
|
973
1036
|
HCI_SET_EVENT_MASK_PAGE_2_COMMAND : 1 << (22*8+2),
|
|
974
1037
|
HCI_READ_FLOW_CONTROL_MODE_COMMAND : 1 << (23*8+0),
|
|
975
1038
|
HCI_WRITE_FLOW_CONTROL_MODE_COMMAND : 1 << (23*8+1),
|
|
@@ -1460,6 +1523,12 @@ class LmpFeatureMask(enum.IntFlag):
|
|
|
1460
1523
|
# -----------------------------------------------------------------------------
|
|
1461
1524
|
# pylint: disable-next=unnecessary-lambda
|
|
1462
1525
|
STATUS_SPEC = {'size': 1, 'mapper': lambda x: HCI_Constant.status_name(x)}
|
|
1526
|
+
CS_ROLE_SPEC = {'size': 1, 'mapper': lambda x: CsRole(x).name}
|
|
1527
|
+
CS_ROLE_MASK_SPEC = {'size': 1, 'mapper': lambda x: CsRoleMask(x).name}
|
|
1528
|
+
CS_SYNC_PHY_SPEC = {'size': 1, 'mapper': lambda x: CsSyncPhy(x).name}
|
|
1529
|
+
CS_SYNC_PHY_SUPPORTED_SPEC = {'size': 1, 'mapper': lambda x: CsSyncPhySupported(x).name}
|
|
1530
|
+
RTT_TYPE_SPEC = {'size': 1, 'mapper': lambda x: RttType(x).name}
|
|
1531
|
+
CS_SNR_SPEC = {'size': 1, 'mapper': lambda x: CsSnr(x).name}
|
|
1463
1532
|
|
|
1464
1533
|
|
|
1465
1534
|
class CodecID(OpenIntEnum):
|
|
@@ -3537,8 +3606,8 @@ class HCI_LE_Set_Event_Mask_Command(HCI_Command):
|
|
|
3537
3606
|
@HCI_Command.command(
|
|
3538
3607
|
return_parameters_fields=[
|
|
3539
3608
|
('status', STATUS_SPEC),
|
|
3540
|
-
('
|
|
3541
|
-
('
|
|
3609
|
+
('le_acl_data_packet_length', 2),
|
|
3610
|
+
('total_num_le_acl_data_packets', 1),
|
|
3542
3611
|
]
|
|
3543
3612
|
)
|
|
3544
3613
|
class HCI_LE_Read_Buffer_Size_Command(HCI_Command):
|
|
@@ -3547,6 +3616,22 @@ class HCI_LE_Read_Buffer_Size_Command(HCI_Command):
|
|
|
3547
3616
|
'''
|
|
3548
3617
|
|
|
3549
3618
|
|
|
3619
|
+
# -----------------------------------------------------------------------------
|
|
3620
|
+
@HCI_Command.command(
|
|
3621
|
+
return_parameters_fields=[
|
|
3622
|
+
('status', STATUS_SPEC),
|
|
3623
|
+
('le_acl_data_packet_length', 2),
|
|
3624
|
+
('total_num_le_acl_data_packets', 1),
|
|
3625
|
+
('iso_data_packet_length', 2),
|
|
3626
|
+
('total_num_iso_data_packets', 1),
|
|
3627
|
+
]
|
|
3628
|
+
)
|
|
3629
|
+
class HCI_LE_Read_Buffer_Size_V2_Command(HCI_Command):
|
|
3630
|
+
'''
|
|
3631
|
+
See Bluetooth spec @ 7.8.2 LE Read Buffer Size V2 Command
|
|
3632
|
+
'''
|
|
3633
|
+
|
|
3634
|
+
|
|
3550
3635
|
# -----------------------------------------------------------------------------
|
|
3551
3636
|
@HCI_Command.command(
|
|
3552
3637
|
return_parameters_fields=[('status', STATUS_SPEC), ('le_features', 8)]
|
|
@@ -4793,6 +4878,62 @@ class HCI_LE_Periodic_Advertising_Sync_Transfer_Command(HCI_Command):
|
|
|
4793
4878
|
'''
|
|
4794
4879
|
|
|
4795
4880
|
|
|
4881
|
+
# -----------------------------------------------------------------------------
|
|
4882
|
+
@HCI_Command.command(
|
|
4883
|
+
fields=[
|
|
4884
|
+
('connection_handle', 2),
|
|
4885
|
+
('mode', 1),
|
|
4886
|
+
('skip', 2),
|
|
4887
|
+
('sync_timeout', 2),
|
|
4888
|
+
(
|
|
4889
|
+
'cte_type',
|
|
4890
|
+
{
|
|
4891
|
+
'size': 1,
|
|
4892
|
+
'mapper': lambda x: HCI_LE_Periodic_Advertising_Report_Event.CteType(
|
|
4893
|
+
x
|
|
4894
|
+
).name,
|
|
4895
|
+
},
|
|
4896
|
+
),
|
|
4897
|
+
],
|
|
4898
|
+
return_parameters_fields=[
|
|
4899
|
+
('status', STATUS_SPEC),
|
|
4900
|
+
('connection_handle', 2),
|
|
4901
|
+
],
|
|
4902
|
+
)
|
|
4903
|
+
class HCI_LE_Set_Periodic_Advertising_Sync_Transfer_Parameters_Command(HCI_Command):
|
|
4904
|
+
'''
|
|
4905
|
+
See Bluetooth spec @ 7.8.91 LE Set Periodic Advertising Sync Transfer Parameters command
|
|
4906
|
+
'''
|
|
4907
|
+
|
|
4908
|
+
|
|
4909
|
+
# -----------------------------------------------------------------------------
|
|
4910
|
+
@HCI_Command.command(
|
|
4911
|
+
fields=[
|
|
4912
|
+
('mode', 1),
|
|
4913
|
+
('skip', 2),
|
|
4914
|
+
('sync_timeout', 2),
|
|
4915
|
+
(
|
|
4916
|
+
'cte_type',
|
|
4917
|
+
{
|
|
4918
|
+
'size': 1,
|
|
4919
|
+
'mapper': lambda x: HCI_LE_Periodic_Advertising_Report_Event.CteType(
|
|
4920
|
+
x
|
|
4921
|
+
).name,
|
|
4922
|
+
},
|
|
4923
|
+
),
|
|
4924
|
+
],
|
|
4925
|
+
return_parameters_fields=[
|
|
4926
|
+
('status', STATUS_SPEC),
|
|
4927
|
+
],
|
|
4928
|
+
)
|
|
4929
|
+
class HCI_LE_Set_Default_Periodic_Advertising_Sync_Transfer_Parameters_Command(
|
|
4930
|
+
HCI_Command
|
|
4931
|
+
):
|
|
4932
|
+
'''
|
|
4933
|
+
See Bluetooth spec @ 7.8.92 LE Set Default Periodic Advertising Sync Transfer Parameters command
|
|
4934
|
+
'''
|
|
4935
|
+
|
|
4936
|
+
|
|
4796
4937
|
# -----------------------------------------------------------------------------
|
|
4797
4938
|
@HCI_Command.command(
|
|
4798
4939
|
fields=[
|
|
@@ -4934,7 +5075,7 @@ class HCI_LE_Create_BIG_Command(HCI_Command):
|
|
|
4934
5075
|
packing: int
|
|
4935
5076
|
framing: int
|
|
4936
5077
|
encryption: int
|
|
4937
|
-
broadcast_code:
|
|
5078
|
+
broadcast_code: bytes
|
|
4938
5079
|
|
|
4939
5080
|
|
|
4940
5081
|
# -----------------------------------------------------------------------------
|
|
@@ -5057,6 +5198,275 @@ class HCI_LE_Set_Host_Feature_Command(HCI_Command):
|
|
|
5057
5198
|
'''
|
|
5058
5199
|
|
|
5059
5200
|
|
|
5201
|
+
# -----------------------------------------------------------------------------
|
|
5202
|
+
@HCI_Command.command(
|
|
5203
|
+
return_parameters_fields=[
|
|
5204
|
+
('status', STATUS_SPEC),
|
|
5205
|
+
('num_config_supported', 1),
|
|
5206
|
+
('max_consecutive_procedures_supported', 2),
|
|
5207
|
+
('num_antennas_supported', 1),
|
|
5208
|
+
('max_antenna_paths_supported', 1),
|
|
5209
|
+
('roles_supported', 1),
|
|
5210
|
+
('modes_supported', 1),
|
|
5211
|
+
('rtt_capability', 1),
|
|
5212
|
+
('rtt_aa_only_n', 1),
|
|
5213
|
+
('rtt_sounding_n', 1),
|
|
5214
|
+
('rtt_random_payload_n', 1),
|
|
5215
|
+
('nadm_sounding_capability', 2),
|
|
5216
|
+
('nadm_random_capability', 2),
|
|
5217
|
+
('cs_sync_phys_supported', CS_SYNC_PHY_SUPPORTED_SPEC),
|
|
5218
|
+
('subfeatures_supported', 2),
|
|
5219
|
+
('t_ip1_times_supported', 2),
|
|
5220
|
+
('t_ip2_times_supported', 2),
|
|
5221
|
+
('t_fcs_times_supported', 2),
|
|
5222
|
+
('t_pm_times_supported', 2),
|
|
5223
|
+
('t_sw_time_supported', 1),
|
|
5224
|
+
('tx_snr_capability', CS_SNR_SPEC),
|
|
5225
|
+
]
|
|
5226
|
+
)
|
|
5227
|
+
class HCI_LE_CS_Read_Local_Supported_Capabilities_Command(HCI_Command):
|
|
5228
|
+
'''
|
|
5229
|
+
See Bluetooth spec @ 7.8.130 LE CS Read Local Supported Capabilities command
|
|
5230
|
+
'''
|
|
5231
|
+
|
|
5232
|
+
|
|
5233
|
+
# -----------------------------------------------------------------------------
|
|
5234
|
+
@HCI_Command.command([('connection_handle', 2)])
|
|
5235
|
+
class HCI_LE_CS_Read_Remote_Supported_Capabilities_Command(HCI_Command):
|
|
5236
|
+
'''
|
|
5237
|
+
See Bluetooth spec @ 7.8.131 LE CS Read Remote Supported Capabilities command
|
|
5238
|
+
'''
|
|
5239
|
+
|
|
5240
|
+
|
|
5241
|
+
# -----------------------------------------------------------------------------
|
|
5242
|
+
@HCI_Command.command(
|
|
5243
|
+
[
|
|
5244
|
+
('connection_handle', 2),
|
|
5245
|
+
('num_config_supported', 1),
|
|
5246
|
+
('max_consecutive_procedures_supported', 2),
|
|
5247
|
+
('num_antennas_supported', 1),
|
|
5248
|
+
('max_antenna_paths_supported', 1),
|
|
5249
|
+
('roles_supported', 1),
|
|
5250
|
+
('modes_supported', 1),
|
|
5251
|
+
('rtt_capability', 1),
|
|
5252
|
+
('rtt_aa_only_n', 1),
|
|
5253
|
+
('rtt_sounding_n', 1),
|
|
5254
|
+
('rtt_random_payload_n', 1),
|
|
5255
|
+
('nadm_sounding_capability', 2),
|
|
5256
|
+
('nadm_random_capability', 2),
|
|
5257
|
+
('cs_sync_phys_supported', CS_SYNC_PHY_SUPPORTED_SPEC),
|
|
5258
|
+
('subfeatures_supported', 2),
|
|
5259
|
+
('t_ip1_times_supported', 2),
|
|
5260
|
+
('t_ip2_times_supported', 2),
|
|
5261
|
+
('t_fcs_times_supported', 2),
|
|
5262
|
+
('t_pm_times_supported', 2),
|
|
5263
|
+
('t_sw_time_supported', 1),
|
|
5264
|
+
('tx_snr_capability', CS_SNR_SPEC),
|
|
5265
|
+
],
|
|
5266
|
+
return_parameters_fields=[
|
|
5267
|
+
('status', STATUS_SPEC),
|
|
5268
|
+
('connection_handle', 2),
|
|
5269
|
+
],
|
|
5270
|
+
)
|
|
5271
|
+
class HCI_LE_CS_Write_Cached_Remote_Supported_Capabilities_Command(HCI_Command):
|
|
5272
|
+
'''
|
|
5273
|
+
See Bluetooth spec @ 7.8.132 LE CS Write Cached Remote Supported Capabilities command
|
|
5274
|
+
'''
|
|
5275
|
+
|
|
5276
|
+
|
|
5277
|
+
# -----------------------------------------------------------------------------
|
|
5278
|
+
@HCI_Command.command([('connection_handle', 2)])
|
|
5279
|
+
class HCI_LE_CS_Security_Enable_Command(HCI_Command):
|
|
5280
|
+
'''
|
|
5281
|
+
See Bluetooth spec @ 7.8.133 LE CS Security Enable command
|
|
5282
|
+
'''
|
|
5283
|
+
|
|
5284
|
+
|
|
5285
|
+
# -----------------------------------------------------------------------------
|
|
5286
|
+
@HCI_Command.command(
|
|
5287
|
+
[
|
|
5288
|
+
('connection_handle', 2),
|
|
5289
|
+
(
|
|
5290
|
+
'role_enable',
|
|
5291
|
+
CS_ROLE_MASK_SPEC,
|
|
5292
|
+
),
|
|
5293
|
+
('cs_sync_antenna_selection', 1),
|
|
5294
|
+
('max_tx_power', 1),
|
|
5295
|
+
],
|
|
5296
|
+
return_parameters_fields=[('status', STATUS_SPEC), ('connection_handle', 2)],
|
|
5297
|
+
)
|
|
5298
|
+
class HCI_LE_CS_Set_Default_Settings_Command(HCI_Command):
|
|
5299
|
+
'''
|
|
5300
|
+
See Bluetooth spec @ 7.8.134 LE CS Security Enable command
|
|
5301
|
+
'''
|
|
5302
|
+
|
|
5303
|
+
|
|
5304
|
+
# -----------------------------------------------------------------------------
|
|
5305
|
+
@HCI_Command.command([('connection_handle', 2)])
|
|
5306
|
+
class HCI_LE_CS_Read_Remote_FAE_Table_Command(HCI_Command):
|
|
5307
|
+
'''
|
|
5308
|
+
See Bluetooth spec @ 7.8.135 LE CS Read Remote FAE Table command
|
|
5309
|
+
'''
|
|
5310
|
+
|
|
5311
|
+
|
|
5312
|
+
# -----------------------------------------------------------------------------
|
|
5313
|
+
@HCI_Command.command(
|
|
5314
|
+
[
|
|
5315
|
+
('connection_handle', 2),
|
|
5316
|
+
('remote_fae_table', 72),
|
|
5317
|
+
],
|
|
5318
|
+
return_parameters_fields=[('status', STATUS_SPEC), ('connection_handle', 2)],
|
|
5319
|
+
)
|
|
5320
|
+
class HCI_LE_CS_Write_Cached_Remote_FAE_Table_Command(HCI_Command):
|
|
5321
|
+
'''
|
|
5322
|
+
See Bluetooth spec @ 7.8.136 LE CS Write Cached Remote FAE Table command
|
|
5323
|
+
'''
|
|
5324
|
+
|
|
5325
|
+
|
|
5326
|
+
# -----------------------------------------------------------------------------
|
|
5327
|
+
@HCI_Command.command(
|
|
5328
|
+
[
|
|
5329
|
+
('connection_handle', 2),
|
|
5330
|
+
('config_id', 1),
|
|
5331
|
+
('create_context', 1),
|
|
5332
|
+
('main_mode_type', 1),
|
|
5333
|
+
('sub_mode_type', 1),
|
|
5334
|
+
('min_main_mode_steps', 1),
|
|
5335
|
+
('max_main_mode_steps', 1),
|
|
5336
|
+
('main_mode_repetition', 1),
|
|
5337
|
+
('mode_0_steps', 1),
|
|
5338
|
+
('role', CS_ROLE_SPEC),
|
|
5339
|
+
('rtt_type', RTT_TYPE_SPEC),
|
|
5340
|
+
('cs_sync_phy', CS_SYNC_PHY_SPEC),
|
|
5341
|
+
('channel_map', 10),
|
|
5342
|
+
('channel_map_repetition', 1),
|
|
5343
|
+
('channel_selection_type', 1),
|
|
5344
|
+
('ch3c_shape', 1),
|
|
5345
|
+
('ch3c_jump', 1),
|
|
5346
|
+
('reserved', 1),
|
|
5347
|
+
],
|
|
5348
|
+
)
|
|
5349
|
+
class HCI_LE_CS_Create_Config_Command(HCI_Command):
|
|
5350
|
+
'''
|
|
5351
|
+
See Bluetooth spec @ 7.8.137 LE CS Create Config command
|
|
5352
|
+
'''
|
|
5353
|
+
|
|
5354
|
+
class ChannelSelectionType(OpenIntEnum):
|
|
5355
|
+
ALGO_3B = 0
|
|
5356
|
+
ALGO_3C = 1
|
|
5357
|
+
|
|
5358
|
+
class Ch3cShape(OpenIntEnum):
|
|
5359
|
+
HAT = 0x00
|
|
5360
|
+
X = 0x01
|
|
5361
|
+
|
|
5362
|
+
|
|
5363
|
+
# -----------------------------------------------------------------------------
|
|
5364
|
+
@HCI_Command.command(
|
|
5365
|
+
[
|
|
5366
|
+
('connection_handle', 2),
|
|
5367
|
+
('config_id', 1),
|
|
5368
|
+
],
|
|
5369
|
+
)
|
|
5370
|
+
class HCI_LE_CS_Remove_Config_Command(HCI_Command):
|
|
5371
|
+
'''
|
|
5372
|
+
See Bluetooth spec @ 7.8.138 LE CS Remove Config command
|
|
5373
|
+
'''
|
|
5374
|
+
|
|
5375
|
+
|
|
5376
|
+
# -----------------------------------------------------------------------------
|
|
5377
|
+
@HCI_Command.command(
|
|
5378
|
+
[('channel_classification', 10)], return_parameters_fields=[('status', STATUS_SPEC)]
|
|
5379
|
+
)
|
|
5380
|
+
class HCI_LE_CS_Set_Channel_Classification_Command(HCI_Command):
|
|
5381
|
+
'''
|
|
5382
|
+
See Bluetooth spec @ 7.8.139 LE CS Set Channel Classification command
|
|
5383
|
+
'''
|
|
5384
|
+
|
|
5385
|
+
|
|
5386
|
+
# -----------------------------------------------------------------------------
|
|
5387
|
+
@HCI_Command.command(
|
|
5388
|
+
[
|
|
5389
|
+
('connection_handle', 2),
|
|
5390
|
+
('config_id', 1),
|
|
5391
|
+
('max_procedure_len', 2),
|
|
5392
|
+
('min_procedure_interval', 2),
|
|
5393
|
+
('max_procedure_interval', 2),
|
|
5394
|
+
('max_procedure_count', 2),
|
|
5395
|
+
('min_subevent_len', 3),
|
|
5396
|
+
('max_subevent_len', 3),
|
|
5397
|
+
('tone_antenna_config_selection', 1),
|
|
5398
|
+
('phy', 1),
|
|
5399
|
+
('tx_power_delta', 1),
|
|
5400
|
+
('preferred_peer_antenna', 1),
|
|
5401
|
+
('snr_control_initiator', CS_SNR_SPEC),
|
|
5402
|
+
('snr_control_reflector', CS_SNR_SPEC),
|
|
5403
|
+
],
|
|
5404
|
+
return_parameters_fields=[('status', STATUS_SPEC), ('connection_handle', 2)],
|
|
5405
|
+
)
|
|
5406
|
+
class HCI_LE_CS_Set_Procedure_Parameters_Command(HCI_Command):
|
|
5407
|
+
'''
|
|
5408
|
+
See Bluetooth spec @ 7.8.140 LE CS Set Procedure Parameters command
|
|
5409
|
+
'''
|
|
5410
|
+
|
|
5411
|
+
|
|
5412
|
+
# -----------------------------------------------------------------------------
|
|
5413
|
+
@HCI_Command.command(
|
|
5414
|
+
[
|
|
5415
|
+
('connection_handle', 2),
|
|
5416
|
+
('config_id', 1),
|
|
5417
|
+
('enable', 1),
|
|
5418
|
+
],
|
|
5419
|
+
)
|
|
5420
|
+
class HCI_LE_CS_Procedure_Enable_Command(HCI_Command):
|
|
5421
|
+
'''
|
|
5422
|
+
See Bluetooth spec @ 7.8.141 LE CS Procedure Enable command
|
|
5423
|
+
'''
|
|
5424
|
+
|
|
5425
|
+
|
|
5426
|
+
# -----------------------------------------------------------------------------
|
|
5427
|
+
@HCI_Command.command(
|
|
5428
|
+
[
|
|
5429
|
+
('main_mode_type', 1),
|
|
5430
|
+
('sub_mode_type', 1),
|
|
5431
|
+
('main_mode_repetition', 1),
|
|
5432
|
+
('mode_0_steps', 1),
|
|
5433
|
+
('role', CS_ROLE_SPEC),
|
|
5434
|
+
('rtt_type', RTT_TYPE_SPEC),
|
|
5435
|
+
('cs_sync_phy', CS_SYNC_PHY_SPEC),
|
|
5436
|
+
('cs_sync_antenna_selection', 1),
|
|
5437
|
+
('subevent_len', 3),
|
|
5438
|
+
('subevent_interval', 2),
|
|
5439
|
+
('max_num_subevents', 1),
|
|
5440
|
+
('transmit_power_level', 1),
|
|
5441
|
+
('t_ip1_time', 1),
|
|
5442
|
+
('t_ip2_time', 1),
|
|
5443
|
+
('t_fcs_time', 1),
|
|
5444
|
+
('t_pm_time', 1),
|
|
5445
|
+
('t_sw_time', 1),
|
|
5446
|
+
('tone_antenna_config_selection', 1),
|
|
5447
|
+
('reserved', 1),
|
|
5448
|
+
('snr_control_initiator', CS_SNR_SPEC),
|
|
5449
|
+
('snr_control_reflector', CS_SNR_SPEC),
|
|
5450
|
+
('drbg_nonce', 2),
|
|
5451
|
+
('channel_map_repetition', 1),
|
|
5452
|
+
('override_config', 2),
|
|
5453
|
+
('override_parameters_data', 'v'),
|
|
5454
|
+
],
|
|
5455
|
+
)
|
|
5456
|
+
class HCI_LE_CS_Test_Command(HCI_Command):
|
|
5457
|
+
'''
|
|
5458
|
+
See Bluetooth spec @ 7.8.142 LE CS Test command
|
|
5459
|
+
'''
|
|
5460
|
+
|
|
5461
|
+
|
|
5462
|
+
# -----------------------------------------------------------------------------
|
|
5463
|
+
@HCI_Command.command()
|
|
5464
|
+
class HCI_LE_CS_Test_End_Command(HCI_Command):
|
|
5465
|
+
'''
|
|
5466
|
+
See Bluetooth spec @ 7.8.143 LE CS Test End command
|
|
5467
|
+
'''
|
|
5468
|
+
|
|
5469
|
+
|
|
5060
5470
|
# -----------------------------------------------------------------------------
|
|
5061
5471
|
# HCI Events
|
|
5062
5472
|
# -----------------------------------------------------------------------------
|
|
@@ -5068,6 +5478,7 @@ class HCI_Event(HCI_Packet):
|
|
|
5068
5478
|
hci_packet_type = HCI_EVENT_PACKET
|
|
5069
5479
|
event_names: Dict[int, str] = {}
|
|
5070
5480
|
event_classes: Dict[int, Type[HCI_Event]] = {}
|
|
5481
|
+
vendor_factories: list[Callable[[bytes], Optional[HCI_Event]]] = []
|
|
5071
5482
|
|
|
5072
5483
|
@staticmethod
|
|
5073
5484
|
def event(fields=()):
|
|
@@ -5125,37 +5536,54 @@ class HCI_Event(HCI_Packet):
|
|
|
5125
5536
|
|
|
5126
5537
|
return event_class
|
|
5127
5538
|
|
|
5128
|
-
@
|
|
5129
|
-
def
|
|
5539
|
+
@classmethod
|
|
5540
|
+
def add_vendor_factory(
|
|
5541
|
+
cls, factory: Callable[[bytes], Optional[HCI_Event]]
|
|
5542
|
+
) -> None:
|
|
5543
|
+
cls.vendor_factories.append(factory)
|
|
5544
|
+
|
|
5545
|
+
@classmethod
|
|
5546
|
+
def remove_vendor_factory(
|
|
5547
|
+
cls, factory: Callable[[bytes], Optional[HCI_Event]]
|
|
5548
|
+
) -> None:
|
|
5549
|
+
if factory in cls.vendor_factories:
|
|
5550
|
+
cls.vendor_factories.remove(factory)
|
|
5551
|
+
|
|
5552
|
+
@classmethod
|
|
5553
|
+
def from_bytes(cls, packet: bytes) -> HCI_Event:
|
|
5130
5554
|
event_code = packet[1]
|
|
5131
5555
|
length = packet[2]
|
|
5132
5556
|
parameters = packet[3:]
|
|
5133
5557
|
if len(parameters) != length:
|
|
5134
5558
|
raise InvalidPacketError('invalid packet length')
|
|
5135
5559
|
|
|
5136
|
-
|
|
5560
|
+
subclass: Any
|
|
5137
5561
|
if event_code == HCI_LE_META_EVENT:
|
|
5138
5562
|
# We do this dispatch here and not in the subclass in order to avoid call
|
|
5139
5563
|
# loops
|
|
5140
5564
|
subevent_code = parameters[0]
|
|
5141
|
-
|
|
5142
|
-
if
|
|
5565
|
+
subclass = HCI_LE_Meta_Event.subevent_classes.get(subevent_code)
|
|
5566
|
+
if subclass is None:
|
|
5143
5567
|
# No class registered, just use a generic class instance
|
|
5144
5568
|
return HCI_LE_Meta_Event(subevent_code, parameters)
|
|
5145
5569
|
elif event_code == HCI_VENDOR_EVENT:
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5570
|
+
# Invoke all the registered factories to see if any of them can handle
|
|
5571
|
+
# the event
|
|
5572
|
+
for vendor_factory in cls.vendor_factories:
|
|
5573
|
+
if event := vendor_factory(parameters):
|
|
5574
|
+
return event
|
|
5575
|
+
|
|
5576
|
+
# No factory, or the factory could not create an instance,
|
|
5577
|
+
# return a generic vendor event
|
|
5578
|
+
return HCI_Vendor_Event(data=parameters)
|
|
5151
5579
|
else:
|
|
5152
|
-
|
|
5153
|
-
if
|
|
5580
|
+
subclass = HCI_Event.event_classes.get(event_code)
|
|
5581
|
+
if subclass is None:
|
|
5154
5582
|
# No class registered, just use a generic class instance
|
|
5155
5583
|
return HCI_Event(event_code, parameters)
|
|
5156
5584
|
|
|
5157
5585
|
# Invoke the factory to create a new instance
|
|
5158
|
-
return
|
|
5586
|
+
return subclass.from_parameters(parameters) # type: ignore
|
|
5159
5587
|
|
|
5160
5588
|
@classmethod
|
|
5161
5589
|
def from_parameters(cls, parameters):
|
|
@@ -5198,11 +5626,11 @@ HCI_Event.register_events(globals())
|
|
|
5198
5626
|
# -----------------------------------------------------------------------------
|
|
5199
5627
|
class HCI_Extended_Event(HCI_Event):
|
|
5200
5628
|
'''
|
|
5201
|
-
HCI_Event subclass for events that
|
|
5629
|
+
HCI_Event subclass for events that have a subevent code.
|
|
5202
5630
|
'''
|
|
5203
5631
|
|
|
5204
5632
|
subevent_names: Dict[int, str] = {}
|
|
5205
|
-
subevent_classes: Dict[int, Type[HCI_Extended_Event]]
|
|
5633
|
+
subevent_classes: Dict[int, Type[HCI_Extended_Event]] = {}
|
|
5206
5634
|
|
|
5207
5635
|
@classmethod
|
|
5208
5636
|
def event(cls, fields=()):
|
|
@@ -5253,7 +5681,22 @@ class HCI_Extended_Event(HCI_Event):
|
|
|
5253
5681
|
cls.subevent_names.update(cls.subevent_map(symbols))
|
|
5254
5682
|
|
|
5255
5683
|
@classmethod
|
|
5256
|
-
def
|
|
5684
|
+
def subclass_from_parameters(
|
|
5685
|
+
cls, parameters: bytes
|
|
5686
|
+
) -> Optional[HCI_Extended_Event]:
|
|
5687
|
+
"""
|
|
5688
|
+
Factory method that parses the subevent code, finds a registered subclass,
|
|
5689
|
+
and creates an instance if found.
|
|
5690
|
+
"""
|
|
5691
|
+
subevent_code = parameters[0]
|
|
5692
|
+
if subclass := cls.subevent_classes.get(subevent_code):
|
|
5693
|
+
return subclass.from_parameters(parameters)
|
|
5694
|
+
|
|
5695
|
+
return None
|
|
5696
|
+
|
|
5697
|
+
@classmethod
|
|
5698
|
+
def from_parameters(cls, parameters: bytes) -> HCI_Extended_Event:
|
|
5699
|
+
"""Factory method for subclasses (the subevent code has already been parsed)"""
|
|
5257
5700
|
self = cls.__new__(cls)
|
|
5258
5701
|
HCI_Extended_Event.__init__(self, self.subevent_code, parameters)
|
|
5259
5702
|
if fields := getattr(self, 'fields', None):
|
|
@@ -5294,12 +5737,6 @@ class HCI_LE_Meta_Event(HCI_Extended_Event):
|
|
|
5294
5737
|
HCI_LE_Meta_Event.register_subevents(globals())
|
|
5295
5738
|
|
|
5296
5739
|
|
|
5297
|
-
# -----------------------------------------------------------------------------
|
|
5298
|
-
class HCI_Vendor_Event(HCI_Extended_Event):
|
|
5299
|
-
event_code: int = HCI_VENDOR_EVENT
|
|
5300
|
-
subevent_classes = {}
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
5740
|
# -----------------------------------------------------------------------------
|
|
5304
5741
|
@HCI_LE_Meta_Event.event(
|
|
5305
5742
|
[
|
|
@@ -5809,7 +6246,7 @@ class HCI_LE_Periodic_Advertising_Sync_Lost_Event(HCI_LE_Meta_Event):
|
|
|
5809
6246
|
# -----------------------------------------------------------------------------
|
|
5810
6247
|
@HCI_LE_Meta_Event.event(
|
|
5811
6248
|
[
|
|
5812
|
-
('status',
|
|
6249
|
+
('status', STATUS_SPEC),
|
|
5813
6250
|
('advertising_handle', 1),
|
|
5814
6251
|
('connection_handle', 2),
|
|
5815
6252
|
('num_completed_extended_advertising_events', 1),
|
|
@@ -5850,6 +6287,31 @@ class HCI_LE_Periodic_Advertising_Sync_Transfer_Received_Event(HCI_LE_Meta_Event
|
|
|
5850
6287
|
'''
|
|
5851
6288
|
|
|
5852
6289
|
|
|
6290
|
+
# -----------------------------------------------------------------------------
|
|
6291
|
+
@HCI_LE_Meta_Event.event(
|
|
6292
|
+
[
|
|
6293
|
+
('status', STATUS_SPEC),
|
|
6294
|
+
('connection_handle', 2),
|
|
6295
|
+
('service_data', 2),
|
|
6296
|
+
('sync_handle', 2),
|
|
6297
|
+
('advertising_sid', 1),
|
|
6298
|
+
('advertiser_address_type', Address.ADDRESS_TYPE_SPEC),
|
|
6299
|
+
('advertiser_address', Address.parse_address_preceded_by_type),
|
|
6300
|
+
('advertiser_phy', 1),
|
|
6301
|
+
('periodic_advertising_interval', 2),
|
|
6302
|
+
('advertiser_clock_accuracy', 1),
|
|
6303
|
+
('num_subevents', 1),
|
|
6304
|
+
('subevent_interval', 1),
|
|
6305
|
+
('response_slot_delay', 1),
|
|
6306
|
+
('response_slot_spacing', 1),
|
|
6307
|
+
]
|
|
6308
|
+
)
|
|
6309
|
+
class HCI_LE_Periodic_Advertising_Sync_Transfer_Received_V2_Event(HCI_LE_Meta_Event):
|
|
6310
|
+
'''
|
|
6311
|
+
See Bluetooth spec @ 7.7.65.24 LE Periodic Advertising Sync Transfer Received Event
|
|
6312
|
+
'''
|
|
6313
|
+
|
|
6314
|
+
|
|
5853
6315
|
# -----------------------------------------------------------------------------
|
|
5854
6316
|
@HCI_LE_Meta_Event.event(
|
|
5855
6317
|
[
|
|
@@ -5892,6 +6354,70 @@ class HCI_LE_CIS_Request_Event(HCI_LE_Meta_Event):
|
|
|
5892
6354
|
'''
|
|
5893
6355
|
|
|
5894
6356
|
|
|
6357
|
+
# -----------------------------------------------------------------------------
|
|
6358
|
+
@HCI_LE_Meta_Event.event(
|
|
6359
|
+
[
|
|
6360
|
+
('status', STATUS_SPEC),
|
|
6361
|
+
('big_handle', 1),
|
|
6362
|
+
('big_sync_delay', 3),
|
|
6363
|
+
('transport_latency_big', 3),
|
|
6364
|
+
('phy', 1),
|
|
6365
|
+
('nse', 1),
|
|
6366
|
+
('bn', 1),
|
|
6367
|
+
('pto', 1),
|
|
6368
|
+
('irc', 1),
|
|
6369
|
+
('max_pdu', 2),
|
|
6370
|
+
('iso_interval', 2),
|
|
6371
|
+
[('connection_handle', 2)],
|
|
6372
|
+
]
|
|
6373
|
+
)
|
|
6374
|
+
class HCI_LE_Create_BIG_Complete_Event(HCI_LE_Meta_Event):
|
|
6375
|
+
'''
|
|
6376
|
+
See Bluetooth spec @ 7.7.65.27 LE Create BIG Complete Event
|
|
6377
|
+
'''
|
|
6378
|
+
|
|
6379
|
+
|
|
6380
|
+
# -----------------------------------------------------------------------------
|
|
6381
|
+
@HCI_LE_Meta_Event.event([('big_handle', 1), ('reason', 1)])
|
|
6382
|
+
class HCI_LE_Terminate_BIG_Complete_Event(HCI_LE_Meta_Event):
|
|
6383
|
+
'''
|
|
6384
|
+
See Bluetooth spec @ 7.7.65.28 LE Terminate BIG Complete Event
|
|
6385
|
+
'''
|
|
6386
|
+
|
|
6387
|
+
|
|
6388
|
+
# -----------------------------------------------------------------------------
|
|
6389
|
+
|
|
6390
|
+
|
|
6391
|
+
@HCI_LE_Meta_Event.event(
|
|
6392
|
+
[
|
|
6393
|
+
('status', STATUS_SPEC),
|
|
6394
|
+
('big_handle', 1),
|
|
6395
|
+
('transport_latency_big', 3),
|
|
6396
|
+
('nse', 1),
|
|
6397
|
+
('bn', 1),
|
|
6398
|
+
('pto', 1),
|
|
6399
|
+
('irc', 1),
|
|
6400
|
+
('max_pdu', 2),
|
|
6401
|
+
('iso_interval', 2),
|
|
6402
|
+
[('connection_handle', 2)],
|
|
6403
|
+
]
|
|
6404
|
+
)
|
|
6405
|
+
class HCI_LE_BIG_Sync_Established_Event(HCI_LE_Meta_Event):
|
|
6406
|
+
'''
|
|
6407
|
+
See Bluetooth spec @ 7.7.65.29 LE BIG Sync Established event
|
|
6408
|
+
'''
|
|
6409
|
+
|
|
6410
|
+
|
|
6411
|
+
# -----------------------------------------------------------------------------
|
|
6412
|
+
|
|
6413
|
+
|
|
6414
|
+
@HCI_LE_Meta_Event.event([('big_handle', 1), ('reason', 1)])
|
|
6415
|
+
class HCI_LE_BIG_Sync_Lost_Event(HCI_LE_Meta_Event):
|
|
6416
|
+
'''
|
|
6417
|
+
See Bluetooth spec @ 7.7.65.30 LE BIG Sync Lost event
|
|
6418
|
+
'''
|
|
6419
|
+
|
|
6420
|
+
|
|
5895
6421
|
# -----------------------------------------------------------------------------
|
|
5896
6422
|
@HCI_LE_Meta_Event.event(
|
|
5897
6423
|
[
|
|
@@ -5916,6 +6442,291 @@ class HCI_LE_BIGInfo_Advertising_Report_Event(HCI_LE_Meta_Event):
|
|
|
5916
6442
|
'''
|
|
5917
6443
|
|
|
5918
6444
|
|
|
6445
|
+
# -----------------------------------------------------------------------------
|
|
6446
|
+
@HCI_LE_Meta_Event.event(
|
|
6447
|
+
[
|
|
6448
|
+
('status', STATUS_SPEC),
|
|
6449
|
+
('connection_handle', 2),
|
|
6450
|
+
('num_config_supported', 1),
|
|
6451
|
+
('max_consecutive_procedures_supported', 2),
|
|
6452
|
+
('num_antennas_supported', 1),
|
|
6453
|
+
('max_antenna_paths_supported', 1),
|
|
6454
|
+
('roles_supported', 1),
|
|
6455
|
+
('modes_supported', 1),
|
|
6456
|
+
('rtt_capability', 1),
|
|
6457
|
+
('rtt_aa_only_n', 1),
|
|
6458
|
+
('rtt_sounding_n', 1),
|
|
6459
|
+
('rtt_random_payload_n', 1),
|
|
6460
|
+
('nadm_sounding_capability', 2),
|
|
6461
|
+
('nadm_random_capability', 2),
|
|
6462
|
+
('cs_sync_phys_supported', CS_SYNC_PHY_SUPPORTED_SPEC),
|
|
6463
|
+
('subfeatures_supported', 2),
|
|
6464
|
+
('t_ip1_times_supported', 2),
|
|
6465
|
+
('t_ip2_times_supported', 2),
|
|
6466
|
+
('t_fcs_times_supported', 2),
|
|
6467
|
+
('t_pm_times_supported', 2),
|
|
6468
|
+
('t_sw_time_supported', 1),
|
|
6469
|
+
('tx_snr_capability', CS_SNR_SPEC),
|
|
6470
|
+
]
|
|
6471
|
+
)
|
|
6472
|
+
class HCI_LE_CS_Read_Remote_Supported_Capabilities_Complete_Event(HCI_LE_Meta_Event):
|
|
6473
|
+
'''
|
|
6474
|
+
See Bluetooth spec @ 7.7.65.39 LE CS Read Remote Supported Capabilities Complete event
|
|
6475
|
+
'''
|
|
6476
|
+
|
|
6477
|
+
status: int
|
|
6478
|
+
connection_handle: int
|
|
6479
|
+
num_config_supported: int
|
|
6480
|
+
max_consecutive_procedures_supported: int
|
|
6481
|
+
num_antennas_supported: int
|
|
6482
|
+
max_antenna_paths_supported: int
|
|
6483
|
+
roles_supported: int
|
|
6484
|
+
modes_supported: int
|
|
6485
|
+
rtt_capability: int
|
|
6486
|
+
rtt_aa_only_n: int
|
|
6487
|
+
rtt_sounding_n: int
|
|
6488
|
+
rtt_random_payload_n: int
|
|
6489
|
+
nadm_sounding_capability: int
|
|
6490
|
+
nadm_random_capability: int
|
|
6491
|
+
cs_sync_phys_supported: int
|
|
6492
|
+
subfeatures_supported: int
|
|
6493
|
+
t_ip1_times_supported: int
|
|
6494
|
+
t_ip2_times_supported: int
|
|
6495
|
+
t_fcs_times_supported: int
|
|
6496
|
+
t_pm_times_supported: int
|
|
6497
|
+
t_sw_time_supported: int
|
|
6498
|
+
tx_snr_capability: int
|
|
6499
|
+
|
|
6500
|
+
|
|
6501
|
+
# -----------------------------------------------------------------------------
|
|
6502
|
+
@HCI_LE_Meta_Event.event(
|
|
6503
|
+
[
|
|
6504
|
+
('status', STATUS_SPEC),
|
|
6505
|
+
('connection_handle', 2),
|
|
6506
|
+
('remote_fae_table', 72),
|
|
6507
|
+
]
|
|
6508
|
+
)
|
|
6509
|
+
class HCI_LE_CS_Read_Remote_FAE_Table_Complete_Event(HCI_LE_Meta_Event):
|
|
6510
|
+
'''
|
|
6511
|
+
See Bluetooth spec @ 7.7.65.40 LE CS Read Remote FAE Table Complete event
|
|
6512
|
+
'''
|
|
6513
|
+
|
|
6514
|
+
status: int
|
|
6515
|
+
connection_handle: int
|
|
6516
|
+
remote_fae_table: bytes
|
|
6517
|
+
|
|
6518
|
+
|
|
6519
|
+
# -----------------------------------------------------------------------------
|
|
6520
|
+
@HCI_LE_Meta_Event.event(
|
|
6521
|
+
[
|
|
6522
|
+
('status', STATUS_SPEC),
|
|
6523
|
+
('connection_handle', 2),
|
|
6524
|
+
]
|
|
6525
|
+
)
|
|
6526
|
+
class HCI_LE_CS_Security_Enable_Complete_Event(HCI_LE_Meta_Event):
|
|
6527
|
+
'''
|
|
6528
|
+
See Bluetooth spec @ 7.7.65.41 LE CS Security Enable Complete event
|
|
6529
|
+
'''
|
|
6530
|
+
|
|
6531
|
+
status: int
|
|
6532
|
+
connection_handle: int
|
|
6533
|
+
|
|
6534
|
+
|
|
6535
|
+
# -----------------------------------------------------------------------------
|
|
6536
|
+
@HCI_LE_Meta_Event.event(
|
|
6537
|
+
[
|
|
6538
|
+
('status', STATUS_SPEC),
|
|
6539
|
+
('connection_handle', 2),
|
|
6540
|
+
('config_id', 1),
|
|
6541
|
+
(
|
|
6542
|
+
'action',
|
|
6543
|
+
{
|
|
6544
|
+
'size': 1,
|
|
6545
|
+
'mapper': lambda x: HCI_LE_CS_Config_Complete_Event.Action(x).name,
|
|
6546
|
+
},
|
|
6547
|
+
),
|
|
6548
|
+
('main_mode_type', 1),
|
|
6549
|
+
('sub_mode_type', 1),
|
|
6550
|
+
('min_main_mode_steps', 1),
|
|
6551
|
+
('max_main_mode_steps', 1),
|
|
6552
|
+
('main_mode_repetition', 1),
|
|
6553
|
+
('mode_0_steps', 1),
|
|
6554
|
+
('role', CS_ROLE_SPEC),
|
|
6555
|
+
('rtt_type', RTT_TYPE_SPEC),
|
|
6556
|
+
('cs_sync_phy', CS_SYNC_PHY_SPEC),
|
|
6557
|
+
('channel_map', 10),
|
|
6558
|
+
('channel_map_repetition', 1),
|
|
6559
|
+
('channel_selection_type', 1),
|
|
6560
|
+
('ch3c_shape', 1),
|
|
6561
|
+
('ch3c_jump', 1),
|
|
6562
|
+
('reserved', 1),
|
|
6563
|
+
('t_ip1_time', 1),
|
|
6564
|
+
('t_ip2_time', 1),
|
|
6565
|
+
('t_fcs_time', 1),
|
|
6566
|
+
('t_pm_time', 1),
|
|
6567
|
+
]
|
|
6568
|
+
)
|
|
6569
|
+
class HCI_LE_CS_Config_Complete_Event(HCI_LE_Meta_Event):
|
|
6570
|
+
'''
|
|
6571
|
+
See Bluetooth spec @ 7.7.65.42 LE CS Config Complete event
|
|
6572
|
+
'''
|
|
6573
|
+
|
|
6574
|
+
class Action(OpenIntEnum):
|
|
6575
|
+
REMOVED = 0
|
|
6576
|
+
CREATED = 1
|
|
6577
|
+
|
|
6578
|
+
status: int
|
|
6579
|
+
connection_handle: int
|
|
6580
|
+
config_id: int
|
|
6581
|
+
action: int
|
|
6582
|
+
main_mode_type: int
|
|
6583
|
+
sub_mode_type: int
|
|
6584
|
+
min_main_mode_steps: int
|
|
6585
|
+
max_main_mode_steps: int
|
|
6586
|
+
main_mode_repetition: int
|
|
6587
|
+
mode_0_steps: int
|
|
6588
|
+
role: int
|
|
6589
|
+
rtt_type: int
|
|
6590
|
+
cs_sync_phy: int
|
|
6591
|
+
channel_map: bytes
|
|
6592
|
+
channel_map_repetition: int
|
|
6593
|
+
channel_selection_type: int
|
|
6594
|
+
ch3c_shape: int
|
|
6595
|
+
ch3c_jump: int
|
|
6596
|
+
reserved: int
|
|
6597
|
+
t_ip1_time: int
|
|
6598
|
+
t_ip2_time: int
|
|
6599
|
+
t_fcs_time: int
|
|
6600
|
+
t_pm_time: int
|
|
6601
|
+
|
|
6602
|
+
|
|
6603
|
+
# -----------------------------------------------------------------------------
|
|
6604
|
+
@HCI_LE_Meta_Event.event(
|
|
6605
|
+
[
|
|
6606
|
+
('status', STATUS_SPEC),
|
|
6607
|
+
('connection_handle', 2),
|
|
6608
|
+
('config_id', 1),
|
|
6609
|
+
('state', 1),
|
|
6610
|
+
('tone_antenna_config_selection', 1),
|
|
6611
|
+
('selected_tx_power', -1),
|
|
6612
|
+
('subevent_len', 3),
|
|
6613
|
+
('subevents_per_event', 1),
|
|
6614
|
+
('subevent_interval', 2),
|
|
6615
|
+
('event_interval', 2),
|
|
6616
|
+
('procedure_interval', 2),
|
|
6617
|
+
('procedure_count', 2),
|
|
6618
|
+
('max_procedure_len', 2),
|
|
6619
|
+
]
|
|
6620
|
+
)
|
|
6621
|
+
class HCI_LE_CS_Procedure_Enable_Complete_Event(HCI_LE_Meta_Event):
|
|
6622
|
+
'''
|
|
6623
|
+
See Bluetooth spec @ 7.7.65.43 LE CS Procedure Enable Complete event
|
|
6624
|
+
'''
|
|
6625
|
+
|
|
6626
|
+
class State(OpenIntEnum):
|
|
6627
|
+
DISABLED = 0
|
|
6628
|
+
ENABLED = 1
|
|
6629
|
+
|
|
6630
|
+
status: int
|
|
6631
|
+
connection_handle: int
|
|
6632
|
+
config_id: int
|
|
6633
|
+
state: int
|
|
6634
|
+
tone_antenna_config_selection: int
|
|
6635
|
+
selected_tx_power: int
|
|
6636
|
+
subevent_len: int
|
|
6637
|
+
subevents_per_event: int
|
|
6638
|
+
subevent_interval: int
|
|
6639
|
+
event_interval: int
|
|
6640
|
+
procedure_interval: int
|
|
6641
|
+
procedure_count: int
|
|
6642
|
+
max_procedure_len: int
|
|
6643
|
+
|
|
6644
|
+
|
|
6645
|
+
# -----------------------------------------------------------------------------
|
|
6646
|
+
@HCI_LE_Meta_Event.event(
|
|
6647
|
+
[
|
|
6648
|
+
('connection_handle', 2),
|
|
6649
|
+
('config_id', 1),
|
|
6650
|
+
('start_acl_conn_event_counter', 2),
|
|
6651
|
+
('procedure_counter', 2),
|
|
6652
|
+
('frequency_compensation', 2),
|
|
6653
|
+
('reference_power_level', -1),
|
|
6654
|
+
('procedure_done_status', 1),
|
|
6655
|
+
('subevent_done_status', 1),
|
|
6656
|
+
('abort_reason', 1),
|
|
6657
|
+
('num_antenna_paths', 1),
|
|
6658
|
+
[
|
|
6659
|
+
('step_mode', 1),
|
|
6660
|
+
('step_channel', 1),
|
|
6661
|
+
('step_data', 'v'),
|
|
6662
|
+
],
|
|
6663
|
+
]
|
|
6664
|
+
)
|
|
6665
|
+
class HCI_LE_CS_Subevent_Result_Event(HCI_LE_Meta_Event):
|
|
6666
|
+
'''
|
|
6667
|
+
See Bluetooth spec @ 7.7.65.44 LE CS Subevent Result event
|
|
6668
|
+
'''
|
|
6669
|
+
|
|
6670
|
+
connection_handle: int
|
|
6671
|
+
config_id: int
|
|
6672
|
+
start_acl_conn_event_counter: int
|
|
6673
|
+
procedure_counter: int
|
|
6674
|
+
frequency_compensation: int
|
|
6675
|
+
reference_power_level: int
|
|
6676
|
+
procedure_done_status: int
|
|
6677
|
+
subevent_done_status: int
|
|
6678
|
+
abort_reason: int
|
|
6679
|
+
num_antenna_paths: int
|
|
6680
|
+
step_mode: list[int]
|
|
6681
|
+
step_channel: list[int]
|
|
6682
|
+
step_data: list[bytes]
|
|
6683
|
+
|
|
6684
|
+
|
|
6685
|
+
# -----------------------------------------------------------------------------
|
|
6686
|
+
@HCI_LE_Meta_Event.event(
|
|
6687
|
+
[
|
|
6688
|
+
('connection_handle', 2),
|
|
6689
|
+
('config_id', 1),
|
|
6690
|
+
('procedure_done_status', 1),
|
|
6691
|
+
('subevent_done_status', 1),
|
|
6692
|
+
('abort_reason', 1),
|
|
6693
|
+
('num_antenna_paths', 1),
|
|
6694
|
+
[
|
|
6695
|
+
('step_mode', 1),
|
|
6696
|
+
('step_channel', 1),
|
|
6697
|
+
('step_data', 'v'),
|
|
6698
|
+
],
|
|
6699
|
+
]
|
|
6700
|
+
)
|
|
6701
|
+
class HCI_LE_CS_Subevent_Result_Continue_Event(HCI_LE_Meta_Event):
|
|
6702
|
+
'''
|
|
6703
|
+
See Bluetooth spec @ 7.7.65.45 LE CS Subevent Result Continue event
|
|
6704
|
+
'''
|
|
6705
|
+
|
|
6706
|
+
connection_handle: int
|
|
6707
|
+
config_id: int
|
|
6708
|
+
procedure_done_status: int
|
|
6709
|
+
subevent_done_status: int
|
|
6710
|
+
abort_reason: int
|
|
6711
|
+
num_antenna_paths: int
|
|
6712
|
+
step_mode: list[int]
|
|
6713
|
+
step_channel: list[int]
|
|
6714
|
+
step_data: list[bytes]
|
|
6715
|
+
|
|
6716
|
+
|
|
6717
|
+
# -----------------------------------------------------------------------------
|
|
6718
|
+
@HCI_LE_Meta_Event.event(
|
|
6719
|
+
[
|
|
6720
|
+
('connection_handle', 2),
|
|
6721
|
+
('status', STATUS_SPEC),
|
|
6722
|
+
]
|
|
6723
|
+
)
|
|
6724
|
+
class HCI_LE_CS_Test_End_Complete_Event(HCI_LE_Meta_Event):
|
|
6725
|
+
'''
|
|
6726
|
+
See Bluetooth spec @ 7.7.65.46 LE CS Test End Complete event
|
|
6727
|
+
'''
|
|
6728
|
+
|
|
6729
|
+
|
|
5919
6730
|
# -----------------------------------------------------------------------------
|
|
5920
6731
|
@HCI_Event.event([('status', STATUS_SPEC)])
|
|
5921
6732
|
class HCI_Inquiry_Complete_Event(HCI_Event):
|
|
@@ -6173,8 +6984,9 @@ class HCI_Command_Complete_Event(HCI_Event):
|
|
|
6173
6984
|
See Bluetooth spec @ 7.7.14 Command Complete Event
|
|
6174
6985
|
'''
|
|
6175
6986
|
|
|
6176
|
-
|
|
6987
|
+
num_hci_command_packets: int
|
|
6177
6988
|
command_opcode: int
|
|
6989
|
+
return_parameters = b''
|
|
6178
6990
|
|
|
6179
6991
|
def map_return_parameters(self, return_parameters):
|
|
6180
6992
|
'''Map simple 'status' return parameters to their named constant form'''
|
|
@@ -6710,6 +7522,14 @@ class HCI_Remote_Host_Supported_Features_Notification_Event(HCI_Event):
|
|
|
6710
7522
|
'''
|
|
6711
7523
|
|
|
6712
7524
|
|
|
7525
|
+
# -----------------------------------------------------------------------------
|
|
7526
|
+
@HCI_Event.event([('data', "*")])
|
|
7527
|
+
class HCI_Vendor_Event(HCI_Event):
|
|
7528
|
+
'''
|
|
7529
|
+
See Bluetooth spec @ 5.4.4 HCI Event packet
|
|
7530
|
+
'''
|
|
7531
|
+
|
|
7532
|
+
|
|
6713
7533
|
# -----------------------------------------------------------------------------
|
|
6714
7534
|
class HCI_AclDataPacket(HCI_Packet):
|
|
6715
7535
|
'''
|
|
@@ -6853,7 +7673,7 @@ class HCI_IsoDataPacket(HCI_Packet):
|
|
|
6853
7673
|
if should_include_sdu_info:
|
|
6854
7674
|
packet_sequence_number, sdu_info = struct.unpack_from('<HH', packet, pos)
|
|
6855
7675
|
iso_sdu_length = sdu_info & 0xFFF
|
|
6856
|
-
packet_status_flag = sdu_info >>
|
|
7676
|
+
packet_status_flag = (sdu_info >> 15) & 1
|
|
6857
7677
|
pos += 4
|
|
6858
7678
|
|
|
6859
7679
|
iso_sdu_fragment = packet[pos:]
|
|
@@ -6887,7 +7707,7 @@ class HCI_IsoDataPacket(HCI_Packet):
|
|
|
6887
7707
|
fmt += 'HH'
|
|
6888
7708
|
args += [
|
|
6889
7709
|
self.packet_sequence_number,
|
|
6890
|
-
self.iso_sdu_length | self.packet_status_flag <<
|
|
7710
|
+
self.iso_sdu_length | self.packet_status_flag << 15,
|
|
6891
7711
|
]
|
|
6892
7712
|
return struct.pack(fmt, *args) + self.iso_sdu_fragment
|
|
6893
7713
|
|
|
@@ -6895,9 +7715,10 @@ class HCI_IsoDataPacket(HCI_Packet):
|
|
|
6895
7715
|
return (
|
|
6896
7716
|
f'{color("ISO", "blue")}: '
|
|
6897
7717
|
f'handle=0x{self.connection_handle:04x}, '
|
|
7718
|
+
f'pb={self.pb_flag}, '
|
|
6898
7719
|
f'ps={self.packet_status_flag}, '
|
|
6899
7720
|
f'data_total_length={self.data_total_length}, '
|
|
6900
|
-
f'
|
|
7721
|
+
f'sdu_fragment={self.iso_sdu_fragment.hex()}'
|
|
6901
7722
|
)
|
|
6902
7723
|
|
|
6903
7724
|
|