hfp.c (94a27792279a0f8d9dcb16416be8a05c5b9cc58d) hfp.c (84a0c24e57c984ba7cea3b26dff16a1b638a9262)
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 848 unchanged lines hidden (view full) ---

857 { "ATA", HFP_CMD_CALL_ANSWERED },
858};
859
860static hfp_command_entry_t hfp_hf_commmand_table[] = {
861 { "+BIND:", HFP_CMD_SET_GENERIC_STATUS_INDICATOR_STATUS },
862 { "+BTRH:", HFP_CMD_RESPONSE_AND_HOLD_STATUS },
863 { "+CHLD:", HFP_CMD_SUPPORT_CALL_HOLD_AND_MULTIPARTY_SERVICES },
864 { "+COPS:", HFP_CMD_QUERY_OPERATOR_SELECTION_NAME },
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 848 unchanged lines hidden (view full) ---

857 { "ATA", HFP_CMD_CALL_ANSWERED },
858};
859
860static hfp_command_entry_t hfp_hf_commmand_table[] = {
861 { "+BIND:", HFP_CMD_SET_GENERIC_STATUS_INDICATOR_STATUS },
862 { "+BTRH:", HFP_CMD_RESPONSE_AND_HOLD_STATUS },
863 { "+CHLD:", HFP_CMD_SUPPORT_CALL_HOLD_AND_MULTIPARTY_SERVICES },
864 { "+COPS:", HFP_CMD_QUERY_OPERATOR_SELECTION_NAME },
865 { "+CIND:", HFP_CMD_RETRIEVE_AG_INDICATORS_GENERIC },
865};
866
867typedef struct {
868 const char * command;
869 hfp_command_t hf_command_id;
870 hfp_command_t ag_command_id;
871} hfp_command_table_t;
872

--- 174 unchanged lines hidden (view full) ---

1047 }
1048
1049 // ignore empty tokens
1050 if (hfp_parser_is_buffer_empty(hfp_connection)) return true;
1051
1052 // parse
1053 hfp_connection->command = parse_command((char *)hfp_connection->line_buffer, isHandsFree);
1054
866};
867
868typedef struct {
869 const char * command;
870 hfp_command_t hf_command_id;
871 hfp_command_t ag_command_id;
872} hfp_command_table_t;
873

--- 174 unchanged lines hidden (view full) ---

1048 }
1049
1050 // ignore empty tokens
1051 if (hfp_parser_is_buffer_empty(hfp_connection)) return true;
1052
1053 // parse
1054 hfp_connection->command = parse_command((char *)hfp_connection->line_buffer, isHandsFree);
1055
1055 // resolve command name according to hfp_connection
1056 if (hfp_connection->command == HFP_CMD_UNKNOWN){
1056 // pick +CIND version based on connection state: descriptions during SLC vs. states later
1057 if (hfp_connection->command == HFP_CMD_RETRIEVE_AG_INDICATORS_GENERIC){
1057 switch(hfp_connection->state){
1058 switch(hfp_connection->state){
1058 case HFP_W4_LIST_GENERIC_STATUS_INDICATORS:
1059 hfp_connection->command = HFP_CMD_LIST_GENERIC_STATUS_INDICATORS;
1060 break;
1061 case HFP_W4_RETRIEVE_GENERIC_STATUS_INDICATORS:
1062 hfp_connection->command = HFP_CMD_RETRIEVE_GENERIC_STATUS_INDICATORS;
1063 break;
1064 case HFP_W4_RETRIEVE_INITITAL_STATE_GENERIC_STATUS_INDICATORS:
1065 hfp_connection->command = HFP_CMD_RETRIEVE_GENERIC_STATUS_INDICATORS_STATE;
1066 break;
1067 case HFP_W4_RETRIEVE_INDICATORS_STATUS:
1068 hfp_connection->command = HFP_CMD_RETRIEVE_AG_INDICATORS_STATUS;
1069 break;
1070 case HFP_W4_RETRIEVE_INDICATORS:
1059 case HFP_W4_RETRIEVE_INDICATORS_STATUS:
1060 hfp_connection->command = HFP_CMD_RETRIEVE_AG_INDICATORS_STATUS;
1061 break;
1062 case HFP_W4_RETRIEVE_INDICATORS:
1071 hfp_connection->send_ag_indicators_segment = 0;
1072 hfp_connection->command = HFP_CMD_RETRIEVE_AG_INDICATORS;
1073 break;
1074 default:
1063 hfp_connection->command = HFP_CMD_RETRIEVE_AG_INDICATORS;
1064 break;
1065 default:
1066 btstack_assert(false);
1067 hfp_connection->command = HFP_CMD_UNKNOWN;
1075 break;
1076 }
1077 }
1078
1079 log_info("command string '%s', handsfree %u -> cmd id %u", (char *)hfp_connection->line_buffer, isHandsFree, hfp_connection->command);
1080
1081 // next state
1082 hfp_connection->found_equal_sign = false;

--- 511 unchanged lines hidden ---
1068 break;
1069 }
1070 }
1071
1072 log_info("command string '%s', handsfree %u -> cmd id %u", (char *)hfp_connection->line_buffer, isHandsFree, hfp_connection->command);
1073
1074 // next state
1075 hfp_connection->found_equal_sign = false;

--- 511 unchanged lines hidden ---