protected override void AppendPduData(ArrayList pdu)
 {
     pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(MessageId)));
     pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(FinalDate)));
     pdu.Add((byte)MessageStatus);
     pdu.Add(ErrorCode);
 }
 protected override void AppendPduData(ArrayList pdu)
 {
     pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(MessageId)));
     pdu.Add((byte)SourceAddressTon);
     pdu.Add((byte)SourceAddressNpi);
     pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(SourceAddress)));
 }
Exemple #3
0
        protected override void AppendPduData(ArrayList pdu)
        {
            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(ServiceType)));
            pdu.Add((byte)SourceAddressTon);
            pdu.Add((byte)SourceAddressNpi);
            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(SourceAddress)));
            //number of destinations.
            pdu.Add(NumberOfDestinations);

            //and their addresses
            foreach (DestinationAddress address in _destinationAddresses)
            {
                if (!address.IsDistributionList)
                {
                    //pack up the byte array for this address
                    ArrayList sme = new ArrayList();
                    pdu.Add((byte)0x01);
                    pdu.Add((byte)address.DestinationAddressTon);
                    pdu.Add((byte)address.DestinationAddressNpi);
                    pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(
                                     Encoding.ASCII.GetBytes(address.DestAddress)));
                }
                else
                {
                    ArrayList dln = new ArrayList();
                    pdu.Add((byte)0x02);
                    pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(
                                     Encoding.ASCII.GetBytes(address.DistributionList)));
                }
            }

            pdu.AddRange(base.GetBytesAfterDestination());
        }
Exemple #4
0
        /// <summary>
        /// Creates the bytes after the destination address bytes.  This also inserts the TLV
        /// table data.  Common to both submit and submit multiple.
        /// </summary>
        /// <returns>The bytes in the Pdu before the destination address(es).</returns>
        protected ArrayList GetBytesAfterDestination()
        {
            ArrayList pdu = new ArrayList();

            pdu.Add(EsmClass);
            pdu.Add((byte)ProtocolId);
            pdu.Add((byte)PriorityFlag);
            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(ScheduleDeliveryTime)));
            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(ValidityPeriod)));
            pdu.Add((byte)RegisteredDelivery);

            if (ReplaceIfPresentFlag == true)
            {
                pdu.Add((byte)0x01);
            }
            else
            {
                pdu.Add((byte)0x00);
            }

            pdu.Add((byte)DataCoding);
            pdu.Add(SmDefaultMessageId);
            _SmLength = PduUtil.InsertShortMessage(pdu, ShortMessage);

            pdu.TrimToSize();

            return(pdu);
        }
Exemple #5
0
 /// <summary>
 /// Decodes the bind response from the SMSC.
 /// </summary>
 protected override void DecodeSmscResponse()
 {
     byte[] remainder = BytesAfterHeader;
     SystemId = SmppStringUtil.GetCStringFromBody(ref remainder);
     //fill the TLV table if applicable
     TranslateTlvDataIntoTable(remainder);
 }
Exemple #6
0
        ///<summary>
        /// Gets the hex encoding(big-endian)of this Pdu.
        ///</summary>
        ///<return>The hex-encoded version of the Pdu</return>
        public override void ToMsbHexEncoding()
        {
            ArrayList pdu = GetPduHeader();

            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(ServiceType)));
            pdu.Add((byte)SourceAddressTon);
            pdu.Add((byte)SourceAddressNpi);
            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(SourceAddress)));
            pdu.Add((byte)DestinationAddressTon);
            pdu.Add((byte)DestinationAddressNpi);
            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(DestinationAddress)));
            pdu.Add(EsmClass);
            pdu.Add((byte)ProtocolId);
            pdu.Add((byte)PriorityFlag);
            //schedule_delivery_time and validity_period are null, so set them to zero
            pdu.Add((byte)0);
            pdu.Add((byte)0);
            pdu.Add((byte)RegisteredDelivery);
            //replace_if_present is always null, so set it to zero
            pdu.Add((byte)0);
            pdu.Add((byte)DataCoding);
            //sm_default_msg_id is always null, so set it to zero
            pdu.Add((byte)0);
            _SmLength = PduUtil.InsertShortMessage(pdu, ShortMessage);

            PacketBytes = EncodePduForTransmission(pdu);
        }
 /// <summary>
 /// Decodes the non-TLV bytes.  Needed for the submit_multi_resp.
 /// </summary>
 protected void DecodeNonTlv()
 {
     //header
     byte[] remainder = BytesAfterHeader;
     MessageId           = SmppStringUtil.GetCStringFromBody(ref remainder);
     _ResponseAfterMsgId = remainder;
 }
