Esempio n. 1
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);
        }
Esempio n. 2
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);
        }
        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);
        }
Esempio n. 4
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);
        }
Esempio n. 5
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);
 }