141d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/****************************************************************************** 241d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta * 341d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta * Copyright (c) 2014 The Android Open Source Project 441d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta * Copyright (C) 2003-2012 Broadcom Corporation 541d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta * 641d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta * Licensed under the Apache License, Version 2.0 (the "License"); 741d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta * you may not use this file except in compliance with the License. 841d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta * You may obtain a copy of the License at: 941d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta * 1041d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta * http://www.apache.org/licenses/LICENSE-2.0 1141d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta * 1241d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta * Unless required by applicable law or agreed to in writing, software 1341d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta * distributed under the License is distributed on an "AS IS" BASIS, 1441d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1541d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta * See the License for the specific language governing permissions and 1641d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta * limitations under the License. 1741d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta * 1841d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta ******************************************************************************/ 1941d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta 2041d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/***************************************************************************** 218af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson * Data types 228af480e24549ba51a3f6858d9d9af504715e0beaMyles Watson ****************************************************************************/ 2341d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta 2441d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* ASCII character string of arguments to the AT command */ 25cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_MAX_LEN 512 2641d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta 27e9e58ced195ec2c983c7723c9cbdabd45eb0f2fdMarie Janssentypedef uint8_t tBTA_HF_CLIENT_AT_CMD; 2841d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta 2941d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* Maximum combined buffer for received AT events string */ 30cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson#define BTA_HF_CLIENT_AT_PARSER_MAX_LEN 4096 3141d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta 3241d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* This structure holds prepared AT command queued for sending */ 33cd1fd07f1306e08fe048682dd5918987e579f937Myles Watsonstruct queued_at_cmd { 34cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson tBTA_HF_CLIENT_AT_CMD cmd; 35cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson char buf[BTA_HF_CLIENT_AT_MAX_LEN]; 36cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson uint16_t buf_len; 37cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson struct queued_at_cmd* next; 3841d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta}; 3941d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Guptatypedef struct queued_at_cmd tBTA_HF_CLIENT_AT_QCMD; 4041d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta 4141d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* Maximum number of indicators */ 4241d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta#define BTA_HF_CLIENT_AT_INDICATOR_COUNT 20 4341d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta 4441d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta/* AT command parsing control block */ 45cd1fd07f1306e08fe048682dd5918987e579f937Myles Watsontypedef struct { 46cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson char buf[BTA_HF_CLIENT_AT_PARSER_MAX_LEN + 47cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson 1]; /* extra byte to always have \0 at the end */ 48cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson unsigned int offset; 49cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson tBTA_HF_CLIENT_AT_CMD current_cmd; 50cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson tBTA_HF_CLIENT_AT_QCMD* queued_cmd; 51cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson alarm_t* resp_timer; /* AT response timer */ 52cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson alarm_t* hold_timer; /* AT hold timer */ 5341d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta 54cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson /* CIND: lookup table to store the sequence of incoming indicators and their 55cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson values 56cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson so when their values come later, we know which value in sequence match 57cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson certain indicator */ 58cd1fd07f1306e08fe048682dd5918987e579f937Myles Watson int indicator_lookup[BTA_HF_CLIENT_AT_INDICATOR_COUNT]; 5941d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta 6041d4a266ceca77bb09ab1bf5c04c30d15f3ded3aHemant Gupta} tBTA_HF_CLIENT_AT_CB; 61