Exemple #8
0
        ///<summary>
        /// Gets the hex encoding(big-endian)of this Pdu.
        ///</summary>
        ///<return>The hex-encoded version of the Pdu</return>
        public override void ToMsbHexEncoding()
        {
            ArrayList pdu = GetPduHeader();

            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(SystemId)));
            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(Password)));
            PacketBytes = EncodePduForTransmission(pdu);
        }
Exemple #9
0
        ///<summary>
        /// Gets the hex encoding(big-endian)of this Pdu.
        ///</summary>
        ///<return>The hex-encoded version of the Pdu</return>
        public override void ToMsbHexEncoding()
        {
            ArrayList pdu = GetPduHeader();

            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(MessageId)));
            pdu.Add((byte)SourceAddressTon);
            pdu.Add((byte)SourceAddressNpi);
            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(SourceAddress)));
            PacketBytes = EncodePduForTransmission(pdu);
        }
Exemple #10
0
        /// <summary>
        /// This decodes the query_sm Pdu.
        /// </summary>
        protected override void DecodeSmscResponse()
        {
            byte[] remainder = BytesAfterHeader;
            MessageId        = SmppStringUtil.GetCStringFromBody(ref remainder);
            SourceAddressTon = (TonType)remainder[0];
            SourceAddressNpi = (NpiType)remainder[1];
            SourceAddress    = SmppStringUtil.GetCStringFromBody(ref remainder, 2);

            TranslateTlvDataIntoTable(remainder);
        }
 protected override void AppendPduData(ArrayList pdu)
 {
     pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(SystemId)));
     pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(Password)));
     pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(SystemType)));
     pdu.Add((byte)InterfaceVersion);
     pdu.Add((byte)AddressTon);
     pdu.Add((byte)AddressNpi);
     pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(AddressRange)));
 }
 /// <summary>
 /// Decodes the query_sm response from the SMSC.
 /// </summary>
 protected override void DecodeSmscResponse()
 {
     byte[] remainder = BytesAfterHeader;
     MessageId     = SmppStringUtil.GetCStringFromBody(ref remainder);
     FinalDate     = SmppStringUtil.GetCStringFromBody(ref remainder);
     MessageStatus = (MessageStateType)remainder[0];
     ErrorCode     = remainder[1];
     //fill the TLV table if applicable
     TranslateTlvDataIntoTable(remainder, 2);
 }
Exemple #13
0
        ///<summary>
        /// Gets the hex encoding(big-endian)of this Pdu.
        ///</summary>
        ///<return>The hex-encoded version of the Pdu</return>
        public override void ToMsbHexEncoding()
        {
            ArrayList pdu = GetPduHeader();

            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(MessageId)));
            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(FinalDate)));
            pdu.Add((byte)MessageStatus);
            pdu.Add(ErrorCode);

            PacketBytes = EncodePduForTransmission(pdu);
        }
 protected override void AppendPduData(ArrayList pdu)
 {
     pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(ServiceType)));
     pdu.Add((byte)SourceAddressTon);
     pdu.Add((byte)SourceAddressNpi);
     pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(SourceAddress)));
     pdu.Add((byte)DestinationAddressTon);
     pdu.Add((byte)DestinationAddressNpi);
     pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(DestinationAddress)));
     pdu.AddRange(GetBytesAfterDestination());
 }
