luat_soc_sdk_2024 V1.0
luat_sms.h
浏览该文件的文档.
1/*
2 * Copyright (c) 2022 OpenLuat & AirM2M
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy of
5 * this software and associated documentation files (the "Software"), to deal in
6 * the Software without restriction, including without limitation the rights to
7 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8 * the Software, and to permit persons to whom the Software is furnished to do so,
9 * subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in all
12 * copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 */
21
22#ifndef LUAT_SMS_H
23#define LUAT_SMS_H
24
25#include "luat_base.h"
30#define LUAT_MSG_MAX_ADDR_LEN 80
31#define LUAT_SMS_MAX_TXT_SIZE 640
32#define LUAT_SMS_MAX_PDU_SIZE 180
33#define LUAT_SMS_MAX_LENGTH_OF_ADDRESS_VALUE 40
34#define LUAT_SMS_MAX_ADDR_STR_MAX_LEN ((LUAT_SMS_MAX_LENGTH_OF_ADDRESS_VALUE + 1) * 4)
35typedef void (*LUAT_SMS_HANDLE_CB)(uint8_t event, void* param);
36typedef void (*LUAT_SMS_HANDLE_SEND_CB)(int ret);
37
68
74
75typedef struct
76{
77 uint8_t year;
78 uint8_t month;
79 uint8_t day;
80 uint8_t hour;
81 uint8_t minute;
82 uint8_t second;
83 uint8_t tz; /* time zone */
84 uint8_t tz_sign; /* '+'/'-' */
86
87typedef struct
88{
89 uint8_t type;
90 uint8_t msg_class;
91 uint8_t alpha_bet;
92 uint8_t indication;
93 uint8_t dcs;
95
96//接受的短信信息结构体
97typedef struct
98{
99 uint16_t pdu_length;//PDU 长度
100 uint16_t sms_length;//TEXT 的长度
103 char pdu_data[LUAT_SMS_MAX_TXT_SIZE + 1];//PDU 数据
104 uint8_t sms_buffer[LUAT_SMS_MAX_TXT_SIZE + 1];//TEXT 数据
105 uint8_t sc_address[LUAT_MSG_MAX_ADDR_LEN + 1];//中心地址
106 uint8_t phone_address[LUAT_MSG_MAX_ADDR_LEN + 1];//来电号码
107 uint8_t refNum;
108 uint8_t maxNum;
109 uint8_t seqNum;
111
112
116void luat_sms_init(void);
117
126int luat_sms_send_msg(uint8_t *p_input, char *p_des, bool is_pdu, int input_pdu_len);
127
133
134
141#endif
void luat_sms_send_msg_register_handler(LUAT_SMS_HANDLE_SEND_CB callback_fun)
发送短信回调
void(* LUAT_SMS_HANDLE_CB)(uint8_t event, void *param)
int luat_sms_send_msg(uint8_t *p_input, char *p_des, bool is_pdu, int input_pdu_len)
发送短信
LUAT_SMS_SEND_RET_CODE_E
void(* LUAT_SMS_HANDLE_SEND_CB)(int ret)
#define LUAT_MSG_MAX_ADDR_LEN
void luat_sms_recv_msg_register_handler(LUAT_SMS_HANDLE_CB callback_fun)
接受短信回调
#define LUAT_SMS_MAX_TXT_SIZE
void luat_sms_init(void)
初始化短信
@ SMS_UNSUPPORT_TEXT_WITH_CHINESE
@ SMS_USIM_PIN_REQUIRED
@ SMS_SERVICE_OF_ME_RESV
@ SMS_OPERATION_NOT_ALLOWED
@ SMS_INVALID_MEM_INDEX
@ SMS_OPERATION_NOT_SUPPORTED
@ SMS_SEND_OK
@ SMS_MEM_FULL
@ SMS_USIM_PIN2_REQUIRED
@ SMS_USIM_WRONG
@ SMS_USIM_PUK_REQUIRED
@ SMS_USIM_BUSY
@ SMS_NETWORK_TIMEOUT
@ SMS_INVALID_PDU_MODE_PARAMETER
@ SMS_NO_CNMA_ACK_EXPECTED
@ SMS_USIM_NOT_INSERTED
@ SMS_INVALID_DATA
@ SMS_SMSC_ADDR_UNKNOWN
@ SMS_MAX_ERROR
@ SMS_MEMORY_FAILURE
@ SMS_INVALID_TEXT_MODE_PARAMETER
@ SMS_NO_NETWORK_SERVICE
@ SMS_USIM_PUK2_REQUIRED
@ SMS_UNKNOWN_ERROR
@ SMS_PHSIM_PIN_REQUIRED
@ SMS_ME_FAILURE
@ SMS_USIM_FAILURE
LUAT_SMS_HANDLE_CB cb
LUAT_SMS_HANDLE_SEND_CB send_cb
LUAT_SMS_RECV_MSG_DCS_T dcs_info
LUAT_SMS_RECV_MSG_TIME_T time