Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 67cbdb66 authored by Andre Eisenbach's avatar Andre Eisenbach
Browse files

Remove position dependent lookup tables in AT command parser

The various position dependent lookup tables in the AT command parser
were out of sync, causing invalid responses to the AT+CBPS command for
example.

This patch gets rid of positionally dependent enums for simple lookup
tables that correlate all the values for easier, less error prone
maintenance of the related tables.

This re-instates a previously reverted patch after fixing incorrect
field order in tBTA_AG_INDICATOR_MAP.

Change-Id: I7f8a052e78706c8c72c5102b38cfe9ce200ae0d9
Fixes: 29978908
(cherry picked from commit b5cc24fcdaeb32f1f44bc39b65f6b0c035e47d5f)
parent 4ee48543
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -149,12 +149,16 @@ void bta_ag_process_at(tBTA_AG_AT_CB *p_cb)
                else
                {

                    (*p_cb->p_cmd_cback)(p_cb->p_user, idx, arg_type, p_arg, int_arg);
                    (*p_cb->p_cmd_cback)(p_cb->p_user,
                                         p_cb->p_at_tbl[idx].command_id,
                                         arg_type, p_arg, int_arg);
                }
            }
            else
            {
                (*p_cb->p_cmd_cback)(p_cb->p_user, idx, arg_type, p_arg, int_arg);
                (*p_cb->p_cmd_cback)(p_cb->p_user,
                                     p_cb->p_at_tbl[idx].command_id,
                                     arg_type, p_arg, int_arg);
            }
        }
        /* else error */
+2 −1
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ extern "C" {
typedef struct
{
    const char  *p_cmd;         /* AT command string */
    size_t      command_id;     /* passed to the callback on p_cmd match */
    uint8_t     arg_type;       /* allowable argument type syntax */
    uint8_t     fmt;            /* whether arg is int or string */
    uint8_t     min;            /* minimum value for int arg */
@@ -58,7 +59,7 @@ typedef struct
} tBTA_AG_AT_CMD;

/* callback function executed when command is parsed */
typedef void (tBTA_AG_AT_CMD_CBACK)(void *p_user, uint16_t cmd, uint8_t arg_type,
typedef void (tBTA_AG_AT_CMD_CBACK)(void *p_user, uint16_t command_id, uint8_t arg_type,
                                    char *p_arg, int16_t int_arg);

/* callback function executed to send "ERROR" result code */
+209 −413

File changed.

Preview size limit exceeded, changes collapsed.

+0 −10
Original line number Diff line number Diff line
@@ -33,16 +33,6 @@
extern "C" {
#endif

/* Send RING & CLIP in one AT cmd */
#ifndef BTA_AG_MULTI_RESULT_INCLUDED
#define BTA_AG_MULTI_RESULT_INCLUDED FALSE
#endif

/* Replace : in VGS and VGM for HSP */
#ifndef BTA_HSP_RESULT_REPLACE_COLON
#define BTA_HSP_RESULT_REPLACE_COLON TRUE
#endif

/*****************************************************************************
**  Constants
*****************************************************************************/