1 /****************************************************************************** 2 * 3 * Copyright (c) 2014 The Android Open Source Project 4 * Copyright (C) 2003-2012 Broadcom Corporation 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at: 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 * 18 ******************************************************************************/ 19 20 /***************************************************************************** 21 ** Data types 22 *****************************************************************************/ 23 #include "common/bt_target.h" 24 #if (BTA_HF_INCLUDED == TRUE) 25 26 /* ASCII character string of arguments to the AT command */ 27 #define BTA_HF_CLIENT_AT_MAX_LEN 512 28 29 /* callback function executed when command is parsed */ 30 typedef void (tBTA_AG_AT_CMD_CBACK)(void *p_user, UINT16 cmd, UINT8 arg_type, 31 char *p_arg, INT16 int_arg); 32 33 /* callback function executed to send "ERROR" result code */ 34 typedef void (tBTA_AG_AT_ERR_CBACK)(void *p_user, BOOLEAN unknown, char *p_arg); 35 36 enum { 37 BTA_HF_CLIENT_AT_NONE, 38 BTA_HF_CLIENT_AT_BRSF, 39 BTA_HF_CLIENT_AT_BAC, 40 BTA_HF_CLIENT_AT_CIND, 41 BTA_HF_CLIENT_AT_CIND_STATUS, 42 BTA_HF_CLIENT_AT_CMER, 43 BTA_HF_CLIENT_AT_CHLD, 44 BTA_HF_CLIENT_AT_CMEE, 45 BTA_HF_CLIENT_AT_BIA, 46 BTA_HF_CLIENT_AT_CLIP, 47 BTA_HF_CLIENT_AT_CCWA, 48 BTA_HF_CLIENT_AT_COPS, 49 BTA_HF_CLIENT_AT_CLCC, 50 BTA_HF_CLIENT_AT_BVRA, 51 BTA_HF_CLIENT_AT_VGS, 52 BTA_HF_CLIENT_AT_VGM, 53 BTA_HF_CLIENT_AT_ATD, 54 BTA_HF_CLIENT_AT_BLDN, 55 BTA_HF_CLIENT_AT_ATA, 56 BTA_HF_CLIENT_AT_CHUP, 57 BTA_HF_CLIENT_AT_BTRH, 58 BTA_HF_CLIENT_AT_VTS, 59 BTA_HF_CLIENT_AT_BCC, 60 BTA_HF_CLIENT_AT_BCS, 61 BTA_HF_CLIENT_AT_CNUM, 62 BTA_HF_CLIENT_AT_NREC, 63 BTA_HF_CLIENT_AT_BINP, 64 BTA_HF_CLIENT_AT_XAPL, 65 BTA_HF_CLIENT_AT_IPHONEACCEV, 66 }; 67 68 typedef UINT8 tBTA_HF_CLIENT_AT_CMD; 69 70 /* Maximum combined buffer for received AT events string */ 71 #define BTA_HF_CLIENT_AT_PARSER_MAX_LEN 4096 72 73 /* This structure holds prepared AT command queued for sending */ 74 struct queued_at_cmd { 75 tBTA_HF_CLIENT_AT_CMD cmd; 76 char buf[BTA_HF_CLIENT_AT_MAX_LEN]; 77 UINT16 buf_len; 78 struct queued_at_cmd *next; 79 }; 80 typedef struct queued_at_cmd tBTA_HF_CLIENT_AT_QCMD; 81 82 /* Maximum number of indicators */ 83 #define BTA_HF_CLIENT_AT_INDICATOR_COUNT 20 84 85 /* AT command parsing control block */ 86 typedef struct { 87 char buf[BTA_HF_CLIENT_AT_PARSER_MAX_LEN + 1]; /* extra byte to always have \0 at the end */ 88 unsigned int offset; 89 tBTA_HF_CLIENT_AT_CMD current_cmd; 90 tBTA_HF_CLIENT_AT_QCMD *queued_cmd; 91 92 TIMER_LIST_ENT resp_timer; /* AT response timer */ 93 BOOLEAN resp_timer_on; /* TRUE if AT response timer is active */ 94 95 TIMER_LIST_ENT hold_timer; /* AT hold timer */ 96 BOOLEAN hold_timer_on; /* TRUE if AT hold timer is active */ 97 98 /* CIND: lookup table to store the sequence of incoming indicators and their values 99 so when their values come later, we know which value in sequence match certain indicator */ 100 int indicator_lookup[BTA_HF_CLIENT_AT_INDICATOR_COUNT]; 101 102 } tBTA_HF_CLIENT_AT_CB; 103 104 /***************************************************************************** 105 ** Functions 106 *****************************************************************************/ 107 108 void bta_hf_client_at_init(void); 109 void bta_hf_client_at_reset(void); 110 #endif /* #if (BTA_HF_INCLUDED == TRUE) */ 111