Пример #1
0
        /// <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);
        }
Пример #2
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);
        }
Пример #3
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);
 }
Пример #4
0
        /// <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);
        }