| #ifndef _ATCI_AT_UTIL_H_ |
| #define _ATCI_AT_UTIL_H_ |
| |
| #define SYS_SUCC 0 |
| #define SYS_FAIL -1 |
| |
| typedef enum { |
| ATCI_SPACE = ' ', |
| ATCI_EQUAL = '=', |
| ATCI_COMMA = ',', |
| ATCI_SEMICOLON = ';', |
| ATCI_COLON = ':', |
| ATCI_AT = '@', |
| ATCI_HAT = '^', |
| ATCI_MONEY = '$', |
| ATCI_DOUBLE_QUOTE = '"', |
| ATCI_QUESTION_MARK = '?', |
| ATCI_EXCLAMATION_MARK = '!', |
| ATCI_FORWARD_SLASH = '/', |
| ATCI_L_ANGLE_BRACKET = '<', |
| ATCI_R_ANGLE_BRACKET = '>', |
| ATCI_R_BRACKET = ')', |
| ATCI_L_BRACKET = '(', |
| ATCI_L_SQ_BRACKET = '[', |
| ATCI_R_SQ_BRACKET = ']', |
| ATCI_L_CURLY_BRACKET = '{', |
| ATCI_R_CURLY_BRACKET = '}', |
| ATCI_CHAR_STAR = '*', |
| ATCI_CHAR_POUND = '#', |
| ATCI_CHAR_AMPSAND = '&', |
| ATCI_CHAR_PERCENT = '%', |
| ATCI_CHAR_PLUS = '+', |
| ATCI_CHAR_MINUS = '-', |
| ATCI_CHAR_DOT = '.', |
| ATCI_CHAR_ULINE = '_', |
| ATCI_CHAR_TILDE = '~', |
| ATCI_CHAR_REVERSE_SOLIDUS = '\\', |
| ATCI_CHAR_VERTICAL_LINE = '|', |
| ATCI_END_CHAR = '\0', |
| ATCI_CR = '\r', |
| ATCI_LF = '\n', |
| ATCI_CHAR_0 = '0', |
| ATCI_CHAR_1 = '1', |
| ATCI_CHAR_2 = '2', |
| ATCI_CHAR_3 = '3', |
| ATCI_CHAR_4 = '4', |
| ATCI_CHAR_5 = '5', |
| ATCI_CHAR_6 = '6', |
| ATCI_CHAR_7 = '7', |
| ATCI_CHAR_8 = '8', |
| ATCI_CHAR_9 = '9', |
| ATCI_CHAR_A = 'A', |
| ATCI_CHAR_B = 'B', |
| ATCI_CHAR_C = 'C', |
| ATCI_CHAR_D = 'D', |
| ATCI_CHAR_E = 'E', |
| ATCI_CHAR_F = 'F', |
| ATCI_CHAR_G = 'G', |
| ATCI_CHAR_H = 'H', |
| ATCI_CHAR_I = 'I', |
| ATCI_CHAR_J = 'J', |
| ATCI_CHAR_K = 'K', |
| ATCI_CHAR_L = 'L', |
| ATCI_CHAR_M = 'M', |
| ATCI_CHAR_N = 'N', |
| ATCI_CHAR_O = 'O', |
| ATCI_CHAR_P = 'P', |
| ATCI_CHAR_Q = 'Q', |
| ATCI_CHAR_R = 'R', |
| ATCI_CHAR_S = 'S', |
| ATCI_CHAR_T = 'T', |
| ATCI_CHAR_U = 'U', |
| ATCI_CHAR_V = 'V', |
| ATCI_CHAR_W = 'W', |
| ATCI_CHAR_X = 'X', |
| ATCI_CHAR_Y = 'Y', |
| ATCI_CHAR_Z = 'Z', |
| ATCI_CHAR_a = 'a', |
| ATCI_CHAR_b = 'b', |
| ATCI_CHAR_c = 'c', |
| ATCI_CHAR_d = 'd', |
| ATCI_CHAR_e = 'e', |
| ATCI_CHAR_f = 'f', |
| ATCI_CHAR_g = 'g', |
| ATCI_CHAR_h = 'h', |
| ATCI_CHAR_i = 'i', |
| ATCI_CHAR_j = 'j', |
| ATCI_CHAR_k = 'k', |
| ATCI_CHAR_l = 'l', |
| ATCI_CHAR_m = 'm', |
| ATCI_CHAR_n = 'n', |
| ATCI_CHAR_o = 'o', |
| ATCI_CHAR_p = 'p', |
| ATCI_CHAR_q = 'q', |
| ATCI_CHAR_r = 'r', |
| ATCI_CHAR_s = 's', |
| ATCI_CHAR_t = 't', |
| ATCI_CHAR_u = 'u', |
| ATCI_CHAR_v = 'v', |
| ATCI_CHAR_w = 'w', |
| ATCI_CHAR_x = 'x', |
| ATCI_CHAR_y = 'y', |
| ATCI_CHAR_z = 'z', |
| } atci_char_enum; |
| |
| typedef enum { |
| AT_WRONG_MODE, AT_SET_MODE, //Ex: at+eample=xxx |
| AT_READ_MODE, //Ex: at+eample? |
| AT_TEST_MODE, //Ex: at+eample=? |
| AT_ACTIVE_MODE //Ex: at+eample |
| } atci_cmd_mode_e; |
| |
| #define ATCI_LOWER_TO_UPPER(alpha_char) (((alpha_char >= ATCI_CHAR_a)&&(alpha_char <= ATCI_CHAR_z)) ? (alpha_char-32): (alpha_char)) |
| #define ATCI_UPPER_TO_LOWER(alpha_char) (((alpha_char >= ATCI_CHAR_A)&&(alpha_char <= ATCI_CHAR_Z)) ? (alpha_char+32): (alpha_char)) |
| #define ATCI_IS_CAHR(input ,alpha_char) ((alpha_char == input)? 1 : 0) |
| |
| char* atci_get_cmd_prefix(char *line); |
| int atci_get_cmd_mode(char *line); |
| int atci_at_skip_space(char **p_cur); |
| int atci_at_hasmore(char **p_cur); |
| int atci_at_to_equal(char **p_cur); |
| int atci_at_to_colon(char **p_cur); |
| int atci_at_skip_next_comma(char **p_cur); |
| int atci_at_get_nextint_base(char **p_cur, int *p_out, int base, int uns); |
| int atci_at_get_nextint(char **p_cur, int *p_out); |
| int atci_at_get_nexthexint(char **p_cur, int *p_out); |
| int atci_at_get_next_key(char **p_cur, char **p_out); |
| #endif |