#include <stdlib.h> | |
#include <stdint.h> | |
#include <string.h> | |
#include <stdbool.h> | |
#define GSW_HAL_SMS_ADDRESS_LEN 16 | |
#define GSW_HAL_SMS_RECV_CONT_MAX 1024 | |
#define GSW_HAL_SMS_CONTENT_LEN 1024 | |
// gsw include | |
#define GSW_HAL_SUCCESS 0 | |
#define GSW_HAL_FAIL -1 | |
#define GSW_HAL_MEM_INVAILD -2 | |
typedef enum gsw_hal_sms_state | |
{ | |
GSW_SMS_FULL_FLG, /**< sms full flag*/ | |
GSW_SMS_RECEIVED_FLG, /**<recv new sms flag*/ | |
} gsw_hal_sms_state_e; | |
typedef enum gsw_hal_sms_format | |
{ | |
SMS_FORMAT_GSM_7BIT = 0, /**< 7bit econde*/ | |
SMS_FORMAT_BINARY_DATA = 1, /**< 8bit binary encode*/ | |
SMS_FORMAT_UCS2 = 2, /**< ucs2 encode*/ | |
} gsw_hal_sms_format_e; | |
typedef struct gsw_hal_sms_date | |
{ | |
uint8_t year[5]; /**< year of date*/ | |
uint8_t month[3]; /**< month of date*/ | |
uint8_t day[3]; /**< day of date*/ | |
uint8_t hour[3]; /**< hour of time*/ | |
uint8_t minutes[3]; /**< minute of time*/ | |
uint8_t seconds[3]; /**< second of time*/ | |
uint8_t timezone[4]; /**< timezone*/ | |
} gsw_hal_sms_date_s; | |
typedef struct gsw_hal_sms_msg_type | |
{ | |
int8_t src_num[GSW_HAL_SMS_ADDRESS_LEN+1]; /**< sms phone num send msg*/ | |
int8_t dest_num[GSW_HAL_SMS_ADDRESS_LEN + 1]; /**< sms phone num recv msg*/ | |
gsw_hal_sms_format_e content_encode; /**< sms content is 7bit or 8bit or Ucs2 encode*/ | |
uint32_t content_len; /**< sms content size*/ | |
int8_t content[GSW_HAL_SMS_RECV_CONT_MAX + 1]; /**< sms content*/ | |
gsw_hal_sms_date_s date; /**< message time*/ | |
} gsw_hal_sms_msg_type_s; | |
typedef void (* GSW_HAL_SMS_CALLBACK_FUN)(gsw_hal_sms_state_e state, gsw_hal_sms_msg_type_s *report_info); | |
/** | |
* @brief SDK interface to call back sms messages | |
* @param [in] handle_ptr | |
* @retval 0: success | |
* @retval other: fail | |
*/ | |
int gsw_sms_reg_callback(GSW_HAL_SMS_CALLBACK_FUN handle_ptr); | |
/** | |
* @brief sms sdk init | |
* @param [in] token | |
* @retval 0: success | |
* @retval other: fail | |
*/ | |
int gsw_sms_sdk_init(int32_t token); | |
/** | |
* @brief sms sdk deinit | |
* @param | |
* @retval 0: success | |
* @retval other: fail | |
*/ | |
int gsw_sms_sdk_deinit(void); | |
/** | |
* @brief send sms fuction * | |
* @param [in] phone_num dest phone num send sms | |
* @param [in] char_set encode format for sms 0 7bit 1 binary 2 usc2 | |
* @param [in] msg sms content | |
* @param [in] msg_len send sms length,max is 1024 | |
* @retval 0: success | |
* @retval other: fail | |
*/ | |
int gsw_send_sms(int8_t *phone_num, int32_t char_set, int8_t *msg, int32_t msg_len); | |
/** | |
* @brief get smsc fuction * | |
* @param [in] len input buf len for smsc,max is 32 | |
* @param [out] smsc address for smsc get from this func * | |
* @retval 0: success | |
* @retval other: fail | |
*/ | |
int gsw_get_smsc_address(int32_t len, int8_t *smsc); | |
/** | |
* @brief set smsc fuction | |
* @param [out] smsc string value for smsc,max length is 32 * | |
* @retval 0: success | |
* @retval other: fail | |
*/ | |
int gsw_set_smsc_address(const int8_t *smsc); |