📄 datastrucclass.~pas
字号:
TCusJPCMSMGReport=packed record
MsgID:array[0..7] of char;
DestID:array[0..20] of char;
SerID:array[0..9] of char;
TP_pid:byte;
TP_udhi:byte;
MsgFmt:byte;
SrcTrmID:array[0..31] of char;
SrcTrmType:byte;
IsReport:byte;
MsgLen:byte;
ReportCon:TJPCMReportCon;
LinkID:array[0..19] of char;
end;
TJPCMSMGReport=packed record
MsgHead:TJPCMMsgHead;
MsgBody:TCusJPCMSMGReport;
end;
{移动ActiveTest}
TJPCMActiveTest=TJPCMMsgHead;
TCusJPCMActiveTestResp=packed record
Reserved:byte;
end;
TJPCMActiveTestResp=packed record
MsgHead:TJPCMMsgHead;
MsgBody:TCusJPCMActiveTestResp
end;
TJPZRActTestResp=TJPCMMsgHead;
{系统内部查询MO服务时使用命令}
TJPConnect=packed record
IP:string;
Port:Cardinal;
end;
{标准化联通数据结构}
CUStandardStru=class
public
class procedure Bind(var aBind:TJPCUBind);
class procedure CuSubmit(var aSubmit:TJPCUSMGSubmit;Buf:pchar);
class procedure CuDeliver(var aDeliver:TJPCUDeliver;Buf:pchar);
class procedure Report(var aReport:TJPCUReport);
class procedure CusReport(var aCusReport:TCusJPCUReport);
class procedure MsgHead(var aMsgHead:TJPCuMsgHead);
end;
{标准化移动数据结构}
CMStandardStru=class
public
class procedure htonlMsgHead(var aMsgHead:TJPCMMsgHead);
class procedure Bind(var aBind:TJPCMBind);
class procedure htonlBindResp(var aBindResp:TJPCMBindResp);
class procedure CMSubmit(var aSubmit:TJPCMSMGSubmit;Buf:pchar);overload;
class function CMSubmit(SendSub:TCMSendSubmit):TJPCMSMGSubmit;overload;
class procedure htonlSubmitResp(var aSubmitResp:TJPCMSMGSubmitResp);
class procedure htonlCusSubmitResp(var aCusSubmitResp:TCusJPCMSMGSubmitResp);
class procedure CMDeliver(var aDeliver:TJPCMSMGDeliver;Buf:pchar);
class procedure htonlDeliverResp(var aDeliverResp:TJPCMSMGDeliverResp);
class procedure htonlReportCon(var aReport:TJPCMReportCon);
class procedure Unbind(var aUnbind:TJPCMUnBind);
class procedure htonlUnbind(var aUnbindResp:TJPCMUnBindResp);
end;
implementation
uses IDDef;
class procedure CUStandardStru.Bind(var aBind:TJPCUBind);
begin
MsgHead(aBind.MsgHead);
end;
class procedure CUStandardStru.CuDeliver(var aDeliver: TJPCUDeliver;
Buf: pchar);
var
DelMsgConLen,DelMsgLen:Word;
begin
DelMsgConLen:=aDeliver.MsgBody.MsgLen;
MsgHead(aDeliver.MsgHead);
aDeliver.MsgBody.MsgLen:=htonl(aDeliver.MsgBody.MsgLen);
move(pointer(@aDeliver.MsgHead.MsgLen)^,pointer(@Buf[0])^,69);
move(pointer(@aDeliver.MsgBody.MsgCon[1])^,pointer(@Buf[69])^,DelMsgConLen);
move(pointer(@aDeliver.MsgBody.Reserve[0])^,pointer(@Buf[69+DelMsgConLen])^,8);
end;
class procedure CUStandardStru.CusReport(var aCusReport: TCusJPCUReport);
begin
with aCusReport.SubSeqNum do
begin
SourceNodeNo:=htonl(SourceNodeNo);
Time:=htonl(Time);
Count:=htonl(Count);
end;
end;
class procedure CUStandardStru.CuSubmit(var aSubmit: TJPCUSMGSubmit;Buf:pchar);
var
i:integer;
MsgLen,MsgConLen,PhonsCnt:integer;
begin
MsgLen:=aSubmit.MsgHead.MsgLen;
MsgConLen:=aSubmit.MsgBody.MsgLen;
PhonsCnt:=aSubmit.MsgBody.AcptPhoneCnt;
MsgHead(aSubmit.MsgHead);
aSubmit.MsgBody.MsgLen:=htonl(aSubmit.MsgBody.MsgLen);
Move(aSubmit,pointer(@Buf[0])^,63);
//手机号紧缩
for i:=0 to PhonsCnt-1 do
Move(pointer(@aSubmit.MsgBody.AcptPhoneNo[1+i*13])^,pointer(@buf[63+i*21])^,13);
Move(pointer(@aSubmit.MsgBody.CorpID)^,pointer(@buf[63+PhonsCnt*21])^,72);
Move(pointer(@aSubmit.MsgBody.MsgContent[1])^,pointer(@buf[63+PhonsCnt*21+72])^,MsgConLen);
Move(pointer(@aSubmit.MsgBody.Reserve[0])^,pointer(@buf[MsgLen-8])^,8);
end;
class procedure CUStandardStru.MsgHead(var aMsgHead: TJPCUMsgHead);
begin
with aMsgHead do
begin
MsgLen:=htonl(MsgLen);
ComID:=htonl(ComID);
SequenceNum.SourceNodeNo:=htonl(SequenceNum.SourceNodeNo);
SequenceNum.Time:=htonl(SequenceNum.Time);
SequenceNum.Count:=htonl(SequenceNum.Count);
end;
end;
{ CMStandardStru }
class procedure CMStandardStru.Bind(var aBind: TJPCMBind);
begin
htonlMsgHead(aBind.MsgHead);
//the body of the message
aBind.MsgBody.TimeStamp:=htonl(aBind.MsgBody.TimeStamp);
end;
class procedure CMStandardStru.CMDeliver(var aDeliver: TJPCMSMGDeliver;
Buf: pchar);
begin
Move(aDeliver,pointer(@Buf[0])^,89);
//移入Deliver内容
Move(pointer(@aDeliver.MsgBody.MsgCon[1])^,pointer(@Buf[89])^,aDeliver.MsgBody.MsgLen);
Move(pointer(@aDeliver.MsgBody.LinkID[0])^,pointer(@Buf[89+aDeliver.MsgBody.MsgLen])^,20);
end;
class procedure CMStandardStru.CMSubmit(var aSubmit: TJPCMSMGSubmit;Buf:pchar);
var
i:integer;
MsgLen:integer;
begin
MsgLen:=aSubmit.MsgHead.MsgLen;
htonlMsgHead(aSubmit.MsgHead);
Move(aSubmit,pointer(@Buf[0])^,141);
//手机号紧缩
for i:=0 to aSubmit.MsgBody.AcptPhoneCnt-1 do
Move(pointer(@aSubmit.MsgBody.AcptPhoneLst[1+i*13])^,pointer(@buf[141+i*32])^,13);
Move(pointer(@aSubmit.MsgBody.AcptPhoneNoType)^,pointer(@buf[141+aSubmit.MsgBody.AcptPhoneCnt*32])^,2);
Move(pointer(@aSubmit.MsgBody.MsgCon[1])^,pointer(@buf[141+aSubmit.MsgBody.AcptPhoneCnt*32+2])^,aSubmit.MsgBody.MsgLen);
Move(pointer(@aSubmit.MsgBody.LinkID[0])^,pointer(@buf[MsgLen-20])^,20);
end;
class procedure CMStandardStru.htonlMsgHead(var aMsgHead: TJPCMMsgHead);
begin
with aMsgHead do
begin
MsgLen:=htonl(MsgLen);
ComID:=htonl(ComID);
SeqNum:=htonl(SeqNum);
end;
end;
class procedure CMStandardStru.htonlBindResp(var aBindResp: TJPCMBindResp);
begin
htonlMsgHead(aBindResp.MsgHead);
with aBindResp.MsgBody do
begin
Status:=htonl(Status);
end;
end;
class procedure CMStandardStru.htonlSubmitResp(
var aSubmitResp: TJPCMSMGSubmitResp);
begin
htonlMsgHead(aSubmitResp.MsgHead);
with aSubmitResp.MsgBody do
begin
Result:=htonl(Result);
end;
end;
class procedure CMStandardStru.htonlDeliverResp(
var aDeliverResp: TJPCMSMGDeliverResp);
begin
htonlMsgHead(aDeliverResp.MsgHead);
with aDeliverResp.MsgBody do
begin
Result:=htonl(Result);
end;
end;
class procedure CMStandardStru.htonlUnbind(var aUnbindResp: TJPCMUnBindResp);
begin
htonlMsgHead(TJPCMMsgHead(aUnbindResp));
end;
class procedure CMStandardStru.Unbind(var aUnbind: TJPCMUnBind);
begin
htonlMsgHead(TJPCMMsgHead(aUnBind));
end;
class procedure CMStandardStru.htonlCusSubmitResp(
var aCusSubmitResp: TCusJPCMSMGSubmitResp);
begin
with aCusSubmitResp do
begin
Result:=htonl(Result);
end;
end;
class procedure CMStandardStru.htonlReportCon(var aReport: TJPCMReportCon);
begin
aReport.SMSCSeq:=htonl(aReport.SMSCSeq);
end;
class procedure CUStandardStru.Report(var aReport: TJPCUReport);
begin
MsgHead(aReport.MsgHead);
aReport.MsgHead.SequenceNum.SourceNodeNo:=htonl(aReport.MsgHead.SequenceNum.SourceNodeNo);
aReport.MsgHead.SequenceNum.Time:=htonl(aReport.MsgHead.SequenceNum.Time);
aReport.MsgHead.SequenceNum.Count:=htonl(aReport.MsgHead.SequenceNum.Count);
end;
class function CMStandardStru.CMSubmit(
SendSub: TCMSendSubmit): TJPCMSMGSubmit;
begin
with Result do
begin
FillChar(Result,Sizeof(Result),0);
MsgHead.MsgLen:=SendSub.MsgHead.MsgLen;
MsgHead.ComID:=SendSub.MsgHead.ComID;
MsgHead.SeqNum:=SendSub.MsgHead.SeqNum;
MsgBody.PKTotal:=SendSub.MsgBody.PKTotal;
MsgBody.PKNum:=SendSub.MsgBody.PKNum;
MsgBody.IsReport:=SendSub.MsgBody.IsReport;
MsgBody.MsgLevel:=SendSub.MsgBody.MsgLevel;
StrPCopy(MsgBody.SerID,SendSub.MsgBody.SerID);
MsgBody.FeeUserType:=SendSub.MsgBody.FeeUserType;
StrPCopy(MsgBody.FeeUser,SendSub.MsgBody.FeeUser);
MsgBody.FeeUserNoType:=SendSub.MsgBody.FeeUserNoType;
MsgBody.TP_PId:=SendSub.MsgBody.TP_PId;
MsgBody.TP_udhi:=SendSub.MsgBody.TP_udhi;
MsgBody.MsgFmt:=SendSub.MsgBody.MsgFmt;
StrPCopy(MsgBody.SendSPID,SendSub.MsgBody.SendSPID);
StrPCopy(MsgBody.FeeType,SendSub.MsgBody.FeeType);
StrPCopy(MsgBody.FeeVal,SendSub.MsgBody.FeeVal);
StrPCopy(MsgBody.ValidTime,SendSub.MsgBody.ValidTime);
StrPCopy(MsgBody.SendTime,SendSub.MsgBody.SendTime);
StrPCopy(MsgBody.SrcId,SendSub.MsgBody.SrcID);
MsgBody.AcptPhoneCnt:=SendSub.MsgBody.AcptPhoneCnt;
MsgBody.AcptPhoneLst:=SendSub.MsgBody.AcptPhoneLst;
MsgBody.AcptPhoneNoType:=SendSub.MsgBody.AcptPhoneNoType;
MsgBody.MsgLen:=SendSub.MsgBody.MsgLen;
MsgBody.MsgCon:=SendSub.MsgBody.MsgCon;
StrPCopy(MsgBody.LinkID,SendSub.MsgBody.LinkID);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -