diff options
Diffstat (limited to 'code/esp32/components/eos/include')
-rw-r--r-- | code/esp32/components/eos/include/at_urc.h | 17 | ||||
-rw-r--r-- | code/esp32/components/eos/include/cell.h | 16 | ||||
-rw-r--r-- | code/esp32/components/eos/include/eos.h | 3 |
3 files changed, 33 insertions, 3 deletions
diff --git a/code/esp32/components/eos/include/at_urc.h b/code/esp32/components/eos/include/at_urc.h new file mode 100644 index 0000000..9a4c641 --- /dev/null +++ b/code/esp32/components/eos/include/at_urc.h @@ -0,0 +1,17 @@ +#include <sys/types.h> +#include <stdint.h> +#include <regex.h> + +#define AT_SIZE_NMATCH 4 +#define AT_SIZE_PATTERN 64 + +#define AT_SIZE_URC_LIST 16 + +#define AT_URC_OK 0 +#define AT_URC_MORE 1 + +typedef int (*at_urc_cb_t) (char *, regmatch_t[]); + +int at_urc_process(char *urc); +int at_urc_insert(char *pattern, at_urc_cb_t cb, int flags); +int at_urc_delete(char *pattern);
\ No newline at end of file diff --git a/code/esp32/components/eos/include/cell.h b/code/esp32/components/eos/include/cell.h index f3eb89d..4a2cfbc 100644 --- a/code/esp32/components/eos/include/cell.h +++ b/code/esp32/components/eos/include/cell.h @@ -11,7 +11,8 @@ #define EOS_CELL_UART_MODE_NONE 0 #define EOS_CELL_UART_MODE_PPP 1 -#define EOS_CELL_UART_MODE_RELAY 2 +#define EOS_CELL_UART_MODE_ATCMD 2 +#define EOS_CELL_UART_MODE_RELAY 3 void eos_pcm_init(void); @@ -21,7 +22,16 @@ void eos_pcm_start(void); void eos_pcm_stop(void); void eos_modem_init(void); -ssize_t eos_modem_write(void *data, size_t size); -void eos_modem_set_mode(char mode); + +void eos_modem_flush(void); +size_t eos_modem_write(void *data, size_t size); +size_t eos_modem_read(void *data, size_t size, uint32_t timeout); +int eos_modem_readln(char *buf, size_t buf_size, uint32_t timeout); +int eos_modem_resp(char *ok_str, char *err_str, uint32_t timeout); + +uint8_t eos_modem_get_mode(void); +int eos_modem_set_mode(uint8_t mode); +int eos_modem_take(void); +void eos_modem_give(void); void eos_cell_init(void);
\ No newline at end of file diff --git a/code/esp32/components/eos/include/eos.h b/code/esp32/components/eos/include/eos.h index c3f83bb..59f0ddb 100644 --- a/code/esp32/components/eos/include/eos.h +++ b/code/esp32/components/eos/include/eos.h @@ -1,7 +1,10 @@ #define EOS_OK 0 #define EOS_ERR -1 +#define EOS_ERR_TIMEOUT -2 + #define EOS_ERR_FULL -10 #define EOS_ERR_EMPTY -11 +#define EOS_ERR_NOTFOUND -12 #define EOS_TASK_PRIORITY_UART 1 #define EOS_TASK_PRIORITY_UART_RI 1 |