@@ -753,6 +753,58 @@ static uint8_t sdp_hfp_ag_user(struct bt_conn *conn, struct bt_sdp_client_result
753
753
return BT_SDP_DISCOVER_UUID_CONTINUE ;
754
754
}
755
755
756
+ static uint8_t sdp_hfp_hf_user (struct bt_conn * conn ,
757
+ struct bt_sdp_client_result * result ,
758
+ const struct bt_sdp_discover_params * params )
759
+ {
760
+ char addr [BT_ADDR_STR_LEN ];
761
+ uint16_t param , version ;
762
+ uint16_t features ;
763
+ int err ;
764
+
765
+ conn_addr_str (conn , addr , sizeof (addr ));
766
+
767
+ if (result && result -> resp_buf ) {
768
+ bt_shell_print ("SDP HFPHF data@%p (len %u) hint %u from remote %s" ,
769
+ result -> resp_buf , result -> resp_buf -> len , result -> next_record_hint ,
770
+ addr );
771
+
772
+ /*
773
+ * Focus to get BT_SDP_ATTR_PROTO_DESC_LIST attribute item to
774
+ * get HFPHF Server Channel Number operating on RFCOMM protocol.
775
+ */
776
+ err = bt_sdp_get_proto_param (result -> resp_buf , BT_SDP_PROTO_RFCOMM , & param );
777
+ if (err < 0 ) {
778
+ bt_shell_error ("Error getting Server CN, err %d" , err );
779
+ goto done ;
780
+ }
781
+ bt_shell_print ("HFPHF Server CN param 0x%04x" , param );
782
+
783
+ err = bt_sdp_get_profile_version (result -> resp_buf , BT_SDP_HANDSFREE_SVCLASS ,
784
+ & version );
785
+ if (err < 0 ) {
786
+ bt_shell_error ("Error getting profile version, err %d" , err );
787
+ goto done ;
788
+ }
789
+ bt_shell_print ("HFP version param 0x%04x" , version );
790
+
791
+ /*
792
+ * Focus to get BT_SDP_ATTR_SUPPORTED_FEATURES attribute item to
793
+ * get profile Supported Features mask.
794
+ */
795
+ err = bt_sdp_get_features (result -> resp_buf , & features );
796
+ if (err < 0 ) {
797
+ bt_shell_error ("Error getting HFPHF Features, err %d" , err );
798
+ goto done ;
799
+ }
800
+ bt_shell_print ("HFPHF Supported Features param 0x%04x" , features );
801
+ } else {
802
+ bt_shell_print ("No SDP HFPHF data from remote %s" , addr );
803
+ }
804
+ done :
805
+ return BT_SDP_DISCOVER_UUID_CONTINUE ;
806
+ }
807
+
756
808
static uint8_t sdp_a2src_user (struct bt_conn * conn , struct bt_sdp_client_result * result ,
757
809
const struct bt_sdp_discover_params * params )
758
810
{
@@ -816,6 +868,13 @@ static struct bt_sdp_discover_params discov_hfpag = {
816
868
.pool = & sdp_client_pool ,
817
869
};
818
870
871
+ static struct bt_sdp_discover_params discov_hfphf = {
872
+ .type = BT_SDP_DISCOVER_SERVICE_SEARCH_ATTR ,
873
+ .uuid = BT_UUID_DECLARE_16 (BT_SDP_HANDSFREE_SVCLASS ),
874
+ .func = sdp_hfp_hf_user ,
875
+ .pool = & sdp_client_pool ,
876
+ };
877
+
819
878
static struct bt_sdp_discover_params discov_a2src = {
820
879
.type = BT_SDP_DISCOVER_SERVICE_SEARCH_ATTR ,
821
880
.uuid = BT_UUID_DECLARE_16 (BT_SDP_AUDIO_SOURCE_SVCLASS ),
@@ -839,6 +898,8 @@ static int cmd_sdp_find_record(const struct shell *sh, size_t argc, char *argv[]
839
898
840
899
if (!strcmp (action , "HFPAG" )) {
841
900
discov = discov_hfpag ;
901
+ } else if (!strcmp (action , "HFPHF" )) {
902
+ discov = discov_hfphf ;
842
903
} else if (!strcmp (action , "A2SRC" )) {
843
904
discov = discov_a2src ;
844
905
} else {
@@ -963,7 +1024,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(br_cmds,
963
1024
SHELL_CMD (l2cap , & l2cap_cmds , HELP_NONE , cmd_default_handler ),
964
1025
SHELL_CMD_ARG (oob , NULL , NULL , cmd_oob , 1 , 0 ),
965
1026
SHELL_CMD_ARG (pscan , NULL , "<value: on, off>" , cmd_connectable , 2 , 0 ),
966
- SHELL_CMD_ARG (sdp - find , NULL , "<HFPAG>" , cmd_sdp_find_record , 2 , 0 ),
1027
+ SHELL_CMD_ARG (sdp - find , NULL , "<HFPAG, HFPHF >" , cmd_sdp_find_record , 2 , 0 ),
967
1028
SHELL_SUBCMD_SET_END
968
1029
);
969
1030
0 commit comments