Exemple #15
0
 /// <summary>
 /// Decodes the alert_notification from the SMSC.
 /// </summary>
 protected override void DecodeSmscResponse()
 {
     byte[] remainder = BytesAfterHeader;
     SourceAddressTon = (TonType)remainder[0];
     SourceAddressNpi = (NpiType)remainder[1];
     SourceAddress    = SmppStringUtil.GetCStringFromBody(ref remainder, 2);
     EsmeAddressTon   = (TonType)remainder[0];
     EsmeAddressNpi   = (NpiType)remainder[1];
     EsmeAddress      = SmppStringUtil.GetCStringFromBody(ref remainder, 2);
     //fill the TLV table if applicable
     TranslateTlvDataIntoTable(remainder);
 }
        protected override void AppendPduData(ArrayList pdu)
        {
            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(MessageId)));
            pdu.Add((byte)SourceAddressTon);
            pdu.Add((byte)SourceAddressNpi);
            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(SourceAddress)));
            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(ScheduleDeliveryTime)));
            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(ValidityPeriod)));
            pdu.Add((byte)RegisteredDelivery);
            pdu.Add(_SmDefaultMessageId);

            _SmLength = PduUtil.InsertShortMessage(pdu, DataCoding.SMSCDefault, ShortMessage);
        }
 /// <summary>
 /// This decodes the submit_sm Pdu.  The Pdu has basically the same format as
 /// the submit_sm Pdu, but in this case it is a response.
 /// </summary>
 protected override void DecodeSmscResponse()
 {
     byte[] remainder = BytesAfterHeader;
     BindType         = (SmppBind.BindingType)CommandId;
     SystemId         = SmppStringUtil.GetCStringFromBody(ref remainder);
     Password         = SmppStringUtil.GetCStringFromBody(ref remainder);
     SystemType       = SmppStringUtil.GetCStringFromBody(ref remainder);
     InterfaceVersion = (SmppVersionType)remainder[0];
     AddressTon       = (TonType)remainder[1];
     AddressNpi       = (NpiType)remainder[2];
     AddressRange     = SmppStringUtil.GetCStringFromBody(ref remainder, 3);
     TranslateTlvDataIntoTable(remainder);
 }
Exemple #18
0
        ///<summary>
        /// Gets the hex encoding(big-endian)of this Pdu.
        ///</summary>
        ///<return>The hex-encoded version of the Pdu</return>
        public override void ToMsbHexEncoding()
        {
            ArrayList pdu = GetPduHeader();

            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(SystemId)));
            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(Password)));
            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(SystemType)));
            pdu.Add((byte)InterfaceVersion);
            pdu.Add((byte)AddressTon);
            pdu.Add((byte)AddressNpi);
            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(AddressRange)));

            PacketBytes = EncodePduForTransmission(pdu);
        }
        /// <summary>
        /// This decodes the submit_sm Pdu.  The Pdu has basically the same format as
        /// the submit_sm Pdu, but in this case it is a response.
        /// </summary>
        protected override void DecodeSmscResponse()
        {
            byte[] remainder = BytesAfterHeader;
            MessageId            = SmppStringUtil.GetCStringFromBody(ref remainder);
            SourceAddressTon     = (TonType)remainder[0];
            SourceAddressNpi     = (NpiType)remainder[1];
            SourceAddress        = SmppStringUtil.GetCStringFromBody(ref remainder, 2);
            ScheduleDeliveryTime = SmppStringUtil.GetCStringFromBody(ref remainder);
            ValidityPeriod       = SmppStringUtil.GetCStringFromBody(ref remainder);
            RegisteredDelivery   = (RegisteredDeliveryType)remainder[0];
            SmDefaultMessageId   = remainder[1];
            _SmLength            = remainder[2];
            ShortMessage         = SmppStringUtil.GetStringFromBody(ref remainder, 3, 3 + _SmLength);

            TranslateTlvDataIntoTable(remainder);
        }
