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

Commit 6a7ca9cb 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
parent 68d78a3e
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
@@ -47,6 +47,7 @@
typedef struct
{
    const char  *p_cmd;         /* AT command string */
    size_t      command_id;     /* passed to the callback on p_cmd match */
    UINT8       arg_type;       /* allowable argument type syntax */
    UINT8       fmt;            /* whether arg is int or string */
    UINT8       min;            /* minimum value for int arg */
@@ -54,7 +55,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 cmd, UINT8 arg_type,
typedef void (tBTA_AG_AT_CMD_CBACK)(void *p_user, UINT16 command_id, UINT8 arg_type,
                                    char *p_arg, INT16 int_arg);

/* callback function executed to send "ERROR" result code */
+205 −408

File changed.

Preview size limit exceeded, changes collapsed.

+0 −10
Original line number Diff line number Diff line
@@ -29,16 +29,6 @@
#include "bta_ag_api.h"
#include "bta_ag_at.h"

/* 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
*****************************************************************************/