示例#1
0
        /// <summary> Called to return the PDU for this type of object </summary>
        /// <returns> A byte array </returns>
        public byte[] GetPDU()
        {
            if (UserData.Headers.Count > 0)
            {
                EsmClass |= 0x40;
            }

            SmppBuffer tmpBuff = new SmppBuffer(DefaultEncoding, this);

            tmpBuff.AddCString(ServiceType);
            tmpBuff.AddByte(SourceTon);
            tmpBuff.AddByte(SourceNpi);
            tmpBuff.AddCString(SourceAddr);
            tmpBuff.AddDestinationAddresses(DestinationAddresses);
            tmpBuff.AddByte(EsmClass);
            tmpBuff.AddByte(ProtocolId);
            tmpBuff.AddByte(PriorityFlag);
            tmpBuff.AddTimeString(ScheduleDeliveryTime, 17);
            tmpBuff.AddTimeString(ValidityPeriod, 17);
            tmpBuff.AddByte(RegisteredDelivery);
            tmpBuff.AddByte(ReplaceIfPresent);
            tmpBuff.AddByte(Convert.ToByte(DataCoding));
            tmpBuff.AddByte(DefaultMsgId);
            tmpBuff.AddUserData(UserData);
            tmpBuff.AddTLVCollection(Optional);

            tmpBuff.AddFinalLength();

            return(tmpBuff.Buffer);
        }