Exemple #20
0
        ///<summary>
        /// Gets the hex encoding(big-endian)of this Pdu.
        ///</summary>
        ///<return>The hex-encoded version of the Pdu</return>
        public override void ToMsbHexEncoding()
        {
            ArrayList pdu = GetPduHeader();

            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(ServiceType)));
            pdu.Add((byte)SourceAddressTon);
            pdu.Add((byte)SourceAddressNpi);
            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(SourceAddress)));
            pdu.Add((byte)DestinationAddressTon);
            pdu.Add((byte)DestinationAddressNpi);
            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(DestinationAddress)));
            pdu.Add(EsmClass);
            pdu.Add((byte)RegisteredDelivery);
            pdu.Add((byte)DataCoding);

            PacketBytes = EncodePduForTransmission(pdu);
        }
Exemple #21
0
        /// <summary>
        /// Generates the hex encoded bytes for a replace_sm Pdu.
        /// </summary>
        public override void ToMsbHexEncoding()
        {
            ArrayList pdu = GetPduHeader();

            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(MessageId)));
            pdu.Add((byte)SourceAddressTon);
            pdu.Add((byte)SourceAddressNpi);
            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(SourceAddress)));
            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(ScheduleDeliveryTime)));
            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(ValidityPeriod)));
            pdu.Add((byte)RegisteredDelivery);
            pdu.Add(_SmDefaultMessageId);

            _SmLength = PduUtil.InsertShortMessage(pdu, ShortMessage);

            PacketBytes = EncodePduForTransmission(pdu);
        }
        protected override void AppendPduData(ArrayList pdu)
        {
            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(MessageId)));
            pdu.Add(NumberUnsuccessful);
            //add the unsuccess addresses
            UnsuccessAddress[] unsuccessfulAddresses = UnsuccessfulAddresses;

            for (int i = 0; i < NumberUnsuccessful; i++)
            {
                pdu.Add((byte)unsuccessfulAddresses[i].DestinationAddressTon);
                pdu.Add((byte)unsuccessfulAddresses[i].DestinationAddressNpi);
                pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(
                                 Encoding.ASCII.GetBytes(unsuccessfulAddresses[i].DestinationAddress)));
                pdu.AddRange(BitConverter.GetBytes(
                                 UnsignedNumConverter.SwapByteOrdering(unsuccessfulAddresses[i].ErrorStatusCode)));
            }
        }
Exemple #23
0
        /// <summary>
        /// Decodes the submit_multi response from the SMSC.
        /// </summary>
        protected override void DecodeSmscResponse()
        {
            byte[] remainder = BytesAfterHeader;

            ServiceType      = SmppStringUtil.GetCStringFromBody(ref remainder);
            SourceAddressTon = (TonType)remainder[0];
            SourceAddressNpi = (NpiType)remainder[1];
            SourceAddress    = SmppStringUtil.GetCStringFromBody(ref remainder, 2);

            //the SMSC might not send back the number of destinations,
            //so check if it did
            if (remainder.Length > 0)
            {
                _numberOfDests       = remainder[0];
                DestinationAddresses = new DestinationAddress[NumberOfDestinations];

                //trim off the number of destinations
                long   length       = remainder.Length - 1;
                byte[] newRemainder = new byte[length];
                Array.Copy(remainder, 1, newRemainder, 0, length);
                remainder    = newRemainder;
                newRemainder = null;

                for (int i = 0; i < _destinationAddresses.Length; i++)
                {
                    _destinationAddresses[i] = new DestinationAddress(ref remainder);
                }
            }

            EsmClass             = remainder[0];
            ProtocolId           = remainder[1];
            PriorityFlag         = (PriorityType)remainder[2];
            ScheduleDeliveryTime = SmppStringUtil.GetCStringFromBody(ref remainder, 3);
            ValidityPeriod       = SmppStringUtil.GetCStringFromBody(ref remainder);
            RegisteredDelivery   = (RegisteredDeliveryType)remainder[0];
            ReplaceIfPresentFlag = (remainder[1] == 0)? false : true;
            DataCoding           = (DataCoding)remainder[2];
            SmDefaultMessageId   = remainder[3];
            _SmLength            = remainder[4];
            ShortMessage         = SmppStringUtil.GetStringFromBody(ref remainder, 5, 5 + _SmLength);

            //fill the TLV table if applicable
            TranslateTlvDataIntoTable(remainder);
        }
