namespace AsiaINFO.SMS.CMPP2
|
{
|
using System;
|
using System.Text;
|
|
public class CMPP_Msg_Content
|
{
|
private string _Dest_terminal_Id;
|
private string _Done_time;
|
private string _Msg_Id;
|
private uint _SMSC_sequence;
|
private string _Stat;
|
private string _Submit_time;
|
public const int BodyLength = 60;
|
|
public CMPP_Msg_Content(byte[] bytes)
|
{
|
if (bytes.Length >= 60)
|
{
|
int srcOffset = 0;
|
byte[] dst = new byte[8];
|
Buffer.BlockCopy(bytes, srcOffset, dst, 0, dst.Length);
|
this._Msg_Id = BitConverter.ToString(dst);
|
srcOffset += 8;
|
dst = new byte[7];
|
Buffer.BlockCopy(bytes, srcOffset, dst, 0, dst.Length);
|
this._Stat = Encoding.ASCII.GetString(dst);
|
srcOffset += 7;
|
dst = new byte[10];
|
Buffer.BlockCopy(bytes, srcOffset, dst, 0, dst.Length);
|
this._Submit_time = Encoding.ASCII.GetString(dst);
|
srcOffset += 10;
|
dst = new byte[10];
|
Buffer.BlockCopy(bytes, srcOffset, dst, 0, dst.Length);
|
this._Submit_time = Encoding.ASCII.GetString(dst);
|
srcOffset += 10;
|
dst = new byte[(bytes.Length - srcOffset) - 4];
|
Buffer.BlockCopy(bytes, srcOffset, dst, 0, dst.Length);
|
string str = Encoding.ASCII.GetString(dst).Trim();
|
if (str.IndexOf('\0') > 0)
|
{
|
str = str.Substring(0, str.IndexOf('\0'));
|
}
|
if (((str != null) && (str.Length > 11)) && (str.Substring(0, 2) == "86"))
|
{
|
str = str.Substring(2, str.Length - 2);
|
}
|
this._Dest_terminal_Id = str;
|
srcOffset += dst.Length;
|
dst = new byte[4];
|
Buffer.BlockCopy(bytes, srcOffset, dst, 0, dst.Length);
|
Array.Reverse(dst);
|
this._SMSC_sequence = BitConverter.ToUInt32(dst, 0);
|
}
|
}
|
|
public override string ToString()
|
{
|
return string.Format("[\r\nMessageBody:\r\n\tBodyLength: {0}\r\n\tDest_terminal_Id: {1}\r\n\tDone_time: {2}\r\n\tMsg_Id: {3}\r\n\tSMSC_sequence: {4}\r\n\tStat: {5}\r\n\tSubmit_time: {6}\r\n]", new object[] { 60, this._Dest_terminal_Id, this._Done_time, this._Msg_Id, this._SMSC_sequence, this._Stat, this._Submit_time });
|
}
|
|
public string Dest_terminal_Id
|
{
|
get
|
{
|
return this._Dest_terminal_Id;
|
}
|
}
|
|
public string Done_time
|
{
|
get
|
{
|
return this._Done_time;
|
}
|
}
|
|
public string Msg_Id
|
{
|
get
|
{
|
return this._Msg_Id;
|
}
|
}
|
|
public uint SMSC_sequence
|
{
|
get
|
{
|
return this._SMSC_sequence;
|
}
|
}
|
|
public string Stat
|
{
|
get
|
{
|
return this._Stat;
|
}
|
}
|
|
public string Submit_time
|
{
|
get
|
{
|
return this._Submit_time;
|
}
|
}
|
}
|
}
|