示例#1
0
 public CMPP_MSG_CONNECT(uint sequence)
 {
     header            = new CMPP_MSG_Header(CMPP_COMMAND_ID.CMPP_CONNECT);
     header.SequenceId = sequence;
     header.MSGLength  = (uint)(this.BodyLength + CMPP_MSG_Header.HeaderLength);
     body = new byte[this.BodyLength];
 }
示例#2
0
        public CMPP_MSG_QUERY_RESP(byte[] bs)
        {
            header = new CMPP_MSG_Header(bs);
            int index = CMPP_MSG_Header.HeaderLength;

            _time           = BitConverter.ToString(bs, index, 8);
            index           = index + 8;
            this._queryType = bs[index++];
            this._queryCode = BitConverter.ToString(bs, index, 10);
            index           = index + 10;
            this._MT_TLMsg  = BIConvert.Bytes2UInt(bs, index);
            index           = index + 4;
            this._MT_Tlusr  = BIConvert.Bytes2UInt(bs, index);
            index           = index + 4;
            this._MT_Scs    = BIConvert.Bytes2UInt(bs, index);
            index           = index + 4;
            this._MT_WT     = BIConvert.Bytes2UInt(bs, index);
            index           = index + 4;
            this._MT_FL     = BIConvert.Bytes2UInt(bs, index);
            index           = index + 4;
            this._MO_Scs    = BIConvert.Bytes2UInt(bs, index);
            index           = index + 4;
            this._MO_WT     = BIConvert.Bytes2UInt(bs, index);
            index           = index + 4;
            this._MO_FL     = BIConvert.Bytes2UInt(bs, index);
        }
示例#3
0
 public CMPP_MSG_CANCEL_RESP(byte[] bs)
 {
     header = new CMPP_MSG_Header(bs);
     if (bs[CMPP_MSG_Header.HeaderLength] == 0)
     {
         this._Suceeid = false;
     }
     else
     {
         this._Suceeid = true;
     }
 }
示例#4
0
        private void init()
        {
            int index = 0;

            byte[] temp = new byte[CMPP_MSG_Header.HeaderLength];
            for (int i = 0; i < CMPP_MSG_Header.HeaderLength; i++)
            {
                temp[i] = initValue[i];
                index   = i;
            }
            index += 1;//指到正确位置
            header = new CMPP_MSG_Header(temp);
            for (int i = 0; i < 8; i++)
            {
                Msg_Id[i] = initValue[index + i];
            }
            BIConvert.DumpBytes(Msg_Id, "C:\\Submit_resp_MsgID.txt");
        }
示例#5
0
        public CMPP_MSG_CONNECT_RESP(byte[] bs)
        {
            byte[] temp_head = new Byte[CMPP_MSG_Header.HeaderLength];
            int    index     = 0;

            for (int i = 0; i < CMPP_MSG_Header.HeaderLength; i++)
            {
                temp_head[i] = bs[index++];
            }
            header            = new CMPP_MSG_Header(temp_head);
            Status            = bs[index++];  //状态字节
            AuthenticatorISMG = new byte[16]; //回应摘要
            for (int i = 0; i < AuthenticatorISMG.Length; i++)
            {
                AuthenticatorISMG[i] = bs[index++];
            }
            _Version = bs[index++];
        }
示例#6
0
 public CMPP_MSG_CONNECT(byte[] bs)
 {
     initValue = new byte[bs.Length];
     bs.CopyTo(initValue, 0); //进行初始化行为
     byte[] temp = new byte[CMPP_MSG_Header.HeaderLength];
     for (int i = 0; i < temp.Length; i++)
     {
         temp[i] = bs[i];
     }
     byte[] body = new Byte[bs.Length - CMPP_MSG_Header.HeaderLength];
     for (int i = 0; i < body.Length; i++)
     {
         body[i] = bs[CMPP_MSG_Header.HeaderLength + i]; //将消息的字节存储
     }
     header            = new CMPP_MSG_Header(temp);      //构造 消息头
     header.MSGLength  = (uint)(this.BodyLength + CMPP_MSG_Header.HeaderLength);
     header.Command_ID = (uint)CMPP_COMMAND_ID.CMPP_CONNECT;
 }
示例#7
0
 public CMPP_MSG_QUERY(uint sequence)
 {
     header            = new CMPP_MSG_Header(CMPP_COMMAND_ID.CMPP_QUERY);
     header.SequenceId = sequence;
 }