Exemple #24
0
        /// <summary>
        /// This decodes the cancel_sm Pdu.
        /// </summary>
        protected override void DecodeSmscResponse()
        {
                        #if DEBUG
            Console.WriteLine("In DecodeSmscResponse of EsmppDataSm");
                        #endif
            byte[] remainder = BytesAfterHeader;
            ServiceType           = SmppStringUtil.GetCStringFromBody(ref remainder);
            SourceAddressTon      = (TonType)remainder[0];
            SourceAddressNpi      = (NpiType)remainder[1];
            SourceAddress         = SmppStringUtil.GetCStringFromBody(ref remainder, 2);
            DestinationAddressTon = (TonType)remainder[0];
            DestinationAddressNpi = (NpiType)remainder[1];
            DestinationAddress    = SmppStringUtil.GetCStringFromBody(ref remainder, 2);
            EsmClass           = remainder[0];
            RegisteredDelivery = (RegisteredDeliveryType)remainder[1];
            DataCoding         = (DataCodingType)remainder[2];

            TranslateTlvDataIntoTable(remainder, 3);
        }
        /// <summary>
        /// Creates the byte encoding for this Pdu.
        /// </summary>
        public override void ToMsbHexEncoding()
        {
            ArrayList pdu = GetPduHeader();

            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(MessageId)));
            pdu.Add(NumberUnsuccessful);
            //add the unsuccess addresses
            UnsuccessAddress[] unsuccessfulAddresses = UnsuccessfulAddresses;

            for (int i = 0; i < NumberUnsuccessful; i++)
            {
                pdu.Add((byte)unsuccessfulAddresses[i].DestinationAddressTon);
                pdu.Add((byte)unsuccessfulAddresses[i].DestinationAddressNpi);
                pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(
                                 Encoding.ASCII.GetBytes(unsuccessfulAddresses[i].DestinationAddress)));
                pdu.AddRange(BitConverter.GetBytes(
                                 UnsignedNumConverter.SwapByteOrdering(unsuccessfulAddresses[i].ErrorStatusCode)));
            }
//
            PacketBytes = EncodePduForTransmission(pdu);
        }
Exemple #26
0
 protected override void AppendPduData(ArrayList pdu)
 {
     pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(ServiceType)));
     pdu.Add((byte)SourceAddressTon);
     pdu.Add((byte)SourceAddressNpi);
     pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(SourceAddress)));
     pdu.Add((byte)DestinationAddressTon);
     pdu.Add((byte)DestinationAddressNpi);
     pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(DestinationAddress)));
     pdu.Add(EsmClass);
     pdu.Add((byte)ProtocolId);
     pdu.Add((byte)PriorityFlag);
     pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(ScheduleDeliveryTime)));
     pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(ValidityPeriod)));
     pdu.Add((byte)RegisteredDelivery);
     //replace_if_present is always null, so set it to zero
     pdu.Add((byte)0);
     pdu.Add((byte)DataCoding);
     //sm_default_msg_id is always null, so set it to zero
     pdu.Add((byte)0);
     _smLength = PduUtil.InsertShortMessage(pdu, DataCoding, ShortMessage);
 }
