hfp_hf.c (7ca89cabe01ec06969a60ca277f5f47c7557fd57) hfp_hf.c (5a4785c8a775b671ee244733be5374581e398aec)
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

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

1087 hfp_connection->command = HFP_CMD_NONE;
1088 hfp_hf_emit_type_and_number(hfp_hf_callback, HFP_SUBEVENT_CALL_WAITING_NOTIFICATION, hfp_connection->bnip_type, hfp_connection->bnip_number);
1089 break;
1090 case HFP_CMD_AG_SENT_CLIP_INFORMATION:
1091 hfp_connection->command = HFP_CMD_NONE;
1092 hfp_hf_emit_type_and_number(hfp_hf_callback, HFP_SUBEVENT_CALLING_LINE_IDENTIFICATION_NOTIFICATION, hfp_connection->bnip_type, hfp_connection->bnip_number);
1093 break;
1094 case HFP_CMD_EXTENDED_AUDIO_GATEWAY_ERROR:
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

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

1087 hfp_connection->command = HFP_CMD_NONE;
1088 hfp_hf_emit_type_and_number(hfp_hf_callback, HFP_SUBEVENT_CALL_WAITING_NOTIFICATION, hfp_connection->bnip_type, hfp_connection->bnip_number);
1089 break;
1090 case HFP_CMD_AG_SENT_CLIP_INFORMATION:
1091 hfp_connection->command = HFP_CMD_NONE;
1092 hfp_hf_emit_type_and_number(hfp_hf_callback, HFP_SUBEVENT_CALLING_LINE_IDENTIFICATION_NOTIFICATION, hfp_connection->bnip_type, hfp_connection->bnip_number);
1093 break;
1094 case HFP_CMD_EXTENDED_AUDIO_GATEWAY_ERROR:
1095 hfp_connection->ok_pending = 0;
1096 hfp_connection->command = HFP_CMD_NONE;
1095 hfp_connection->command = HFP_CMD_NONE;
1096 hfp_connection->ok_pending = 0;
1097 hfp_connection->extended_audio_gateway_error = 0;
1098 hfp_emit_event(hfp_connection, HFP_SUBEVENT_EXTENDED_AUDIO_GATEWAY_ERROR, hfp_connection->extended_audio_gateway_error_value);
1099 break;
1100 case HFP_CMD_ERROR:
1097 hfp_connection->extended_audio_gateway_error = 0;
1098 hfp_emit_event(hfp_connection, HFP_SUBEVENT_EXTENDED_AUDIO_GATEWAY_ERROR, hfp_connection->extended_audio_gateway_error_value);
1099 break;
1100 case HFP_CMD_ERROR:
1101 hfp_connection->command = HFP_CMD_NONE;
1101 hfp_connection->ok_pending = 0;
1102 hfp_reset_context_flags(hfp_connection);
1102 hfp_connection->ok_pending = 0;
1103 hfp_reset_context_flags(hfp_connection);
1103 hfp_connection->command = HFP_CMD_NONE;
1104
1105 switch (hfp_connection->state){
1106 case HFP_SERVICE_LEVEL_CONNECTION_ESTABLISHED:
1107 switch (hfp_connection->codecs_state){
1108 case HFP_CODECS_RECEIVED_TRIGGER_CODEC_EXCHANGE:
1109 hfp_emit_sco_event(hfp_connection, HFP_REMOTE_REJECTS_AUDIO_CONNECTION, 0, hfp_connection->remote_addr, hfp_connection->negotiated_codec);
1110 return;
1111 default:
1112 break;
1113 }
1114 default:
1115 break;
1116 }
1117 hfp_emit_event(hfp_connection, HFP_SUBEVENT_COMPLETE, 1);
1118 break;
1119 case HFP_CMD_OK:
1120 hfp_hf_switch_on_ok(hfp_connection);
1121 break;
1122 case HFP_CMD_RING:
1104 switch (hfp_connection->state){
1105 case HFP_SERVICE_LEVEL_CONNECTION_ESTABLISHED:
1106 switch (hfp_connection->codecs_state){
1107 case HFP_CODECS_RECEIVED_TRIGGER_CODEC_EXCHANGE:
1108 hfp_emit_sco_event(hfp_connection, HFP_REMOTE_REJECTS_AUDIO_CONNECTION, 0, hfp_connection->remote_addr, hfp_connection->negotiated_codec);
1109 return;
1110 default:
1111 break;
1112 }
1113 default:
1114 break;
1115 }
1116 hfp_emit_event(hfp_connection, HFP_SUBEVENT_COMPLETE, 1);
1117 break;
1118 case HFP_CMD_OK:
1119 hfp_hf_switch_on_ok(hfp_connection);
1120 break;
1121 case HFP_CMD_RING:
1122 hfp_connection->command = HFP_CMD_NONE;
1123 hfp_emit_simple_event(hfp_connection, HFP_SUBEVENT_RING);
1124 break;
1125 case HFP_CMD_TRANSFER_AG_INDICATOR_STATUS:
1123 hfp_emit_simple_event(hfp_connection, HFP_SUBEVENT_RING);
1124 break;
1125 case HFP_CMD_TRANSFER_AG_INDICATOR_STATUS:
1126 hfp_connection->command = HFP_CMD_NONE;
1126 hfp_hf_handle_transfer_ag_indicator_status(hfp_connection);
1127 break;
1128 case HFP_CMD_RETRIEVE_AG_INDICATORS_STATUS:
1127 hfp_hf_handle_transfer_ag_indicator_status(hfp_connection);
1128 break;
1129 case HFP_CMD_RETRIEVE_AG_INDICATORS_STATUS:
1130 hfp_connection->command = HFP_CMD_NONE;
1129 for (i = 0; i < hfp_connection->ag_indicators_nr; i++){
1130 hfp_emit_ag_indicator_event(hfp_hf_callback, hfp_connection->ag_indicators[i]);
1131 }
1131 for (i = 0; i < hfp_connection->ag_indicators_nr; i++){
1132 hfp_emit_ag_indicator_event(hfp_hf_callback, hfp_connection->ag_indicators[i]);
1133 }
1132 hfp_connection->command = HFP_CMD_NONE;
1133 break;
1134 case HFP_CMD_AG_SUGGESTED_CODEC:
1134 break;
1135 case HFP_CMD_AG_SUGGESTED_CODEC:
1136 hfp_connection->command = HFP_CMD_NONE;
1135 hfp_hf_handle_suggested_codec(hfp_connection);
1137 hfp_hf_handle_suggested_codec(hfp_connection);
1136 hfp_connection->command = HFP_CMD_NONE;
1137 break;
1138 default:
1139 break;
1140 }
1141}
1142
1143static int hfp_parser_is_end_of_line(uint8_t byte){
1144 return (byte == '\n') || (byte == '\r');

--- 694 unchanged lines hidden ---
1138 break;
1139 default:
1140 break;
1141 }
1142}
1143
1144static int hfp_parser_is_end_of_line(uint8_t byte){
1145 return (byte == '\n') || (byte == '\r');

--- 694 unchanged lines hidden ---