/* CIND: storage room for indicators value range and their statuses */
static const tBTA_HF_CLIENT_INDICATOR bta_hf_client_indicators[BTA_HF_CLIENT_AT_SUPPORTED_INDICATOR_COUNT] = {
/* name | min | max | name length - used by parser */
- {BTA_HF_CLIENT_INDICATOR_BATTERYCHG, 0, 5, sizeof(BTA_HF_CLIENT_INDICATOR_BATTERYCHG)},
- {BTA_HF_CLIENT_INDICATOR_SIGNAL, 0, 5, sizeof(BTA_HF_CLIENT_INDICATOR_SIGNAL)},
- {BTA_HF_CLIENT_INDICATOR_SERVICE, 0, 1, sizeof(BTA_HF_CLIENT_INDICATOR_SERVICE)},
{BTA_HF_CLIENT_INDICATOR_CALL, 0, 1, sizeof(BTA_HF_CLIENT_INDICATOR_CALL)},
- {BTA_HF_CLIENT_INDICATOR_ROAM, 0, 1, sizeof(BTA_HF_CLIENT_INDICATOR_ROAM)},
{BTA_HF_CLIENT_INDICATOR_CALLSETUP, 0, 3, sizeof(BTA_HF_CLIENT_INDICATOR_CALLSETUP)},
+ {BTA_HF_CLIENT_INDICATOR_SERVICE, 0, 1, sizeof(BTA_HF_CLIENT_INDICATOR_SERVICE)},
+ {BTA_HF_CLIENT_INDICATOR_SIGNAL, 0, 5, sizeof(BTA_HF_CLIENT_INDICATOR_SIGNAL)},
+ {BTA_HF_CLIENT_INDICATOR_ROAM, 0, 1, sizeof(BTA_HF_CLIENT_INDICATOR_ROAM)},
+ {BTA_HF_CLIENT_INDICATOR_BATTERYCHG, 0, 5, sizeof(BTA_HF_CLIENT_INDICATOR_BATTERYCHG)},
{BTA_HF_CLIENT_INDICATOR_CALLHELD, 0, 2, sizeof(BTA_HF_CLIENT_INDICATOR_CALLHELD)}
};
APPL_TRACE_DEBUG("%s index: %u value: %u", __FUNCTION__, index, value);
- if (index == 0 || index > BTA_HF_CLIENT_AT_INDICATOR_COUNT) {
+ if (index >= BTA_HF_CLIENT_AT_INDICATOR_COUNT) {
return;
}
service_availability = value == 0 ? FALSE : TRUE;
}
- realind = bta_hf_client_cb.scb.at_cb.indicator_lookup[index - 1];
+ realind = bta_hf_client_cb.scb.at_cb.indicator_lookup[index];
if (realind >= 0 && realind < BTA_HF_CLIENT_AT_SUPPORTED_INDICATOR_COUNT) {
/* get the real in-array index from lookup table by index it comes at */
/* Check if prefix match and skip spaces if any */
#define AT_CHECK_EVENT(buf, event) \
- if (strncmp("\r\n"event, buf,sizeof("\r\n"event) - 1) != 0) return buf; \
- buf += sizeof("\r\n"event) - 1; \
- while (*buf == ' ') buf++;
+if (strncmp("\r\n"event,buf,sizeof("\r\n"event) - 1) != 0) \
+ return buf; \
+buf += sizeof("\r\n"event) - 1; \
+while (*buf == ' ') buf++;
/* check for <cr><lf> and forward buffer if match */
#define AT_CHECK_RN(buf) \
if (strncmp("\r\n", buf, sizeof("\r\n") - 1) != 0) { \
- APPL_TRACE_DEBUG("%s missing end <cr><lf>", __FUNCTION__); \
- return NULL;} \
+ APPL_TRACE_ERROR("%s missing end <cr><lf>", __FUNCTION__); \
+ return NULL;\
+ } \
buf += sizeof("\r\n") - 1;
/* skip rest of AT string up to <cr> */
AT_CHECK_EVENT(buffer, "+CNUM:");
- res = sscanf(buffer, ",\"%32[^\"]\",%hu,,%hu%n", numstr, &type, &service, &offset);
+ res = sscanf(buffer, ",\"%32[^\"]\",%hu%n,,%hu%n", numstr, &type, &offset, &service, &offset);
if (res < 0) {
return NULL;
}
if (res == 0) {
- res = sscanf(buffer, ",\"\",%hu,,%hu%n", &type, &service, &offset);
+ res = sscanf(buffer, ",\"\",%hu%n,,%hu%n", &type, &offset, &service, &offset);
if (res < 0) {
return NULL;
}
numstr[0] = '\0';
}
- if (res < 3) {
+ if (res < 2) {
return NULL;
}
for (i = 0; i < bta_hf_client_psraser_cb_count; i++) {
tmp = bta_hf_client_parser_cb[i](buf);
if (tmp == NULL) {
- APPL_TRACE_ERROR("HFPCient: AT event/reply parsing failed, skipping");
+ APPL_TRACE_ERROR("HFPCient: AT event/reply parsing failed, skipping %d", i);
tmp = bta_hf_client_skip_unknown(buf);
break;
}
typedef UINT8 tBTA_HF_CLIENT_STATUS;
-/* indicator type */
-#define BTA_HF_CLIENT_IND_BATTCH 0 /* Battery charge indicator */
-#define BTA_HF_CLIENT_IND_SIGNAL 1 /* Signal Strength indicator */
-#define BTA_HF_CLIENT_IND_SERVICE 2 /* Service availability indicator */
-#define BTA_HF_CLIENT_IND_CALL 3 /* Standard call status indicator*/
-#define BTA_HF_CLIENT_IND_ROAM 4 /* Roaming status indicator */
-#define BTA_HF_CLIENT_IND_CALLSETUP 5 /* Call setup status indicator */
-#define BTA_HF_CLIENT_IND_CALLHELD 6 /* Call hold status indicator */
-
+/* indicator constants HFP 1.1 and later */
+#define BTA_HF_CLIENT_IND_CALL 0 /* position of call indicator */
+#define BTA_HF_CLIENT_IND_CALLSETUP 1 /* position of callsetup indicator */
+#define BTA_HF_CLIENT_IND_SERVICE 2 /* position of service indicator */
+/* indicator constants HFP 1.5 and later */
+#define BTA_HF_CLIENT_IND_SIGNAL 3 /* position of signal strength indicator */
+#define BTA_HF_CLIENT_IND_ROAM 4 /* position of roaming indicator */
+#define BTA_HF_CLIENT_IND_BATTCH 5 /* position of battery charge indicator */
+#define BTA_HF_CLIENT_IND_CALLHELD 6 /* position of callheld indicator */
+#define BTA_HF_CLIENT_IND_BEARER 7 /* position of bearer indicator */
typedef UINT8 tBTA_HF_CLIENT_IND_TYPE;
/* AT commands */