Exemple #27
0
 /// <summary>
 /// This decodes the deliver_sm Pdu.  The Pdu has basically the same format as
 /// the submit_sm Pdu, but in this case it is a response.
 /// </summary>
 protected override void DecodeSmscResponse()
 {
     byte[] remainder = BytesAfterHeader;
     ServiceType           = SmppStringUtil.GetCStringFromBody(ref remainder);
     SourceAddressTon      = (TonType)remainder[0];
     SourceAddressNpi      = (NpiType)remainder[1];
     SourceAddress         = SmppStringUtil.GetCStringFromBody(ref remainder, 2);
     DestinationAddressTon = (TonType)remainder[0];
     DestinationAddressNpi = (NpiType)remainder[1];
     DestinationAddress    = SmppStringUtil.GetCStringFromBody(ref remainder, 2);
     EsmClass             = remainder[0];
     ProtocolId           = remainder[1];
     PriorityFlag         = (PriorityType)remainder[2];
     ScheduleDeliveryTime = SmppStringUtil.GetCStringFromBody(ref remainder, 3);
     ValidityPeriod       = SmppStringUtil.GetCStringFromBody(ref remainder);
     RegisteredDelivery   = (RegisteredDeliveryType)remainder[0];
     //replace_if_present is always null, so don't bother reading it
     DataCoding = (DataCoding)remainder[2];
     //sm_default_msg_id is always null, so don't bother reading it
     _smLength    = remainder[4];
     ShortMessage = SmppStringUtil.GetStringFromBody(ref remainder, 5, 5 + _smLength);
     TranslateTlvDataIntoTable(remainder);
 }
Exemple #28
0
        ///<summary>
        /// Gets the hex encoding(big-endian)of this Pdu.
        ///</summary>
        ///<return>The hex-encoded version of the Pdu</return>
        public override void ToMsbHexEncoding()
        {
            ArrayList pdu = GetPduHeader();

            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(ServiceType)));
            pdu.Add((byte)SourceAddressTon);
            pdu.Add((byte)SourceAddressNpi);
            pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(SourceAddress)));
            //number of destinations.
            pdu.Add(NumberOfDestinations);

            //and their addresses
            foreach (DestinationAddress address in _DestinationAddresses)
            {
                if (!address.IsDistributionList)
                {
                    //pack up the byte array for this address
                    ArrayList sme = new ArrayList();
                    pdu.Add((byte)0x01);
                    pdu.Add((byte)address.DestinationAddressTon);
                    pdu.Add((byte)address.DestinationAddressNpi);
                    pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(
                                     Encoding.ASCII.GetBytes(address.DestAddress)));
                }
                else
                {
                    ArrayList dln = new ArrayList();
                    pdu.Add((byte)0x02);
                    pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(
                                     Encoding.ASCII.GetBytes(address.DistributionList)));
                }
            }

            pdu.AddRange(base.GetBytesAfterDestination());

            PacketBytes = EncodePduForTransmission(pdu);
        }
        /// <summary>
        /// This decodes the submit_sm Pdu.  The Pdu has basically the same format as
        /// the submit_sm Pdu, but in this case it is a response.
        /// </summary>
        protected override void DecodeSmscResponse()
        {
            byte[] remainder = BytesAfterHeader;
            ServiceType           = SmppStringUtil.GetCStringFromBody(ref remainder);
            SourceAddressTon      = (TonType)remainder[0];
            SourceAddressNpi      = (NpiType)remainder[1];
            SourceAddress         = SmppStringUtil.GetCStringFromBody(ref remainder, 2);
            DestinationAddressTon = (TonType)remainder[0];
            DestinationAddressNpi = (NpiType)remainder[1];
            DestinationAddress    = SmppStringUtil.GetCStringFromBody(ref remainder, 2);
            EsmClass             = remainder[0];
            ProtocolId           = remainder[1];
            PriorityFlag         = (PriorityType)remainder[2];
            ScheduleDeliveryTime = SmppStringUtil.GetCStringFromBody(ref remainder, 3);
            ValidityPeriod       = SmppStringUtil.GetCStringFromBody(ref remainder);
            RegisteredDelivery   = (RegisteredDeliveryType)remainder[0];
            ReplaceIfPresentFlag = (remainder[1] == 0)? false : true;
            DataCoding           = (DataCoding)remainder[2];
            SmDefaultMessageId   = remainder[3];
            _SmLength            = remainder[4];
            ShortMessage         = SmppStringUtil.GetStringFromBody(ref remainder, 5, 5 + _SmLength);

            TranslateTlvDataIntoTable(remainder);
        }
Exemple #30
0
 protected override void AppendPduData(ArrayList pdu)
 {
     pdu.AddRange(SmppStringUtil.ArrayCopyWithNull(Encoding.ASCII.GetBytes(SystemId)));
 }