1 /****************************************************************************** 2 * 3 * Copyright (c) 2014 The Android Open Source Project 4 * Copyright 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 24 #include <cstdint> 25 #include "osi/include/alarm.h" 26 27 /* ASCII character string of arguments to the AT command */ 28 #define BTA_HF_CLIENT_AT_MAX_LEN 512 29 30 typedef uint8_t tBTA_HF_CLIENT_AT_CMD; 31 32 /* Maximum combined buffer for received AT events string */ 33 #define BTA_HF_CLIENT_AT_PARSER_MAX_LEN 4096 34 35 /* This structure holds prepared AT command queued for sending */ 36 struct queued_at_cmd { 37 tBTA_HF_CLIENT_AT_CMD cmd; 38 char buf[BTA_HF_CLIENT_AT_MAX_LEN]; 39 uint16_t buf_len; 40 struct queued_at_cmd* next; 41 }; 42 typedef struct queued_at_cmd tBTA_HF_CLIENT_AT_QCMD; 43 44 /* Maximum number of indicators */ 45 #define BTA_HF_CLIENT_AT_INDICATOR_COUNT 20 46 47 /* AT command parsing control block */ 48 typedef struct { 49 char buf[BTA_HF_CLIENT_AT_PARSER_MAX_LEN + 50 1]; /* extra byte to always have \0 at the end */ 51 unsigned int offset; 52 tBTA_HF_CLIENT_AT_CMD current_cmd; 53 tBTA_HF_CLIENT_AT_QCMD* queued_cmd; 54 alarm_t* resp_timer; /* AT response timer */ 55 alarm_t* hold_timer; /* AT hold timer */ 56 57 /* CIND: lookup table to store the sequence of incoming indicators and their 58 values 59 so when their values come later, we know which value in sequence match 60 certain indicator */ 61 int indicator_lookup[BTA_HF_CLIENT_AT_INDICATOR_COUNT]; 62 63 } tBTA_HF_CLIENT_AT_CB; 64