123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913 |
- /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
- * All rights reserved.
- *
- * This software is supplied "AS IS" without any warranties.
- * RDA assumes no responsibility or liability for the use of the software,
- * conveys no license or title under any patent, copyright, or mask work
- * right to the product. RDA reserves the right to make changes in the
- * software without notification. RDA also make no representation or
- * warranty that such application will be suitable for the specified use
- * without further testing or modification.
- */
- #ifndef _AT_PARAM_H_
- #define _AT_PARAM_H_
- #include <stdint.h>
- #include <stdbool.h>
- #include "osi_vsmap.h"
- #include "quec_proj_config.h"
- #ifndef CONFIG_QUEC_PROJECT_FEATURE_ATC_PARSE
- /**
- * parsed AT command parameter
- */
- typedef struct
- {
- uint8_t type; ///< parameter type, used by AT engine internally
- uint16_t length; ///< value length
- char value[1]; ///< value, the real size is variable
- } atCmdParam_t;
- /**
- * extract uint parameter
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * @param param parameter pointer
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - uint parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is empty
- * - \a param is not integer number
- */
- uint32_t atParamUint(atCmdParam_t *param, bool *paramok);
- /**
- * extract optional uint parameter
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * When \a param is empty, \a defval is returned. Otherwise, it is the
- * same as \a atParamUint.
- *
- * @param param parameter pointer
- * @param defval default value
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - uint parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is not integer number
- */
- uint32_t atParamDefUint(atCmdParam_t *param, uint32_t defval, bool *paramok);
- /**
- * extract uint parameter, and check range
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * @param param parameter pointer
- * @param minval minimum valid value, inclusive
- * @param maxval maximum valid value, inclusive
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - uint parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is empty
- * - \a param is not integer number
- * - \a param is not in range
- */
- uint32_t atParamUintInRange(atCmdParam_t *param, uint32_t minval, uint32_t maxval, bool *paramok);
- /**
- * extract optional uint parameter, and check range
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * When \a param is empty, \a defval is returned. Otherwise, it is the
- * same as \a atParamUintInRange. The \a defval is not required in the
- * range.
- *
- * @param param parameter pointer
- * @param defval default value
- * @param minval minimum valid value, inclusive
- * @param maxval maximum valid value, inclusive
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - uint parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is not integer number
- * - \a param is not in range
- */
- uint32_t atParamDefUintInRange(atCmdParam_t *param, uint32_t defval, uint32_t minval, uint32_t maxval, bool *paramok);
- /**
- * extract uint parameter, and check in list
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * @param param parameter pointer
- * @param list array of valid values
- * @param count valid value count
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - uint parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is empty
- * - \a param is not integer number
- * - \a param is not in list
- */
- uint32_t atParamUintInList(atCmdParam_t *param, const uint32_t *list, unsigned count, bool *paramok);
- /**
- * extract optional uint parameter, and check in list
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * When \a param is empty, \a defval is returned. Otherwise, it is the
- * same as \a atParamUintInList. The \a defval is not required in the
- * list.
- *
- * @param param parameter pointer
- * @param defval default value
- * @param list array of valid values
- * @param count valid value count
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - uint parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is not integer number
- * - \a param is not in list
- */
- uint32_t atParamDefUintInList(atCmdParam_t *param, uint32_t defval, const uint32_t *list, unsigned count, bool *paramok);
- /**
- * extract int parameter
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * @param param parameter pointer
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - int parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is empty
- * - \a param is not integer number
- */
- int atParamInt(atCmdParam_t *param, bool *paramok);
- /**
- * extract optional int parameter
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * When \a param is empty, \a defval is returned. Otherwise, it is the
- * same as \a atParamUint.
- *
- * @param param parameter pointer
- * @param defval default value
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - int parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is not integer number
- */
- int atParamDefInt(atCmdParam_t *param, int defval, bool *paramok);
- /**
- * extract int parameter, and check range
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * @param param parameter pointer
- * @param minval minimum valid value, inclusive
- * @param maxval maximum valid value, inclusive
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - int parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is empty
- * - \a param is not integer number
- * - \a param is not in range
- */
- int atParamIntInRange(atCmdParam_t *param, int minval, int maxval, bool *paramok);
- /**
- * extract optional int parameter, and check range
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * When \a param is empty, \a defval is returned. Otherwise, it is the
- * same as \a atParamUintInRange. The \a defval is not required in the
- * range.
- *
- * @param param parameter pointer
- * @param defval default value
- * @param minval minimum valid value, inclusive
- * @param maxval maximum valid value, inclusive
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - int parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is not integer number
- * - \a param is not in range
- */
- int atParamDefIntInRange(atCmdParam_t *param, int defval, int minval, int maxval, bool *paramok);
- /**
- * extract int parameter, and check in list
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * @param param parameter pointer
- * @param list array of valid values
- * @param count valid value count
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - int parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is empty
- * - \a param is not integer number
- * - \a param is not in list
- */
- int atParamIntInList(atCmdParam_t *param, const int *list, unsigned count, bool *paramok);
- /**
- * extract optional int parameter, and check in list
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * When \a param is empty, \a defval is returned. Otherwise, it is the
- * same as \a atParamUintInList. The \a defval is not required in the
- * list.
- *
- * @param param parameter pointer
- * @param defval default value
- * @param list array of valid values
- * @param count valid value count
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - int parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is not integer number
- * - \a param is not in list
- */
- int atParamDefIntInList(atCmdParam_t *param, int defval, const int *list, unsigned count, bool *paramok);
- /**
- * extract uint64 parameter
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * @param param parameter pointer
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - uint parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is empty
- * - \a param is not integer number
- */
- uint64_t atParamUint64(atCmdParam_t *param, bool *paramok);
- /**
- * extract optional uint64 parameter
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * When \a param is empty, \a defval is returned. Otherwise, it is the
- * same as \a atParamUint.
- *
- * @param param parameter pointer
- * @param defval default value
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - uint parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is not integer number
- */
- uint64_t atParamDefUint64(atCmdParam_t *param, uint64_t defval, bool *paramok);
- /**
- * extract uint64 parameter, and check range
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * @param param parameter pointer
- * @param minval minimum valid value, inclusive
- * @param maxval maximum valid value, inclusive
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - uint parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is empty
- * - \a param is not integer number
- * - \a param is not in range
- */
- uint64_t atParamUint64InRange(atCmdParam_t *param, uint64_t minval, uint64_t maxval, bool *paramok);
- /**
- * extract optional uint64 parameter, and check range
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * When \a param is empty, \a defval is returned. Otherwise, it is the
- * same as \a atParamUintInRange. The \a defval is not required in the
- * range.
- *
- * @param param parameter pointer
- * @param defval default value
- * @param minval minimum valid value, inclusive
- * @param maxval maximum valid value, inclusive
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - uint parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is not integer number
- * - \a param is not in range
- */
- uint64_t atParamDefUint64InRange(atCmdParam_t *param, uint64_t defval, uint64_t minval, uint64_t maxval, bool *paramok);
- /**
- * extract uint64 parameter, and check in list
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * @param param parameter pointer
- * @param list array of valid values
- * @param count valid value count
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - uint parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is empty
- * - \a param is not integer number
- * - \a param is not in list
- */
- uint64_t atParamUint64InList(atCmdParam_t *param, const uint64_t *list, unsigned count, bool *paramok);
- /**
- * extract optional uint64 parameter, and check in list
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * When \a param is empty, \a defval is returned. Otherwise, it is the
- * same as \a atParamUintInList. The \a defval is not required in the
- * list.
- *
- * @param param parameter pointer
- * @param defval default value
- * @param list array of valid values
- * @param count valid value count
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - uint parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is not integer number
- * - \a param is not in list
- */
- uint64_t atParamDefUint64InList(atCmdParam_t *param, uint64_t defval, const uint64_t *list, unsigned count, bool *paramok);
- /**
- * extract int64 parameter
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * @param param parameter pointer
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - int parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is empty
- * - \a param is not integer number
- */
- int64_t atParamInt64(atCmdParam_t *param, bool *paramok);
- /**
- * extract optional int64 parameter
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * When \a param is empty, \a defval is returned. Otherwise, it is the
- * same as \a atParamUint.
- *
- * @param param parameter pointer
- * @param defval default value
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - int parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is not integer number
- */
- int64_t atParamDefInt64(atCmdParam_t *param, int64_t defval, bool *paramok);
- /**
- * extract int64 parameter, and check range
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * @param param parameter pointer
- * @param minval minimum valid value, inclusive
- * @param maxval maximum valid value, inclusive
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - int parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is empty
- * - \a param is not integer number
- * - \a param is not in range
- */
- int64_t atParamInt64InRange(atCmdParam_t *param, int64_t minval, int64_t maxval, bool *paramok);
- /**
- * extract optional int64 parameter, and check range
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * When \a param is empty, \a defval is returned. Otherwise, it is the
- * same as \a atParamUintInRange. The \a defval is not required in the
- * range.
- *
- * @param param parameter pointer
- * @param defval default value
- * @param minval minimum valid value, inclusive
- * @param maxval maximum valid value, inclusive
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - int parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is not integer number
- * - \a param is not in range
- */
- int64_t atParamDefInt64InRange(atCmdParam_t *param, int64_t defval, int64_t minval, int64_t maxval, bool *paramok);
- /**
- * extract int64 parameter, and check in list
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * @param param parameter pointer
- * @param list array of valid values
- * @param count valid value count
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - int parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is empty
- * - \a param is not integer number
- * - \a param is not in list
- */
- int64_t atParamInt64InList(atCmdParam_t *param, const int64_t *list, unsigned count, bool *paramok);
- /**
- * extract optional int64 parameter, and check in list
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * When \a param is empty, \a defval is returned. Otherwise, it is the
- * same as \a atParamUintInList. The \a defval is not required in the
- * list.
- *
- * @param param parameter pointer
- * @param defval default value
- * @param list array of valid values
- * @param count valid value count
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - int parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is not integer number
- * - \a param is not in list
- */
- int64_t atParamDefInt64InList(atCmdParam_t *param, int64_t defval, const int64_t *list, unsigned count, bool *paramok);
- /**
- * extract string parameter
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * String parameter is parameter started and ended with double quotation.
- * The escape defined in V.250 is \\HH. For example, \30 for '0'.
- *
- * It is possible that the internal storage will be changed during this
- * function call. So, don't call other parameter APIs for the same
- * parameter after it is called. However, this function itself can be
- * called again.
- *
- * The output pointer will be valid till the parameter itself is deleted.
- *
- * The output string is ended with null byte for end of string.
- *
- * @param param parameter pointer
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - parsed string
- * - NULL on failed
- * - \a *paramok is false at input
- * - \a param is empty
- * - \a param is not string (start and end with double quotation)
- */
- const char *atParamStr(atCmdParam_t *param, bool *paramok);
- /**
- * extract hex or str parameter from raw text
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * Raw text parameter is parameter started and ended without double quotation.
- * The escape defined in V.250 is \\HH. For example, \30 for '0'.
- *
- * It is possible that the internal storage will be changed during this
- * function call. So, don't call other parameter APIs for the same
- * parameter after it is called. However, this function itself can be
- * called again.
- *
- * The output pointer will be valid till the parameter itself is deleted.
- *
- * The output string is ended with null byte for end of string.
- *
- * @param param parameter pointer
- * @param len the length of the parameter
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - parsed string
- * - NULL on failed
- * - \a *paramok is false at input
- * - \a param is empty
- * - \a param is string (start and end with double quotation)
- */
- const char *atParamHexData(atCmdParam_t *param, uint32_t len, bool *paramok);
- /**
- * extract hex parameter from raw text
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * Raw text parameter is parameter started and ended without double quotation.
- * The escape defined in V.250 is \\HH. For example, \30 for '0'.
- *
- * It is possible that the internal storage will be changed during this
- * function call. So, don't call other parameter APIs for the same
- * parameter after it is called. However, this function itself can be
- * called again.
- *
- * The output pointer will be valid till the parameter itself is deleted.
- *
- * The output string is ended with null byte for end of string.
- *
- * @param param parameter pointer
- * @param len the length of the parameter
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - parsed string
- * - NULL on failed
- * - \a *paramok is false at input
- * - \a param is empty
- * - \a param is string (start and end with double quotation)
- */
- const char *atParamHexRawText(atCmdParam_t *param, uint32_t len, bool *paramok);
- /**
- * extract string parameter
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * String parameter is parameter started and ended with double quotation.
- * The escape defined in V.250 is \\HH. For example, \30 for '0'.
- *
- * It is possible that the internal storage will be changed during this
- * function call. So, don't call other parameter APIs for the same
- * parameter after it is called. However, this function itself can be
- * called again.
- *
- * The output pointer will be valid till the parameter itself is deleted.
- *
- * The output string is ended with null byte for end of string.
- *
- * @param param parameter pointer
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - parsed string
- * - NULL on failed
- * - \a *paramok is false at input
- * - \a param is empty
- * - \a param is not string (start and end with double quotation)
- */
- const char *atParamOptStr(atCmdParam_t *param, bool *paramok);
- /**
- * extract optional string parameter
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * When \a param is empty, \a defval is returned. Otherwise, it is the
- * same as \a atParamStr.
- *
- * It is possible that the internal storage will be changed during this
- * function call. So, don't call other parameter APIs for the same
- * parameter after it is called. However, this function itself can be
- * called again.
- *
- * @param param parameter pointer
- * @param defval default value
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - parsed string
- * - NULL on failed
- * - \a *paramok is false at input
- * - \a param is not string (start and end with double quotation)
- */
- const char *atParamDefStr(atCmdParam_t *param, const char *defval, bool *paramok);
- /**
- * extract raw parameter
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * The raw parameter is not parsed. For example, the double quotation of
- * string parameter will be kept, and the escape in string parameter is
- * untouched.
- *
- * The output string is ended with null byte as end of string.
- *
- * @param param parameter pointer
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - parsed string
- * - NULL on failed
- * - \a *paramok is false at input
- * - \a param is empty
- */
- const char *atParamRawText(atCmdParam_t *param, bool *paramok);
- /**
- * extract floating point parameter
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * @param param parameter pointer
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - floating point parameter
- * - NULL on failed
- * - \a *paramok is false at input
- * - \a param is empty
- * - \a param is not double
- */
- double atParamDouble(atCmdParam_t *param, bool *paramok);
- /**
- * extract DTMF parameter
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * There are 2 kinds of DTMF parameter:
- * - one DTMF character without double quotation
- * - multiple DTMF chaeacters with double quotation
- * In both case, the return value is DTMF character string with null byte
- * as the string end.
- *
- * It will not check whether DTMF characters inside the string is valid
- * DTMF character. Application should validate them.
- *
- * It is possible that the internal storage will be changed during this
- * function call. So, don't call other parameter APIs for the same
- * parameter after it is called. However, this function itself can be
- * called again.
- *
- * @param param parameter pointer
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - parsed DTMF string
- * - NULL on failed
- * - \a *paramok is false at input
- * - \a param is empty
- * - \a param is not DTMF
- */
- const char *atParamDtmf(atCmdParam_t *param, bool *paramok);
- /**
- * extract string parameter and return mapped uint
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * It is just a wrapper to:
- * - extract string parameter
- * - map to uint
- *
- * @param param parameter pointer
- * @param vsmap integer/string map, ended with NULL string value
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - uint parameter
- * - NULL on failed
- * - \a *paramok is false at input
- * - \a param is empty
- * - \a param is not in map
- */
- uint32_t atParamUintByStrMap(atCmdParam_t *param, const osiValueStrMap_t *vsmap, bool *paramok);
- /**
- * extract optional string parameter and return mapped uint
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * When \a param is empty, \a defval is returned. Otherwise, it is the
- * same as \a atParamUintByStrMap. The \a defval is not required in the
- * map.
- *
- * @param param parameter pointer
- * @param defval default value
- * @param vsmap integer/string map, ended with NULL string value
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - uint parameter
- * - NULL on failed
- * - \a *paramok is false at input
- * - \a param is not in map
- */
- uint32_t atParamDefUintByStrMap(atCmdParam_t *param, uint32_t defval, const osiValueStrMap_t *vsmap, bool *paramok);
- /**
- * extract uint parameter by hex string
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * The valid parameter is the output of:
- * \code{.cpp}
- * printf("\"%x\"", value)
- * \endcode
- *
- * For example, parameter "12345" will be parsed as 0x12345.
- *
- * @param param parameter pointer
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - uint parameter
- * - NULL on failed
- * - \a *paramok is false at input
- * - \a param is empty
- * - \a param is not the needed format
- */
- uint32_t atParamHexStrUint(atCmdParam_t *param, bool *paramok);
- /**
- * trim tailing characters at the end of parameter
- *
- * This shall be called before the parameter isn't parsed. \p atParamRawText
- * won't parse the parameter, so it is safe to call it after \p atParamRawText.
- *
- * It will change the internal storage of parameter directly. So, only call
- * it when absolutely needed, and you know what you are doing.
- *
- * @param param parameter pointer
- * @param len length after trim
- * @return
- * - true on success
- * - false on failed
- * - \p param type is not raw text
- * - the length of parameter is shorter than \p len
- */
- bool atParamTrimTail(atCmdParam_t *param, uint32_t len);
- /**
- * check whether the parameter is empty
- *
- * Both not specified and skipped parameter are empty. For example:
- * - AT+CMD=123
- * - AT+CMD=123,
- * - AT+CMD=123,,456
- *
- * In all of the above cases, params[1] is empty.
- *
- * @param param parameter pointer
- * @return
- * - true if the parameter is empty
- * - false otherwise
- */
- bool atParamIsEmpty(atCmdParam_t *param);
- #ifdef CONFIG_QUEC_PROJECT_FEATURE
- /**
- * extract hex int64_t parameter, and check range
- *
- * When \a *paramok is false, it will do nothing. On failure, \a *param
- * will be set to false on return.
- *
- * @param param parameter pointer
- * @param minval minimum valid value, inclusive
- * @param maxval maximum valid value, inclusive
- * @param paramok in/out parameter parsing ok flag
- * @return
- * - uint parameter
- * - 0 on failed
- * - \a *paramok is false at input
- * - \a param is empty
- * - \a param is not integer number
- * - \a param is not in range
- */
- int64_t atParamHexInt64InRange(atCmdParam_t *param, int64_t minval, int64_t maxval, bool *paramok);
- #endif
- #else
- #include "quec_at_param.h"
- typedef ql_at_param_t atCmdParam_t;
- #define atParamUint quec_atParamUint
- #define atParamDefUint quec_atParamDefUint
- #define atParamUintInRange quec_atParamUintInRange
- #define atParamDefUintInRange quec_atParamDefUintInRange
- #define atParamUintInList quec_atParamUintInList
- #define atParamDefUintInList quec_atParamDefUintInList
- #define atParamInt quec_atParamInt
- #define atParamDefInt quec_atParamDefInt
- #define atParamIntInRange quec_atParamIntInRange
- #define atParamDefIntInRange quec_atParamDefIntInRange
- #define atParamIntInList quec_atParamIntInList
- #define atParamDefIntInList quec_atParamDefIntInList
- #define atParamUint64 quec_atParamUint64
- #define atParamDefUint64 quec_atParamDefUint64
- #define atParamUint64InRange quec_atParamUint64InRange
- #define atParamDefUint64InRange quec_atParamDefUint64InRange
- #define atParamUint64InList quec_atParamUint64InList
- #define atParamDefUint64InList quec_atParamDefUint64InList
- #define atParamInt64 quec_atParamInt64
- #define atParamDefInt64 quec_atParamDefInt64
- #define atParamInt64InRange quec_atParamInt64InRange
- #define atParamDefInt64InRange quec_atParamDefInt64InRange
- #define atParamInt64InList quec_atParamInt64InList
- #define atParamDefInt64InList quec_atParamDefInt64InList
- #define atParamStr quec_atParamStr
- #define atParamDefStr quec_atParamDefStr
- #define atParamRawText quec_atParamRawText
- #define atParamOptStr quec_atParamOptStr
- #define atParamIsEmpty quec_atParamIsEmpty
- #define atParamHexRawText quec_atParamHexRawText
- #define atParamTrimTail quec_atParamTrimTail
- #define atParamHexData quec_atParamHexData
- #define atParamUintByStrMap(param, vsmap, paramok)\
- quec_atParamUintByStrMap(param, (const quec_ValueStrMap_t *)vsmap, paramok)
-
- #define atParamDefUintByStrMap(param, defval, vsmap, paramok)\
- quec_atParamDefUintByStrMap(param, defval, (const quec_ValueStrMap_t *)vsmap, paramok)
- #endif
- #endif
|