@@ -809,6 +809,21 @@ static int get_number(struct net_buf *buf, uint32_t *number)
809
809
return err ;
810
810
}
811
811
812
+ static int get_char (struct net_buf * buf , char * c )
813
+ {
814
+ int err = - EINVAL ;
815
+
816
+ skip_space (buf );
817
+ if (buf -> len > 0 ) {
818
+ * c = (char )buf -> data [0 ];
819
+ (void )net_buf_pull (buf , 1 );
820
+ err = 0 ;
821
+ }
822
+ skip_space (buf );
823
+
824
+ return err ;
825
+ }
826
+
812
827
static bool is_char (struct net_buf * buf , uint8_t c )
813
828
{
814
829
bool found = false;
@@ -2994,6 +3009,43 @@ static int bt_hfp_ag_binp_handler(struct bt_hfp_ag *ag, struct net_buf *buf)
2994
3009
return - ENOTSUP ;
2995
3010
}
2996
3011
3012
+ static int bt_hfp_ag_vts_handler (struct bt_hfp_ag * ag , struct net_buf * buf )
3013
+ {
3014
+ int err ;
3015
+ char code ;
3016
+
3017
+ if (!is_char (buf , '=' )) {
3018
+ return - ENOTSUP ;
3019
+ }
3020
+
3021
+ err = get_char (buf , & code );
3022
+ if (err != 0 ) {
3023
+ return - ENOTSUP ;
3024
+ }
3025
+
3026
+ if (!is_char (buf , '\r' )) {
3027
+ return - ENOTSUP ;
3028
+ }
3029
+
3030
+ if (!IS_VALID_DTMF (code )) {
3031
+ LOG_ERR ("Invalid code" );
3032
+ return - EINVAL ;
3033
+ }
3034
+
3035
+ if (!get_active_calls (ag )) {
3036
+ LOG_ERR ("Not valid ongoing call" );
3037
+ return - ENOTSUP ;
3038
+ }
3039
+
3040
+ if (bt_ag && bt_ag -> transmit_dtmf_code ) {
3041
+ bt_ag -> transmit_dtmf_code (ag , code );
3042
+ } else {
3043
+ return - ENOTSUP ;
3044
+ }
3045
+
3046
+ return 0 ;
3047
+ }
3048
+
2997
3049
static struct bt_hfp_ag_at_cmd_handler cmd_handlers [] = {
2998
3050
{"AT+BRSF" , bt_hfp_ag_brsf_handler }, {"AT+BAC" , bt_hfp_ag_bac_handler },
2999
3051
{"AT+CIND" , bt_hfp_ag_cind_handler }, {"AT+CMER" , bt_hfp_ag_cmer_handler },
@@ -3007,6 +3059,7 @@ static struct bt_hfp_ag_at_cmd_handler cmd_handlers[] = {
3007
3059
{"AT+VGS" , bt_hfp_ag_vgs_handler }, {"AT+NREC" , bt_hfp_ag_nrec_handler },
3008
3060
{"AT+BTRH" , bt_hfp_ag_btrh_handler }, {"AT+CCWA" , bt_hfp_ag_ccwa_handler },
3009
3061
{"AT+BVRA" , bt_hfp_ag_bvra_handler }, {"AT+BINP" , bt_hfp_ag_binp_handler },
3062
+ {"AT+VTS" , bt_hfp_ag_vts_handler },
3010
3063
};
3011
3064
3012
3065
static void hfp_ag_connected (struct bt_rfcomm_dlc * dlc )
0 commit comments