📄 cmpp.pas
字号:
{CMPPAPI动态库接口
实现的函数有:
function CMPPQuery;//查询短信流量
function InitCMPPAPI;//初始化动态库接口
function CMPPSendSingle;//发送单条短信
function CMMPActiveTest;//移动网关激活测试
function CMPPDeliver;//获得属于本ICP信息
function CMPPSetKey;//修改shareKey
function CMPPCancel;//取消短信息发送
function CMPPSendBatch;//群发短信息
function GetSendBatchResp;//获得群发的返回信息
function CMPPAnalyzeStatusReport;//分析状态报告
}
unit CMPP;
interface
type
DeliverResp = record //移动网关发送信息结构
sMsgID: array[1..22] of Char;
nMsgLevel: Integer;
sServiceID: array[1..11] of Char;
nMsgFormat: Integer;
sSrcTermID: array[1..22] of Char;
nIsReply: Integer;
nMsgLen: Integer;
sMsgContent: array[1..251] of Char;
sDestTermID: array[1..21] of Char;
cTpPid: Char;
cTpUdh: Char;
end;
QueryResp = record //查询短信流量结构
nMT_TLMsg: Integer;
nMT_TLusr: Integer;
nMT_Scs: Integer;
nMT_WT: Integer;
nMT_FL: Integer;
nMO_Scs: Integer;
nMO_WT: Integer;
nMO_FL: Integer;
end;
SendBatchResp = record //群发返回信息结构
sMsgID: array[0..21] of Char;
nErrorCode: Integer;
sPhoneNo: array[0..21] of Char;
end;
PSendBatchResp = ^SendBatchResp;
PQueryResp = ^QueryResp;
PDeliverResp = ^DeliverResp;
const
GTD_SPCODE = '07788';
PHONENO_TXT = 'phoneno.txt';
MSGID_TXT = 'msgid.txt';
MSGCONTENT_TXT = 'msgcontent.txt';
NEED_REPLY_YES = 2; //需要返回状态报告
NEED_REPLY_NO = 0; //无需返回状态报告
MSG_FORMAT_ASCII = 0; //文本信息标志
MSG_FORMAT_WRITE_CARD = 3; //读卡写卡信息标志
MSG_FORMAT_BINARY = 4; //二进制信息标志
MSG_FORMAT_UCS2 = 8;
MSG_FORMAT_GB = 15;
TPPID_BINARY = 1;
TPPID_ASCII = 0;
TPUDHI_BINARY = 1;
TPUDHI_ASCII = 0;
NTIMEOUT = 10;
ERROR_CODE_OK = 0; //成功
ERROR_CODE_INVALID_LEN = 4;
ERROR_CODE_INVALID_FEECODE = 5;
ERROR_CODE_TOO_LONG = 6;
ERROR_CODE_INVALID_SERVICEID = 7;
ERROR_CODE_TOO_FAST = 8;
ERROR_CODE_INVALID_ICP = 10;
ERROR_CODE_INVALID_MSGFORMAT = 11;
ERROR_CODE_INVALID_FEETYPE = 12;
ERROR_CODE_INVALID_VALIDTIME = 13;
ERROR_CODE_INVALID_ATTIME = 14;
ERROR_CODE_INVALID_SRCTERMID = 15;
ERROR_CODE_INVALID_DESTTERMID = 16;
ERROR_CODE_INVALID_DESTTERMIDFILE = 17;
ERROR_CODE_INVALID_MSGFILE = 18;
ERROR_CODE_INVALID_MSG = 19;
ERROR_CODE_CONNECT_FAIL = 20;
ERROR_CODE_LOGIN_FAIL = 21;
ERROR_CODE_GET_RESP_FAIL = 22;
ERROR_CODE_QUEUE_FULL = 23;
ERROR_CODE_SYSTEM_ERROR = 99;
QUERY_TYPE_TOTAL = 0;
QUERY_TYPE_SERVICEID = 1;
SM_STATUS_IN_QUEUE = 0;
SM_STATUS_SEND_SMC_OK = 1;
SM_STATUS_SEND_SMC_FAIL = 2;
SM_STATUS_USER_RECV_OK = 3;
SM_STATUS_USER_NO_RECV = 4;
function InitCMPPAPI(sINIFile: PChar): Integer; cdecl;
function CMPPSendSingle(nNeedReply: Integer; nMsgLevel: Integer;
sServiceID: PChar; nMsgFormat: Integer;
sFeeType: PChar; sFeeCode: PChar;
sValidTime: PChar; sAtTime: PChar;
sSrcTermID: PChar; sDestTermID: PChar;
nMsgLen: Integer; sMsgContent: PChar;
sMsgID: PChar; var nErrorCode: Integer;
cFeeUserType: Char; sFeeTerminalId: PChar;
cTpPid: Char; cTpUdhi: Char): Integer; cdecl;
function CMMPActiveTest(var nErrorCode: Integer): Integer; cdecl;
function CMPPSetKey(sKey: PChar): Integer; cdecl;
{function CMMPGetSMStatus(sMsgID: Pchar; var nStatus: Integer): Integer; cdecl;}
function CMPPCancel(sMsgID: PChar): Integer; cdecl;
function CMPPSendBatch(nNeedReply: Integer; nMsgLevel: Integer;
sServiceID: PChar; nMsgFormat: Integer;
sFeeType: PChar; sFeeCode: PChar;
sValidTime: PChar; sAtTime: PChar;
sSrcTermID: PChar; sDestTermIDFile: PChar;
sMsgFile: PChar; sMsgIDFile: PChar;
cFeeUserType: Char; sFeeTerminalId: PChar;
cTpPid: Char; cTpUdhi: Char): Integer; cdecl;
function CMPPDeliver(nTimeout: Integer; rDeliverResp: PDeliverResp): Integer; cdecl;
function GetSendBatchResp(sMsgIDFile: PChar; nPos: Integer; rSendBatchResp: PSendBatchResp): Integer; cdecl;
function CMPPQuery(sDate: pchar; nQueryType: integer; sServiceid: pchar; rQueryResp: PQueryResp): integer; cdecl;
function CMPPAnalyzeStatusReport(sContent: pchar; sTime: pchar; sSmcNo: pchar; var nMSGID: integer; sStat: pchar; sSubmitTime: pchar;
sDoneTime: pchar; sDestTermID: pchar; var nSMCSequence: integer): integer; cdecl;
implementation
function CMPPAnalyzeStatusReport; external 'CMPPAPI.DLL' name 'CMPPAnalyzeStatusReport';
function CMPPQuery; external 'CMPPAPI.DLL' name 'CMPPQuery';
function InitCMPPAPI; external 'CMPPAPI.dll' name 'InitCMPPAPI';
function CMPPSendSingle; external 'CMPPAPI.dll' name 'CMPPSendSingle';
function CMMPActiveTest; external 'CMPPAPI.dll' name 'CMMPActiveTest';
function CMPPDeliver; external 'CMPPAPI.dll' name 'CMPPDeliver';
function CMPPSetKey; external 'CMPPAPI.dll' name 'CMPPSetKey';
{function CMMPGetSMStatus; external 'CMPPAPI.dll' name 'CMMPGetSMStatus';}
function CMPPCancel; external 'CMPPAPI.dll' name 'CMPPCancel';
function CMPPSendBatch; external 'CMPPAPI.dll' name 'CMPPSendBatch';
function GetSendBatchResp; external 'CMPPAPI.dll' name 'GetSendBatchResp';
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -