以前写的.
unit SMEIExport;
{
********************************************************************************
API for the SMEIDLL
SMEIDLL for CMPP 2.0
converted by net_xray@hotmail.com
********************************************************************************
}
interface
uses
Windows;
{-FileName : Export.h }
{-Description : 本头文件定义了SMEIDLL提供的所有输出函数的定义。 }
{-Version : 2.0 }
{-Date : 98/11/01 }
{-Others : }
{-Function List : }
{-01. IFInitInterface :初始化动态库 }
{-02. IFSendAndAnswer :基本的发送等待回包函数 }
{-03. IFSetOnRead :设置读回调函数,用于处理非回包数据 }
{-04. IFSetOnError :设置出错回调函数,用于通知上层 }
{-05. IFExitInterface :退出动态库函数 }
{-06. Login :登录函数,使用TRANSMITER命令 }
{-07. Logout :从短讯中心注销 }
{-08. SubmitSM :提交短讯 }
{-09. VPSubmitSM :提交短讯,简化函数 }
{-10. QuerySMStatus :查询短讯状态 }
{-11. QuerySMDetail :查询短讯详细属性,可查询短讯内容 }
{-12. QuerySMS :查询满足条件的短讯 }
{-13. CancelSM :取消短讯 }
{-14. ReplaceSM :替换短讯 }
{-15. AddSubscriber :添加用户 }
{-16. DeleteSubscriber :删除用户 }
{-17. ModifySubscriber :修改用户属性 }
{-18. EnquireSubscriber :查询用户属性 }
{-19. HasDeliverMessage :查询是否有下发短讯 }
{-20. GetDeliverSM :取下发短讯 }
{-21. Login_R :登录函数,使用RECEIVER命令 }
{-22. VPModifySubPassword :修改用户密码 }
{-23. GetErrorString :查询错误代码的描述 }
{-24. SubmitA :增强的SUBMIT函数 }
{-25. VPSubmitA :增强的SUBMIT函数的VP版 }
{-26. GSMConvertTextToData :把ASC字符串变换成指定编码 }
{-27. GSMConvertDataToText :把编码数据变换成ASC字符串 }
{-28. QuerySub }
const
DLL = 'smeidll.dll';
IF_TIMEOUT = 5000;
{//发送超时时间}
{///最大的短消息文本长度为255*140=35700 }
MAX_SMSIZE = 35700;
{//最大短讯长度}
ACK_SUCCESS = 0;
{//ACK执行正确}
SM_PRI_PRIOR = 1;
{//优先级别}
SM_PRI_DEFAULT = 0;
{//缺省}
SM_DCS_DEFAULT = $00;
{//缺省(7位)}
SM_DCS_ASC = $04;
{//英文(不被手机支持)}
SM_DCS_CHINA = $08;
{//中文(会被转化成UCS2)}
SM_UDHI_DEFAULT = 0;
{//UD是正常字符串}
SM_UDHI_STRUCTURE = 1;
{//UD是结构}
CHINA_ERRSTR = $40000000;
{//返回汉字的错误字符串}
SMSCERR_begin
= 10000;
type
TAckMsg = packed record
end;
TDLL_RETURN = array [0..75] of string;
function IFInitInterface(dwCodeProtocol: LongInt;
dwDriverProtocol: LongInt;
const pDriverParam: PChar): Integer stdcall;
external DLL;
{LPCTSTR --> PChar}
//pDriverParam : 'IP地址 端口号 超时时间'
function IFSendAndAnswer(var pSndBuf: Pointer;
SndSize: Integer;
var pRevBuf: Pointer;
var RevSize: Integer;
timeout: LongInt): Integer stdcall;
external DLL;
{LPVOID --> Pointer}
// function IFSetOnRead(var pReadFun: _READ_BACK;
// hReadUser: THandle): Bool stdcall external DLL;
// function IFSetOnError(var pErrorFun: _ERROR_BACK;
// hErrorUser: THandle): Bool stdcall external DLL;
function IFExitInterface:Bool stdcall;
external DLL;
function LoginA(ulBindType: LongInt;
const SystemID: PChar;
const Password: PChar;
const system_type: PChar;
ulInterface_version: LongInt;
ucAddr_TON: Byte;
ucAddr_NPI: Byte;
const Address_range: PChar): Bool stdcall;
external DLL;
function Login( const SystemID: PChar;
const Password: PChar): Bool stdcall;
external DLL;
function Login_R(const SystemID: PChar;
const Password: PChar): integer stdcall;
external DLL;
function Logout: Bool stdcall;
external DLL;
function EnquireLink: Integer stdcall;
external DLL;
function HasDeliverMessage(dwTimeOut: LongInt): Integer stdcall;
external DLL;
function SubmitA(OrgTON : Byte;
OrgNPI : Byte;
const OrgAddr : PChar;
DestTON : Byte;
DestNPI : Byte;
const DestAddr: PChar;
PRI : Byte;
RD : Byte;
RP : Byte;
SRR : Byte;
MR : Byte;
DCS : Byte;
PID : Byte;
const Schedule : PChar;
const Expire : PChar;
Default_ID : LongInt;
UDHI : Byte;
UDLen : LongInt;
const UserData : PChar;
SM_ID : PLongInt;
FCS : PChar): Integer stdcall;
external DLL;
function SubmitAExEx( OrgTON: Byte;
OrgNPI: Byte;
const OrgAddr: PChar;
DestTON: Byte;
DestNPI: Byte;
const DestAddr: PChar;
PRI: Byte;
RD: Byte;
RP: Byte;
SRR: Byte;
MR: Byte;
DCS: Byte;
PID: Byte;
const Schedule: PChar;
const Expire: PChar;
Default_ID: LongInt;
UDHI: Byte;
UDLen: LongInt;
const UserData: PChar;
const sServiceType: PChar;
byMsgID: PByte;
byPKTotal: Byte;
byPKNumber: Byte;
byMsglevel: Byte;
byFeeUserType: Byte;
const sSPID: PChar;
const sFeeType: PChar;
const sFeeAddr: PChar;
const sFeeCode: PChar;
byUserNum: Byte;
const sDestAddrs: PChar;
SM_ID: PLongInt;
FCS: PByte ): Integer stdcall;
external DLL Name 'SubmitAExEx';
function GSMConvertTextToData( const pString: PChar;
nDCS: PByte;
pData: PByte;
nLen: LongInt): Integer stdcall;
external DLL;
function GSMConvertDataToText( pData: PByte;
nLen: LongInt;
nDCS: Byte;
nUDHI: Byte;
pString: PChar): Integer stdcall;
external DLL;
function GetDeliverSMExEx(sm_ID: PLongInt;
DestTON: PByte;
DestNPI: PByte;
DestAddr: PChar;
OrgTON: PByte;
OrgNPI: PByte;
OrgAddr: PChar;
PRI: PByte;
RP: PByte;
UDHI: PByte;
PID: PByte;
DCS: PByte;
TimeStamp: PChar;
UDLen: PLongInt;
UserData: PChar;
StatusReport: PByte): Integer stdcall;
external DLL;
function QuerySMStatusA(SM_ID: LongInt;
OrgTON: Byte;
OrgNPI: Byte;
const OrgAddr: PChar;
DestTON: PByte;
DestNPI: PByte;
DestAddr: PChar;
Final_data: PChar;
SM_Status: PByte;
Error_Code: PByte): Integer stdcall;
external DLL;
function CancelSMA(cService_type : Char;
SM_ID : LongInt;
OrgTON : Byte;
OrgNPI : Byte;
OrgAddr : PChar;
DestTON : Byte;
DestNPI : Byte;
DestAddr : PChar): Integer stdcall;
external DLL;
function GetDeliverSMEx(sm_ID : PLongInt;
DestTON : PByte;
DestNPI : PByte;
DestAddr : PChar;
OrgTON : PByte;
OrgNPI : PByte;
OrgAddr : PChar;
PRI : PByte;
RP : PByte;
UDHI : PByte;
PID : PByte;
DCS : PByte;
TimeStamp : PChar;
UDLen : PLongInt;
UserData : PChar): Integer stdcall;
external DLL;
function GetDeliverSMExExEx(sm_ID : PLongInt;
DestTON : PByte;
DestNPI : PByte;
DestAddr : PChar;
OrgTON : PByte;
OrgNPI : PByte;
OrgAddr : PChar;
PRI : PByte;
RP : PByte;
UDHI : PByte;
PID : PByte;
DCS : PByte;
TimeStamp : PChar;
UDLen : PLongInt;
UserData : PChar;
StatusReport : PByte;
sMsgID : PByte;
sSubmitdate : PChar;
sDonedate : PChar;
sStatus : PChar): Integer stdcall;
external DLL;
const
DLL_RETURN : TDLL_RETURN = (
'E_SUCCESS = 成功',
'E_NOT_INITIALIZED = INTERFACE没有初始化',
'E_ACK_COMMAND_ERROR = 回包命令字错误',
'E_NEWMEMORY_ERROR = 分配内存错误',
'E_OTHER_ERROR = 其他错误',
'E_SA_BUFF_TOOBIG = SEND缓冲区太大',
'E_SA_POCKET_UNINTEGRATE = SEND包不完整',
'E_SA_PROTOCOL_ERROR = 协议错',
'E_SA_PROTOCOL_NO_SUPPORT = 协议不支持该格式',
'E_SA_CODE_OTHER_ERROR = 编码其他错误',
'E_SA_TIMEOUT = 传送超时',
'E_SA_NO_ENOUGH_BUFFER = 接收缓冲区不够大',
'E_SA_WAITFAILED = 等待失败',
'E_SA_SEND_FAILED = 发送失败',
'E_SUBMIT_ORGADDR_ERROR = 源地址错误',
'E_SUBMIT_DESTADDR_ERROR = 目的地址错误',
'E_SUBMIT_SCHEDULE_ERROR = 参数定时时间错误',
'E_SUBMIT_EXPIRE_ERROR = 参数超时时间错误',
'E_SUBMIT_DCS_ERROR = 参数DCS错误',
'E_SUBMIT_DCS_CONVERT_ERROR = 数据变换错误',
'E_SUBMIT_UDHI_ERROR = 参数UDHI错误',
'E_SUBMIT_UD_ERROR = 用户数据错误',
'E_SUBMIT_OVER_MO = 超过最大提交数',
'E_SUBMIT_OVER_MT = 超过最大下发数',
'E_SUBMIT_INVALID_USER = 无效用户,或者用户无权',
'E_SUBMIT_INVALID_DATA_FORMAT = 无效数据格式',
'E_SUBMIT_ADDR_ERROR = 地址错误',
'E_SUBMIT_CREATE_MESSAGE_ERROR = 生成短讯错误',
'E_QUERYSMSTATUS_SM_NOT_EXIST = 短讯不存在',
'E_QUERYSMSTATUS_SM_OTHER_ERR = 查询其他错误',
'E_QUERYSMSTATUS_ADDR_ERROR = 地址错误',
'E_QUERYSMDETAIL_SM_DETAILS_ZERO = 查询不到此',
'E_QUERYSMDETAIL_SM_DETAILS_FAIL = 查询失败',
'E_QUERYSMDETAIL_CONVERT_ERROR = 用户数据编码出错',
'E_QUERYSMDETAIL_LEN_ERROR = LEN参数出错',
'E_QUERYSMDETAIL_SM_ADDR_ERROR = 地址错误',
'E_CANCELSM_ACK_STATUS_ERROR = 回包的STATUS指示出错',
'E_REPLACESM_ORGADDR_ERROR = 源地址错误',
'E_REPLACESM_SCHEDULE_ERROR = 定时数据错误',
'E_REPLACESM_EXPIRE_ERROR = 超时数据错误',
'E_REPLACESM_DCS_ERROR = DCS错误',
'E_REPLACESM_DCS_CONVERT_ERROR = 用户数据编码出错',
'E_REPLACESM_UD_ERROR = 用户数据错误',
'E_REPLACESM_SM_WORKING = 短讯正在下发',
'E_REPLACESM_SM_ADDR_ERROR = 短讯地址错误',
'E_REPLACESM_SM_INVALID_SOURCE_ADDR = 无效的源地址',
'E_REPLACESM_SM_NO_SUCH_SM = 没有指定的短讯',
'E_REPLACESM_SM_INVALID_DATA_TYPE = 无效数据类型',
'E_REPLACESM_SM_FAIL = 替换失败',
'E_QUERYSMS_DIR_ERROR = 参数DIR错',
'E_QUERYSMS_ADDR_ERROR = 参数用户地址错误',
'E_QUERYSMS_DATETIME_ERROR = 参数开始时间错误',
'E_QUERYSMS_FINATIME_ERROR = 参数结束时间错误',
'E_QUERYSMS_NUMBER_ERROR = 参数查询条数错误',
'E_QUERYSMS_ACK_STATUS_ERROR = 回包的STATUS指示出错',
'E_ADDSUB_SUBID_ERROR = 参数用户号码错误',
'E_ADDSUB_SUBNAME_ERROR = 参数用户姓名错误',
'E_ADDSUB_SUBADDRESS_ERROR = 参数用户地址错误',
'E_ADDSUB_PASSWORD_ERROR = 参数用户密码错误',
'E_ADDSUB_USER_ALREADY_EXIST = 用户已经存在',
'E_ADDSUB_ADD_USER_FAIL = 添加用户失败',
'E_DELETESUB_SUBID_ERROR = 参数用户号码错误',
'E_DELETESUB_USER_NOT_EXIST = 用户不存在',
'E_DELETESUB_USER_DEL_FAIL = 删除用户失败',
'E_MODIFYSUB_SUBID_ERROR = 参数用户号码错误',
'E_MODIFUSUB_SUBNAME_ERROR = 参数用户姓名错误',
'E_MODIFYSUB_SUBADDRESS_ERROR = 参数用户地址错误',
'E_MODIFYSUB_PASSWORD_ERROR = 参数用户密码错误',
'E_MODIFYSUB_FAIL = 修改用户失败',
'E_MODIFYSUB_SUB_NOT_EXIST = 用户不存在',
'E_ENQUIRESUB_SUBID_ERROR = 参数用户号码错误',
'E_ENQUIRESUB_USER_NOT_EXIST = 用户不存在',
'E_ENQUIRELINK_ERROR = 握手失败',
'E_DLVSM_GETDATA_FAILED = GETDATA失败',
'E_DLVSM_DCS_ERROR = 解码出错',
'E_NO_RIGHT = 没有权限');
implementation
end.