TuyaOS
结构体 | 宏定义 | 类型定义 | 枚举 | 函数
tkl_cellular_sms.h 文件参考

蜂窝模组短信API实现接口。 更多...

#include <stdint.h>
#include "tuya_cloud_types.h"
tkl_cellular_sms.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

结构体

struct  TUYA_CELLULAR_SMS_RECV_T
 接收短信结构体定义 更多...
 

宏定义

#define TUYA_SMS_MSG_LEN_MAX   140
 短信内容最大长度
 
#define TUYA_SMS_PHONENUM_LEN_MAX   42
 收发短信时,手机号码最大长度
 

类型定义

typedef VOID_T(* TUYA_CELLULAR_SMS_CB) (UINT8_T sim_id, TUYA_CELLULAR_SMS_RECV_T *msg)
 短信接收回调函数接口原型 更多...
 

枚举

enum  TUYA_CELLULAR_SMS_ENCODE_E {
  TUYA_SMS_ISO8859_1 , TUYA_SMS_UTF8 , TUYA_SMS_UTF16BE , TUYA_SMS_UTF16LE ,
  TUYA_SMS_GSM , TUYA_SMS_CP936
}
 短信内容编码格式
 

函数

VOID * tkl_cellular_sms_convert_str (CONST VOID *from, INT_T from_size, TUYA_CELLULAR_SMS_ENCODE_E from_chset, TUYA_CELLULAR_SMS_ENCODE_E to_chset, INT_T *to_size)
 
OPERATE_RET tkl_cellular_sms_mute (BOOL_T mute)
 设置短信接收时静音 更多...
 
OPERATE_RET tkl_cellular_sms_recv_cb_register (TUYA_CELLULAR_SMS_CB callback)
 注册短信接收回调函数 更多...
 
OPERATE_RET tkl_cellular_sms_send (UINT8_T sim_id, TUYA_CELLULAR_SMS_SEND_T *sms_msg)
 发送短信 更多...
 

详细描述

蜂窝模组短信API实现接口。

作者
www.tuya.com

类型定义说明

◆ TUYA_CELLULAR_SMS_CB

typedef VOID_T(* TUYA_CELLULAR_SMS_CB) (UINT8_T sim_id, TUYA_CELLULAR_SMS_RECV_T *msg)

短信接收回调函数接口原型

注解
回调函数中不要调用阻塞性函数,msg结构体内存由系统 负责分配和释放。
参数
simIdsim卡ID
msg短信结构体
返回

函数说明

◆ tkl_cellular_sms_convert_str()

VOID * tkl_cellular_sms_convert_str ( CONST VOID *  from,
INT_T  from_size,
TUYA_CELLULAR_SMS_ENCODE_E  from_chset,
TUYA_CELLULAR_SMS_ENCODE_E  to_chset,
INT_T *  to_size 
)

短信内容编码转换

When from_charset or to_charset is unknown or unsupported, return NULL. The returned pointer is allocated inside, caller should free it.

At most from_size byte count will be processed. When from_size is -1, process till null chracter.

null character will always be inserted into the output string. Invalid characters are replaced silently.

to_size can be NULL in case that the output byte count is not needed.

参数
frominput string
from_sizeinput string byte count
from_chsetinput string charset
to_chsetoutput string charset
to_sizeoutput string byte count
返回
  • NULL: invalid parameters
  • output string

◆ tkl_cellular_sms_mute()

OPERATE_RET tkl_cellular_sms_mute ( BOOL_T  mute)

设置短信接收时静音

注解
默认情况下,收到短信时,会通过扬声器播放提示音。通过该函数,可设置接收 短信时,不播放提示音。
参数
muteTRUE 静音 FALSE 短信接收时打开提示音
返回
0 设置成功 其它 设置失败

◆ tkl_cellular_sms_recv_cb_register()

OPERATE_RET tkl_cellular_sms_recv_cb_register ( TUYA_CELLULAR_SMS_CB  callback)

注册短信接收回调函数

注解
该函数需在SIM卡激活前注册,否则可能引起异常或短信丢失。
参数
callback短信接收回调函数
返回
0 注册成功 其它 注册失败

◆ tkl_cellular_sms_send()

OPERATE_RET tkl_cellular_sms_send ( UINT8_T  sim_id,
TUYA_CELLULAR_SMS_SEND_T sms_msg 
)

发送短信

参数
simIdsim卡ID
smsMsg发送的短信
返回
0 发送成功 其它 发送失败