Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_atci.h
1 #ifndef _BC_ATCI_H
2 #define _BC_ATCI_H
3 
4 #include <bc_uart.h>
5 
9 
10 #ifndef BC_ATCI_UART
11 #define BC_ATCI_UART BC_UART_UART2
12 #endif
13 
14 #define BC_ATCI_COMMANDS_LENGTH(COMMANDS) (sizeof(COMMANDS) / sizeof(COMMANDS[0]))
15 
16 #define BC_ATCI_COMMAND_CLAC {"+CLAC", bc_atci_clac_action, NULL, NULL, NULL, ""}
17 #define BC_ATCI_COMMAND_HELP {"$HELP", bc_atci_help_action, NULL, NULL, NULL, "This help"}
18 
19 typedef struct
20 {
21  char *txt;
22  size_t length;
23  size_t offset;
24 
26 
28 
29 typedef struct
30 {
31  const char *command;
32  bool (*action)(void);
33  bool (*set)(bc_atci_param_t *param);
34  bool (*read)(void);
35  bool (*help)(void);
36  const char *hint;
37 
39 
43 
44 void bc_atci_init(const bc_atci_command_t *commands, int length);
45 
47 
48 void bc_atci_write_ok(void);
49 
51 
52 void bc_atci_write_error(void);
53 
57 
58 void bc_atci_printf(const char *format, ...);
59 
61 
62 bool bc_atci_skip_response(void);
63 
65 
66 bool bc_atci_clac_action(void);
67 
69 
70 bool bc_atci_help_action(void);
71 
77 
78 bool bc_atci_get_uint(bc_atci_param_t *param, uint32_t *value);
79 
86 
87 bool bc_atci_get_string(bc_atci_param_t *param, char *str, size_t length);
88 
95 
96 bool bc_atci_get_buffer_from_hex_string(bc_atci_param_t *param, void *buffer, size_t *length);
97 
102 
103 bool bc_atci_is_comma(bc_atci_param_t *param);
104 
109 
111 
115 
116 void bc_atci_set_uart_active_callback(bool(*callback)(void), bc_tick_t scan_interval);
117 
119 
120 #endif //_BC_ATCI_H
bool bc_atci_get_buffer_from_hex_string(bc_atci_param_t *param, void *buffer, size_t *length)
Decode HEX string to buffer and move parsing cursor forward.
Definition: bc_atci.c:332
uint64_t bc_tick_t
Timestamp data type.
Definition: bc_tick.h:16
bool bc_atci_get_uint(bc_atci_param_t *param, uint32_t *value)
Parse string to uint and move parsing cursor forward.
Definition: bc_atci.c:265
bool bc_atci_is_quotation_mark(bc_atci_param_t *param)
Check if the character at cursor is quotation mark (")
Definition: bc_atci.c:401
bool bc_atci_get_string(bc_atci_param_t *param, char *str, size_t length)
Copy string and move parsing cursor forward.
Definition: bc_atci.c:295
void bc_atci_set_uart_active_callback(bool(*callback)(void), bc_tick_t scan_interval)
Set callback function for scan if uart is active. Used for low-power when USB is disconnected (defaul...
Definition: bc_atci.c:406
bool bc_atci_help_action(void)
Helper for help action.
Definition: bc_atci.c:95
bool bc_atci_clac_action(void)
Helper for clac action.
Definition: bc_atci.c:86
AT command struct.
Definition: bc_atci.h:29
void bc_atci_printf(const char *format,...)
Prinf message and add CR LF.
Definition: bc_atci.c:46
void bc_atci_init(const bc_atci_command_t *commands, int length)
Initialize.
Definition: bc_atci.c:27
bool bc_atci_skip_response(void)
Skip response, use in callback in bc_atci_command_t.
Definition: bc_atci.c:69
void bc_atci_write_ok(void)
Write OK.
Definition: bc_atci.c:76
bool bc_atci_is_comma(bc_atci_param_t *param)
Check if the character at cursor is comma.
Definition: bc_atci.c:396
void bc_atci_write_error(void)
Write ERROR.
Definition: bc_atci.c:81