- 1、本文档共5页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
手机短信pdu格式
短消息结构SM_PARAM:
VC++:
// 短消息参数结构,编码/解码共用
// 其中,字符串以0结尾
typedef struct {
char SCA[16]; // 短消息服务中心号码(SMSC地址)
char TPA[16]; // 目标号码或回复号码(TP-DA或TP-RA)
char TP_PID; // 用户信息协议标识(TP-PID)
char TP_DCS; // 用户信息编码方式(TP-DCS)
char TP_SCTS[16]; // 服务时间戳字符串(TP_SCTS), 接收时用到
char TP_UD[161]; // 原始用户信息(编码前或解码后的TP-UD)
char index; // 短消息序号,在读取时用到
} SM_PARAM;
VB:
Public Type SM_PARAM
SCA(16) As Byte // 短消息服务中心号码(SMSC地址)
TPA(16) As Byte //目标号码或回复号码(TP-DA或TP-RA)
TP_PID As Byte //用户信息协议标识(TP-PID)
TP_DCS As Byte // 用户信息编码方式(TP-DCS)
TP_SCTS(16) As Byte // 服务时间戳字符串(TP_SCTS), 接收时用到
TP_UD(161) As Byte // 原始用户信息(编码前或解码后的TP-UD)
index As Byte // 短消息序号,在读取时用到
End Type
Delphi:
type SM_PARAM=record
SCA:Array[0..15] of char; // 短消息服务中心号码(SMSC地址)
TPA:Array[0..15] of char; // 目标号码或回复号码(TP-DA或TP-RA)
TP_PID:char; //用户信息协议标识(TP-PID)
TP_DCS:char; // 用户信息编码方式(TP-DCS)
TP_SCTS:Array[0..15] of char]; // 服务时间戳字符串(TP_SCTS), 接收时用到
TP_UD:Array[0..160] of char; // 原始用户信息(编码前或解码后的TP-UD)
index:Array[0..2] of char; // 短消息序号,在读取时用到
end;
// CloseComm关闭串口,返回bool值
VC++
bool CloseComm()
VB
Private Declare Function CloseComm Lib smspdu.dll () As Boolean
Delphi
function CloseComm():bool ;stdcall;external smspdu.dll name CloseComm;
// OpenComm打开串口, 返回bool值
// pPort:串口字符串如“COM1“
// nBaudRate:波特率9600为CBR_9600
// nParity:奇偶校验位,若无为NOPARITY
// nByteSize:数据位,为8
// nStopBits:停止位,若1位为ONESTOPBIT
VC++
bool OpenComm(const char* pPort, int nBaudRate, int nParity, int nByteSize, int nStopBits)
VB
Private Declare Function OpenComm Lib smspdu.dll (ByVal pPort As String, ByVal nBaudRate As Integer, ByVal nParity As Integer, ByVal nByteSize As Integer, ByVal nStopBits As Integer) As Boolean
Delphi
function OpenComm(pPort:PChar;nRaudRate:Integer;nParity:Integer;nByteSize:Integer;nByteSize:Integer):THandle ;stdcall;external smspdu.dll name OpenComm;
// SendShortMessage发送短消息,返回值为int
//send_number:目标手机号码字符串
// s
文档评论(0)