@@ -542,6 +542,73 @@ async def sdp_ssa_discover_multiple_records(hci_port, shell, dut, address) -> No
542
542
assert found is True
543
543
544
544
545
+ async def sdp_ssa_discover_multiple_records_with_range (hci_port , shell , dut , address ) -> None :
546
+ logger .info ('<<< SDP Discovery ...' )
547
+ async with await open_transport_or_link (hci_port ) as hci_transport :
548
+ device = Device .with_hci (
549
+ 'Bumble' ,
550
+ Address ('F0:F1:F2:F3:F4:F5' ),
551
+ hci_transport .source ,
552
+ hci_transport .sink ,
553
+ )
554
+ device .classic_enabled = True
555
+ device .le_enabled = False
556
+ device .sdp_service_records = SDP_SERVICE_MULTIPLE_RECORDS
557
+ with open (f"bumble_hci_{ sys ._getframe ().f_code .co_name } .log" , "wb" ) as snoop_file :
558
+ device .host .snooper = BtSnooper (snoop_file )
559
+ await device_power_on (device )
560
+ await device .send_command (HCI_Write_Page_Timeout_Command (page_timeout = 0xFFFF ))
561
+
562
+ target_address = address .split (" " )[0 ]
563
+ logger .info (f'=== Connecting to { target_address } ...' )
564
+ try :
565
+ connection = await device .connect (target_address , transport = BT_BR_EDR_TRANSPORT )
566
+ logger .info (f'=== Connected to { connection .peer_address } !' )
567
+ except Exception as e :
568
+ logger .error (f'Fail to connect to { target_address } !' )
569
+ raise e
570
+
571
+ # Discover SDP Record with range SDP_SERVICE_RECORD_HANDLE_ATTRIBUTE_ID ~
572
+ # SDP_PROTOCOL_DESCRIPTOR_LIST_ATTRIBUTE_ID
573
+ shell .exec_command (
574
+ f"sdp_client ssa_discovery { BT_L2CAP_PROTOCOL_ID .to_hex_str ()} "
575
+ f"{ SDP_SERVICE_RECORD_HANDLE_ATTRIBUTE_ID } "
576
+ f"{ SDP_PROTOCOL_DESCRIPTOR_LIST_ATTRIBUTE_ID } "
577
+ )
578
+ found , lines = await wait_for_shell_response (dut , "SDP Discovery Done" )
579
+ logger .info (f'{ lines } ' )
580
+ assert found is True
581
+
582
+ # Discover SDP Record with range SDP_SUPPORTED_FEATURES_ATTRIBUTE_ID ~
583
+ # SDP_SUPPORTED_FEATURES_ATTRIBUTE_ID
584
+ shell .exec_command (
585
+ f"sdp_client ssa_discovery { BT_L2CAP_PROTOCOL_ID .to_hex_str ()} "
586
+ f"{ SDP_SUPPORTED_FEATURES_ATTRIBUTE_ID } "
587
+ f"{ SDP_SUPPORTED_FEATURES_ATTRIBUTE_ID } "
588
+ )
589
+ found , lines = await wait_for_shell_response (dut , "SDP Discovery Done" )
590
+ logger .info (f'{ lines } ' )
591
+ assert found is True
592
+
593
+ # Discover SDP Record with range SDP_PROTOCOL_DESCRIPTOR_LIST_ATTRIBUTE_ID ~
594
+ # 0xffff
595
+ shell .exec_command (
596
+ f"sdp_client ssa_discovery { BT_L2CAP_PROTOCOL_ID .to_hex_str ()} "
597
+ f"{ SDP_PROTOCOL_DESCRIPTOR_LIST_ATTRIBUTE_ID } 0xffff"
598
+ )
599
+ found , lines = await wait_for_shell_response (dut , "SDP Discovery Done" )
600
+ logger .info (f'{ lines } ' )
601
+ assert found is True
602
+
603
+ # Discover SDP Record with range 0xff00 ~ 0xffff
604
+ shell .exec_command (
605
+ f"sdp_client ssa_discovery { BT_L2CAP_PROTOCOL_ID .to_hex_str ()} 0xff00 0xffff"
606
+ )
607
+ found , lines = await wait_for_shell_response (dut , "No SDP Record" )
608
+ logger .info (f'{ lines } ' )
609
+ assert found is True
610
+
611
+
545
612
async def sdp_ss_discover_no_record (hci_port , shell , dut , address ) -> None :
546
613
logger .info ('<<< SDP Discovery ...' )
547
614
async with await open_transport_or_link (hci_port ) as hci_transport :
@@ -889,6 +956,69 @@ async def sdp_sa_discover_multiple_records(hci_port, shell, dut, address) -> Non
889
956
assert found is True
890
957
891
958
959
+ async def sdp_sa_discover_multiple_records_with_range (hci_port , shell , dut , address ) -> None :
960
+ logger .info ('<<< SDP Discovery ...' )
961
+ async with await open_transport_or_link (hci_port ) as hci_transport :
962
+ device = Device .with_hci (
963
+ 'Bumble' ,
964
+ Address ('F0:F1:F2:F3:F4:F5' ),
965
+ hci_transport .source ,
966
+ hci_transport .sink ,
967
+ )
968
+ device .classic_enabled = True
969
+ device .le_enabled = False
970
+ device .sdp_service_records = SDP_SERVICE_MULTIPLE_RECORDS
971
+ with open (f"bumble_hci_{ sys ._getframe ().f_code .co_name } .log" , "wb" ) as snoop_file :
972
+ device .host .snooper = BtSnooper (snoop_file )
973
+ await device_power_on (device )
974
+ await device .send_command (HCI_Write_Page_Timeout_Command (page_timeout = 0xFFFF ))
975
+
976
+ target_address = address .split (" " )[0 ]
977
+ logger .info (f'=== Connecting to { target_address } ...' )
978
+ try :
979
+ connection = await device .connect (target_address , transport = BT_BR_EDR_TRANSPORT )
980
+ logger .info (f'=== Connected to { connection .peer_address } !' )
981
+ except Exception as e :
982
+ logger .error (f'Fail to connect to { target_address } !' )
983
+ raise e
984
+
985
+ # Discover SDP Record with range SDP_SERVICE_RECORD_HANDLE_ATTRIBUTE_ID ~
986
+ # SDP_PROTOCOL_DESCRIPTOR_LIST_ATTRIBUTE_ID
987
+ shell .exec_command (
988
+ f"sdp_client sa_discovery 00010003 { SDP_SERVICE_RECORD_HANDLE_ATTRIBUTE_ID } "
989
+ f"{ SDP_PROTOCOL_DESCRIPTOR_LIST_ATTRIBUTE_ID } "
990
+ )
991
+ found , lines = await wait_for_shell_response (dut , "SDP Discovery Done" )
992
+ logger .info (f'{ lines } ' )
993
+ assert found is True
994
+
995
+ # Discover SDP Record with range SDP_SUPPORTED_FEATURES_ATTRIBUTE_ID ~
996
+ # SDP_SUPPORTED_FEATURES_ATTRIBUTE_ID
997
+ shell .exec_command (
998
+ f"sdp_client sa_discovery 00010003 { SDP_SUPPORTED_FEATURES_ATTRIBUTE_ID } "
999
+ f"{ SDP_SUPPORTED_FEATURES_ATTRIBUTE_ID } "
1000
+ )
1001
+ found , lines = await wait_for_shell_response (dut , "SDP Discovery Done" )
1002
+ logger .info (f'{ lines } ' )
1003
+ assert found is True
1004
+
1005
+ # Discover SDP Record with range SDP_PROTOCOL_DESCRIPTOR_LIST_ATTRIBUTE_ID ~
1006
+ # 0xffff
1007
+ shell .exec_command (
1008
+ "sdp_client sa_discovery 00010003 "
1009
+ f"{ SDP_PROTOCOL_DESCRIPTOR_LIST_ATTRIBUTE_ID } 0xffff"
1010
+ )
1011
+ found , lines = await wait_for_shell_response (dut , "SDP Discovery Done" )
1012
+ logger .info (f'{ lines } ' )
1013
+ assert found is True
1014
+
1015
+ # Discover SDP Record with range 0xff00 ~ 0xffff
1016
+ shell .exec_command ("sdp_client sa_discovery 00010003 0xff00 0xffff" )
1017
+ found , lines = await wait_for_shell_response (dut , "No SDP Record" )
1018
+ logger .info (f'{ lines } ' )
1019
+ assert found is True
1020
+
1021
+
892
1022
async def sdp_ssa_discover_fail (hci_port , shell , dut , address ) -> None :
893
1023
def on_app_connection_request (self , request ) -> None :
894
1024
logger .info ('Force L2CAP connection failure' )
@@ -969,6 +1099,14 @@ def test_sdp_ssa_discover_multiple_records(
969
1099
hci , iut_address = sdp_client_dut
970
1100
asyncio .run (sdp_ssa_discover_multiple_records (hci , shell , dut , iut_address ))
971
1101
1102
+ def test_sdp_ssa_discover_multiple_records_with_range (
1103
+ self , shell : Shell , dut : DeviceAdapter , sdp_client_dut
1104
+ ):
1105
+ """Test case to request SDP records with range. Multiple SDP record registered."""
1106
+ logger .info (f'test_sdp_ssa_discover_multiple_records_with_range { sdp_client_dut } ' )
1107
+ hci , iut_address = sdp_client_dut
1108
+ asyncio .run (sdp_ssa_discover_multiple_records_with_range (hci , shell , dut , iut_address ))
1109
+
972
1110
def test_sdp_ss_discover_no_record (self , shell : Shell , dut : DeviceAdapter , sdp_client_dut ):
973
1111
"""Test case to request SDP records. No SDP record registered."""
974
1112
logger .info (f'test_sdp_ss_discover_no_record { sdp_client_dut } ' )
@@ -1021,6 +1159,14 @@ def test_sdp_sa_discover_multiple_records(
1021
1159
hci , iut_address = sdp_client_dut
1022
1160
asyncio .run (sdp_sa_discover_multiple_records (hci , shell , dut , iut_address ))
1023
1161
1162
+ def test_sdp_sa_discover_multiple_records_with_range (
1163
+ self , shell : Shell , dut : DeviceAdapter , sdp_client_dut
1164
+ ):
1165
+ """Test case to request SDP records with range. Multiple SDP record registered."""
1166
+ logger .info (f'test_sdp_sa_discover_multiple_records_with_range { sdp_client_dut } ' )
1167
+ hci , iut_address = sdp_client_dut
1168
+ asyncio .run (sdp_sa_discover_multiple_records_with_range (hci , shell , dut , iut_address ))
1169
+
1024
1170
def test_sdp_ssa_discover_fail (self , shell : Shell , dut : DeviceAdapter , sdp_client_dut ):
1025
1171
"""Test case to request SDP records. but the L2CAP connecting fail."""
1026
1172
logger .info (f'test_sdp_ssa_discover_fail { sdp_client_dut } ' )
0 commit comments