diff options
Diffstat (limited to 'fw/esp32/components/eos/include/gsm.h')
-rw-r--r-- | fw/esp32/components/eos/include/gsm.h | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/fw/esp32/components/eos/include/gsm.h b/fw/esp32/components/eos/include/gsm.h index 7864b09..eb893d6 100644 --- a/fw/esp32/components/eos/include/gsm.h +++ b/fw/esp32/components/eos/include/gsm.h @@ -1,12 +1,14 @@ +#include <sys/types.h> +#include <stdint.h> + #define GSM_OK 0 #define GSM_ERR -1 #define GSM_ERR_SIZE -10 -#define GSM_ERR_NOT_SUPPORTED -11 +#define GSM_ERR_NOTSUPPORTED -11 #define GSM_TS_SIZE 25 #define GSM_UD_SIZE 160 #define GSM_UDH_SIZE 140 -#define GSM_MSG_SIZE GSM_UD_SIZE #define GSM_ADDR_SIZE 20 /* Message-Type-Indicator */ @@ -124,16 +126,21 @@ #define GSM_FLAG_MWI_OTHER 0x3000 #define GSM_FLAG_MWI_MASK 0xf000 -uint8_t pdu_getc(char *pdu); -void pdu_putc(uint8_t ch, char *pdu); -void pdu_gets(char *pdu, uint8_t *s, int s_len); -void pdu_puts(uint8_t *s, int s_len, char *pdu); -int gsm_ucs2_to_7bit(uint16_t ucs2, char *gsm7, int gsm7_size); -int gsm_7bit_to_ucs2(char *gsm7, int gsm7_len, uint16_t *ucs2); - -int gsm_7bit_enc(char *text, int text_len, char *pdu, int padb); -int gsm_7bit_dec(char *pdu, char *text, int text_len, int padb); -int gsm_addr_enc(char *addr, int addr_len, uint8_t addr_type, char *pdu, int pdu_size); -int gsm_addr_dec(char *pdu, int pdu_len, char *addr, int *addr_len, uint8_t *addr_type); -int gsm_sms_enc(char *addr, int addr_len, uint8_t addr_type, uint8_t *udh, int udh_len, uint8_t *msg, int msg_len, uint8_t enc, uint16_t flags, char *pdu, int pdu_size); -int gsm_sms_dec(char *pdu, int pdu_len, char *addr, int *addr_len, uint8_t *addr_type, uint8_t *udh, int *udh_len, uint8_t *msg, int *msg_len, char *ts, uint8_t *enc, uint16_t *flags); +size_t pdu_putc(char *pdu, uint8_t ch); +ssize_t pdu_getc(char *pdu, uint8_t *ch); +size_t pdu_puts(char *pdu, uint8_t *s, size_t s_len); +ssize_t pdu_gets(char *pdu, uint8_t *s, size_t s_len); +size_t pdu_7bit_enc(char *pdu, char *text, size_t text_len, int padb); +ssize_t pdu_7bit_dec(char *pdu, char *text, size_t text_len, int padb); + +void gsm_dcs_enc(uint8_t enc, uint16_t flags, uint8_t *dcs); +void gsm_dcs_dec(uint8_t dcs, uint8_t *enc, uint16_t *flags); +ssize_t gsm_ts_enc(char *pdu, size_t pdu_size, char *ts); +ssize_t gsm_ts_dec(char *pdu, size_t pdu_len, char *ts); +int gsm_addr_enc(char *pdu, size_t pdu_size, char *addr, size_t addr_len, uint8_t addr_type); +int gsm_addr_dec(char *pdu, size_t pdu_len, char *addr, size_t *addr_len, uint8_t *addr_type); +int gsm_sms_enc(char *pdu, size_t pdu_size, char *addr, size_t addr_len, uint8_t addr_type, uint8_t *udh, size_t udh_len, uint8_t *txt, size_t txt_len, uint8_t enc, uint16_t flags); +int gsm_sms_dec(char *pdu, size_t pdu_len, char *addr, size_t *addr_len, uint8_t *addr_type, uint8_t *udh, size_t *udh_len, uint8_t *txt, size_t *txt_len, uint8_t *enc, char *ts, uint16_t *flags); + +int gsm_ucs2_to_7bit(char *gsm7, size_t gsm7_size, uint16_t ucs2); +int gsm_7bit_to_ucs2(char *gsm7, size_t gsm7_len, uint16_t *ucs2); |