示例#8
0
        UInt64 _MsgID;    //返回的消息ID


        public CMPP_MSG_SUBMIT(uint sequence)
        {
            header            = new CMPP_MSG_Header(CMPP_COMMAND_ID.CMPP_SUBMIT);
            header.SequenceId = sequence;
        }
示例#9
0
 public CMPP_MSG_TERMINATE_RESP(uint sequence)
 {
     header            = new CMPP_MSG_Header(CMPP_COMMAND_ID.CMPP_TERMINATE_RESP);
     header.MSGLength  = (uint)CMPP_MSG_Header.HeaderLength;
     header.SequenceId = sequence;
 }
示例#10
0
 public CMPP_MSG_TERMINATE_RESP(byte[] bs)
 {
     header = new CMPP_MSG_Header(bs);
 }
示例#11
0
 public CMPP_MSG_TEST_RESP(byte[] bs)
 {
     header = new CMPP_MSG_Header(bs);
 }
示例#12
0
 public CMPP_MSG_TEST_RESP(uint sequence)
 {
     header            = new CMPP_MSG_Header(CMPP_COMMAND_ID.CMPP_ACTIVE_TEST_RESP);
     header.MSGLength  = (uint)(CMPP_MSG_Header.HeaderLength + 1);
     header.SequenceId = sequence;
 }
示例#13
0
 public CMPP_MSG_CANCEL(uint sequence)
 {
     header            = new CMPP_MSG_Header(CMPP_COMMAND_ID.CMPP_CANCEL);
     header.SequenceId = sequence;
     header.MSGLength  = (uint)(CMPP_MSG_Header.HeaderLength + 8);
 }
示例#14
0
 public CMPP_MSG_DELIVER_RESP(uint sequence)
 {
     header            = new CMPP_MSG_Header(CMPP_COMMAND_ID.CMPP_DELIVER_RESP);
     header.SequenceId = sequence;
     header.MSGLength  = (uint)CMPP_MSG_Header.HeaderLength + 8 + 1;
 }
示例#15
0
        public CMPP_MSG_DELIVER(byte[] bs)
        {
            header = new CMPP_MSG_Header(bs);
            int index = CMPP_MSG_Header.HeaderLength;

            this._msgid   = BitConverter.ToUInt64(bs, index);
            index        += 8;
            this._destid  = Encoding.ASCII.GetString(bs, index, 21);
            index         = index + 21;
            this._svccode = Encoding.ASCII.GetString(bs, index, 10);
            index         = index + 10;
            this._tpid    = (int)bs[index++];
            this._udhi    = (int)bs[index++];
            this._msgfmt  = (int)bs[index++];
            this._srctid  = Encoding.ASCII.GetString(bs, index, 21);
            index        += 21;
            if (bs[index++] == 1)
            {
                this._isReport = true;
            }
            else
            {
                this._isReport = false;
            }
            this._msglength = (int)bs[index++];
            if (!this._isReport)
            {
                switch (this._msgfmt)
                {
                case (int)Msg_Format.ASCII:
                    this._msg = Encoding.ASCII.GetString(bs, index, this._msglength);
                    index    += this._msglength;
                    break;

                case (int)Msg_Format.BINARY:
                    this._msg = Encoding.Default.GetString(bs, index, this._msglength);
                    index    += this._msglength;
                    break;

                case (int)Msg_Format.GB2312:
                    this._msg = Encoding.Default.GetString(bs, index, this._msglength);
                    index    += this._msglength;
                    break;

                case (int)Msg_Format.UCS2:
                    this._msg = Encoding.BigEndianUnicode.GetString(bs, index, this._msglength);
                    index    += this._msglength;
                    break;

                default:
                    break;
                }
            }
            else
            {//状态报告
                this._reportForMsgid = BitConverter.ToUInt64(bs, index);
                index              += 8;
                this._reportState   = BitConverter.ToString(bs, index, 7);
                index              += 7;
                this._submitTime    = BitConverter.ToString(bs, index, 10);
                index              += 10;
                this._doneTime      = BitConverter.ToString(bs, index, 10);
                index              += 10;
                this._reportDesttid = BitConverter.ToString(bs, index, 21);
                index              += 21;
                this._smscSequence  = (int)BIConvert.Bytes2UInt(bs, index);
            }
        }