hfp_hf.c (b3e7b9f5efc39a568e9c3227b2a1de70741860d0) hfp_hf.c (51a2ebde0031fdd3ad6bb64362108b25da7cb703)
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

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

1044 } else {
1045 log_info("Not sending HF indicator %u as it is disabled", hfp_hf_indicators[i]);
1046 }
1047 return;
1048 }
1049 }
1050 }
1051
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

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

1044 } else {
1045 log_info("Not sending HF indicator %u as it is disabled", hfp_hf_indicators[i]);
1046 }
1047 return;
1048 }
1049 }
1050 }
1051
1052 if (hfp_connection->send_custom_message != NULL){
1053 const char * message = hfp_connection->send_custom_message;
1054 hfp_connection->send_custom_message = NULL;
1055 hfp_connection->ok_pending = 1;
1056 hfp_connection->response_pending_for_command = HFP_CMD_CUSTOM_MESSAGE;
1057 send_str_over_rfcomm(hfp_connection->rfcomm_cid, message);
1058 return;
1059 }
1060
1052 if (done) return;
1053 // deal with disconnect
1054 switch (hfp_connection->state){
1055 case HFP_W2_DISCONNECT_RFCOMM:
1056 hfp_connection->state = HFP_W4_RFCOMM_DISCONNECTED;
1057 rfcomm_disconnect(hfp_connection->rfcomm_cid);
1058 break;
1059

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

1119 hfp_connection->response_pending_for_command = HFP_CMD_NONE;
1120 hfp_connection->command = HFP_CMD_NONE;
1121 hfp_connection->ok_pending = 0;
1122
1123 switch (response_pending_for_command){
1124 case HFP_CMD_TURN_OFF_EC_AND_NR:
1125 hfp_emit_event(hfp_connection, HFP_SUBEVENT_ECHO_CANCELING_AND_NOISE_REDUCTION_DEACTIVATE, status);
1126 break;
1061 if (done) return;
1062 // deal with disconnect
1063 switch (hfp_connection->state){
1064 case HFP_W2_DISCONNECT_RFCOMM:
1065 hfp_connection->state = HFP_W4_RFCOMM_DISCONNECTED;
1066 rfcomm_disconnect(hfp_connection->rfcomm_cid);
1067 break;
1068

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

1128 hfp_connection->response_pending_for_command = HFP_CMD_NONE;
1129 hfp_connection->command = HFP_CMD_NONE;
1130 hfp_connection->ok_pending = 0;
1131
1132 switch (response_pending_for_command){
1133 case HFP_CMD_TURN_OFF_EC_AND_NR:
1134 hfp_emit_event(hfp_connection, HFP_SUBEVENT_ECHO_CANCELING_AND_NOISE_REDUCTION_DEACTIVATE, status);
1135 break;
1136 case HFP_CMD_CUSTOM_MESSAGE:
1137 hfp_emit_event(hfp_connection, HFP_SUBEVENT_COMPLETE, status);
1138 break;
1127 default:
1128 event_emited = false;
1129
1130 switch (hfp_connection->state){
1131 case HFP_W4_EXCHANGE_SUPPORTED_FEATURES:
1132 if (has_codec_negotiation_feature(hfp_connection)){
1133 hfp_connection->state = HFP_NOTIFY_ON_CODECS;
1134 break;

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

2166 hfp_hf_run_for_context(hfp_connection);
2167 }
2168 return ERROR_CODE_SUCCESS;
2169 }
2170 }
2171 return ERROR_CODE_SUCCESS;
2172}
2173
1139 default:
1140 event_emited = false;
1141
1142 switch (hfp_connection->state){
1143 case HFP_W4_EXCHANGE_SUPPORTED_FEATURES:
1144 if (has_codec_negotiation_feature(hfp_connection)){
1145 hfp_connection->state = HFP_NOTIFY_ON_CODECS;
1146 break;

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

2178 hfp_hf_run_for_context(hfp_connection);
2179 }
2180 return ERROR_CODE_SUCCESS;
2181 }
2182 }
2183 return ERROR_CODE_SUCCESS;
2184}
2185
2186uint8_t hfp_hf_send_at_command(hci_con_handle_t acl_handle, const char * at_command){
2187 hfp_connection_t * hfp_connection = get_hfp_hf_connection_context_for_acl_handle(acl_handle);
2188 if (!hfp_connection) {
2189 return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
2190 }
2191 if (hfp_connection->send_custom_message != NULL){
2192 return ERROR_CODE_COMMAND_DISALLOWED;
2193 }
2194 hfp_connection->send_custom_message = at_command;
2195 hfp_hf_run_for_context(hfp_connection);
2196 return ERROR_CODE_SUCCESS;
2197}
2198
2174int hfp_hf_in_band_ringtone_active(hci_con_handle_t acl_handle){
2175 hfp_connection_t * hfp_connection = get_hfp_hf_connection_context_for_acl_handle(acl_handle);
2176 if (!hfp_connection) {
2177 return 0;
2178 }
2179 return get_bit(hfp_connection->remote_supported_features, HFP_AGSF_IN_BAND_RING_TONE);
2180}
2181

--- 36 unchanged lines hidden ---
2199int hfp_hf_in_band_ringtone_active(hci_con_handle_t acl_handle){
2200 hfp_connection_t * hfp_connection = get_hfp_hf_connection_context_for_acl_handle(acl_handle);
2201 if (!hfp_connection) {
2202 return 0;
2203 }
2204 return get_bit(hfp_connection->remote_supported_features, HFP_AGSF_IN_BAND_RING_TONE);
2205}
2206

--- 36 unchanged lines hidden ---