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