diff options
author | Uros Majstorovic <majstor@majstor.org> | 2020-08-07 19:26:12 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2020-08-07 19:26:12 +0200 |
commit | 3af816f20b94326b05a6dde21d7f734df14b61d3 (patch) | |
tree | a4bbdb6e22c670b7231d9d909dc6b75fe9c5433e /fw/esp32/components/eos/include | |
parent | a35636fc4a55e6b0cfbb5772f7274ee749059836 (diff) |
net driver: removed obsolete flags; urc process simplefied; pcm: added active flag; tested cell voice/data
Diffstat (limited to 'fw/esp32/components/eos/include')
-rw-r--r-- | fw/esp32/components/eos/include/at_cmd.h | 5 | ||||
-rw-r--r-- | fw/esp32/components/eos/include/cell.h | 66 | ||||
-rw-r--r-- | fw/esp32/components/eos/include/msgq.h | 5 | ||||
-rw-r--r-- | fw/esp32/components/eos/include/net.h | 5 |
4 files changed, 42 insertions, 39 deletions
diff --git a/fw/esp32/components/eos/include/at_cmd.h b/fw/esp32/components/eos/include/at_cmd.h index 615a1c1..2fdd159 100644 --- a/fw/esp32/components/eos/include/at_cmd.h +++ b/fw/esp32/components/eos/include/at_cmd.h @@ -7,10 +7,7 @@ #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[]); +typedef void (*at_urc_cb_t) (char *, regmatch_t[]); void at_init(void); int at_urc_process(char *urc); diff --git a/fw/esp32/components/eos/include/cell.h b/fw/esp32/components/eos/include/cell.h index 3bf6b32..abba977 100644 --- a/fw/esp32/components/eos/include/cell.h +++ b/fw/esp32/components/eos/include/cell.h @@ -1,38 +1,44 @@ #include <sys/types.h> #include <stdint.h> -#define EOS_CELL_MTYPE_DEV 0x00 -#define EOS_CELL_MTYPE_VOICE 0x10 -#define EOS_CELL_MTYPE_SMS 0x20 -#define EOS_CELL_MTYPE_CBS 0x30 -#define EOS_CELL_MTYPE_USSD 0x40 -#define EOS_CELL_MTYPE_DATA 0x70 +#define EOS_CELL_MTYPE_DEV 0x00 +#define EOS_CELL_MTYPE_VOICE 0x10 +#define EOS_CELL_MTYPE_SMS 0x20 +#define EOS_CELL_MTYPE_CBS 0x30 +#define EOS_CELL_MTYPE_USSD 0x40 +#define EOS_CELL_MTYPE_DATA 0x70 -#define EOS_CELL_MTYPE_MASK 0xf0 -#define EOS_CELL_MAX_MTYPE 8 +#define EOS_CELL_MTYPE_MASK 0xf0 +#define EOS_CELL_MAX_MTYPE 8 -#define EOS_CELL_MTYPE_READY 0 -#define EOS_CELL_MTYPE_UART_DATA 1 -#define EOS_CELL_MTYPE_UART_TAKE 2 -#define EOS_CELL_MTYPE_UART_GIVE 3 -#define EOS_CELL_MTYPE_PCM_DATA 4 -#define EOS_CELL_MTYPE_PCM_START 5 -#define EOS_CELL_MTYPE_PCM_STOP 6 +#define EOS_CELL_MTYPE_READY 0 +#define EOS_CELL_MTYPE_UART_DATA 1 +#define EOS_CELL_MTYPE_UART_TAKE 2 +#define EOS_CELL_MTYPE_UART_GIVE 3 +#define EOS_CELL_MTYPE_PCM_DATA 4 +#define EOS_CELL_MTYPE_PCM_START 5 +#define EOS_CELL_MTYPE_PCM_STOP 6 -#define EOS_CELL_MTYPE_VOICE_DIAL 1 -#define EOS_CELL_MTYPE_VOICE_RING 2 -#define EOS_CELL_MTYPE_VOICE_ANSWER 3 -#define EOS_CELL_MTYPE_VOICE_HANGUP 4 -#define EOS_CELL_MTYPE_VOICE_BEGIN 5 -#define EOS_CELL_MTYPE_VOICE_END 6 +#define EOS_CELL_MTYPE_VOICE_DIAL 1 +#define EOS_CELL_MTYPE_VOICE_RING 2 +#define EOS_CELL_MTYPE_VOICE_ANSWER 3 +#define EOS_CELL_MTYPE_VOICE_HANGUP 4 +#define EOS_CELL_MTYPE_VOICE_BEGIN 5 +#define EOS_CELL_MTYPE_VOICE_END 6 +#define EOS_CELL_MTYPE_VOICE_MISSED 7 -#define EOS_CELL_MTYPE_USSD_REQUEST 1 -#define EOS_CELL_MTYPE_USSD_REPLY 2 +#define EOS_CELL_MTYPE_USSD_REQUEST 1 +#define EOS_CELL_MTYPE_USSD_REPLY 2 -#define EOS_CELL_UART_MODE_NONE 0 -#define EOS_CELL_UART_MODE_ATCMD 1 -#define EOS_CELL_UART_MODE_PPP 2 -#define EOS_CELL_UART_MODE_RELAY 3 +#define EOS_CELL_MTYPE_DATA_CONFIGURE 1 +#define EOS_CELL_MTYPE_DATA_CONNECT 2 +#define EOS_CELL_MTYPE_DATA_DISCONNECT 3 + +#define EOS_CELL_UART_MODE_NONE 0 +#define EOS_CELL_UART_MODE_ATCMD 1 +#define EOS_CELL_UART_MODE_PPP 2 +#define EOS_CELL_UART_MODE_RELAY 3 +#define EOS_CELL_UART_MODE_UNDEF 0xff #define EOS_CELL_UART_SIZE_BUF 128 @@ -54,7 +60,7 @@ void eos_modem_wake(uint8_t source, uint8_t mode); void eos_ppp_set_apn(char *apn); void eos_ppp_set_auth(char *user, char *pass); int eos_ppp_connect(void); -int eos_ppp_disconnect(void); +void eos_ppp_disconnect(void); void eos_cell_pcm_init(void); ssize_t eos_cell_pcm_read(unsigned char *data, size_t size); @@ -66,3 +72,7 @@ void eos_cell_voice_handler(unsigned char mtype, unsigned char *buffer, uint16_t void eos_cell_sms_handler(unsigned char mtype, unsigned char *buffer, uint16_t size); void eos_cell_ussd_handler(unsigned char mtype, unsigned char *buffer, uint16_t size); void eos_cell_data_handler(unsigned char mtype, unsigned char *buffer, uint16_t size); + +void eos_cell_voice_init(void); +void eos_cell_sms_init(void); +void eos_cell_ussd_init(void); diff --git a/fw/esp32/components/eos/include/msgq.h b/fw/esp32/components/eos/include/msgq.h index 86bb067..bbfe041 100644 --- a/fw/esp32/components/eos/include/msgq.h +++ b/fw/esp32/components/eos/include/msgq.h @@ -4,7 +4,6 @@ typedef struct EOSMsgItem { unsigned char type; unsigned char *buffer; uint16_t len; - uint8_t flags; } EOSMsgItem; typedef struct EOSMsgQ { @@ -15,8 +14,8 @@ typedef struct EOSMsgQ { } EOSMsgQ; void eos_msgq_init(EOSMsgQ *msgq, EOSMsgItem *array, uint8_t size); -int eos_msgq_push(EOSMsgQ *msgq, unsigned char type, unsigned char *buffer, uint16_t len, uint8_t flags); -void eos_msgq_pop(EOSMsgQ *msgq, unsigned char *type, unsigned char **buffer, uint16_t *len, uint8_t *flags); +int eos_msgq_push(EOSMsgQ *msgq, unsigned char type, unsigned char *buffer, uint16_t len); +void eos_msgq_pop(EOSMsgQ *msgq, unsigned char *type, unsigned char **buffer, uint16_t *len); uint8_t eos_msgq_len(EOSMsgQ *msgq); typedef struct EOSBufQ { diff --git a/fw/esp32/components/eos/include/net.h b/fw/esp32/components/eos/include/net.h index 54bad6d..f71d07d 100644 --- a/fw/esp32/components/eos/include/net.h +++ b/fw/esp32/components/eos/include/net.h @@ -19,16 +19,13 @@ #define EOS_NET_SIZE_BUFQ 4 #define EOS_NET_SIZE_SNDQ 4 -#define EOS_NET_FLAG_BFREE 0x1 -#define EOS_NET_FLAG_BCOPY 0x2 - typedef void (*eos_net_fptr_t) (unsigned char, unsigned char *, uint16_t); void eos_net_init(void); unsigned char *eos_net_alloc(void); void eos_net_free(unsigned char *buf); -int eos_net_send(unsigned char mtype, unsigned char *buffer, uint16_t len, uint8_t flags); +int eos_net_send(unsigned char mtype, unsigned char *buffer, uint16_t len); void eos_net_set_handler(unsigned char mtype, eos_net_fptr_t handler); void eos_net_sleep_done(uint8_t mode); void eos_net_wake(uint8_t source, uint8_t mode); |