Example #1
0
        public byte[] ToByteArray()
        {
            var builder = new ByteBuilder(100);

            builder.AddRange(_Header.ToByteArray());
            builder.AddRange(_Body.ToByteArray());
            return(builder.ToArray());
        }
Example #2
0
        public byte[] ToByteArray()
        {
            var builder = new ByteBuilder(0x10);

            builder.AddRange(SmppConverter.FromInt32ToByteArray(_CommandLength));
            builder.AddRange(SmppConverter.FromInt32ToByteArray(_CommandId));
            builder.AddRange(SmppConverter.FromInt32ToByteArray(_CommandStatus));
            builder.AddRange(SmppConverter.FromInt32ToByteArray(_SequenceNumber));
            return(builder.ToArray());
        }
Example #3
0
            public byte[] ToByteArray()
            {
                var builder = new ByteBuilder(30);

                builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_MessageId)));
                builder.Add(_SourceAddressTon);
                builder.Add(_SourceAddressNpi);
                builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_SourceAddress)));
                return(builder.ToArray());
            }
Example #4
0
        public byte[] ToByteArray()
        {
            byte[] c = _Body.ToByteArray();
            _Header.CommandLength = 0x10 + c.Length;
            byte[] buffer2 = _Header.ToByteArray();
            var    builder = new ByteBuilder(_Header.CommandLength);

            builder.AddRange(buffer2);
            builder.AddRange(c);
            return(builder.ToArray());
        }
Example #5
0
        public byte[] ToByteArray()
        {
            var builder = new ByteBuilder(300);

            builder.AddRange(_Header.ToByteArray());
            builder.AddRange(_Body.ToByteArray());
            if (_Tlv != null)
            {
                builder.AddRange(_Tlv.ToByteArray());
            }
            return(builder.ToArray());
        }
Example #6
0
            public byte[] ToByteArray()
            {
                var builder = new ByteBuilder(90);

                builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_SystemId)));
                builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_Password)));
                builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_SystemType)));
                builder.Add(_InterfaceVersion);
                builder.Add(_AddressTon);
                builder.Add(_AddressNpi);
                builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_AddressRange)));
                return(builder.ToArray());
            }
Example #7
0
        public byte[] ToByteArray()
        {
            var builder = new ByteBuilder(100);

            if (Items != null)
            {
                foreach (Tag tag in Items)
                {
                    builder.AddRange(SmppConverter.FromInt16ToByteArray(tag.TagId));
                    builder.AddRange(SmppConverter.FromInt16ToByteArray(tag.Length));
                    builder.AddRange(tag.GetByteArray());
                }
            }
            return(builder.ToArray());
        }
Example #8
0
            public byte[] ToByteArray()
            {
                var builder = new ByteBuilder(100);

                builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_ServiceType.Value)));
                builder.Add(_SourceAddressTon);
                builder.Add(_SourceAddressNpi);
                builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_SourceAddress)));
                builder.Add(_DestinationAddressTon);
                builder.Add(_DestinationAddressNpi);
                builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_DestinationAddress)));
                builder.Add(_EsmClass.Value);
                builder.Add(_RegisteredDelivery.Value);
                builder.Add(_DataCoding.Value);
                return(builder.ToArray());
            }
Example #9
0
            public byte[] ToByteArray()
            {
                var builder = new ByteBuilder(100);

                builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_SystemId)));
                return(builder.ToArray());
            }
Example #10
0
            public byte[] ToByteArray()
            {
                var builder = new ByteBuilder(30);

                builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_MessageId)));
                if (_FinalDate == null)
                {
                    builder.AddRange(SmppConverter.SmppNullEnd(null));
                }
                else
                {
                    builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_FinalDate.SmppDate)));
                }
                builder.Add(_MessageState);
                builder.Add(_ErrorCode);
                return(builder.ToArray());
            }
Example #11
0
        public byte[] ToByteArray()
        {
            byte[] c       = null;
            byte[] buffer2 = _Body.ToByteArray();
            byte[] buffer3 = null;
            _Header.CommandLength = 0x10 + buffer2.Length;
            if (_Tlv != null)
            {
                buffer3 = _Tlv.ToByteArray();
                _Header.CommandLength += buffer3.Length;
            }
            c = _Header.ToByteArray();
            var builder = new ByteBuilder(c.Length + buffer2.Length);

            builder.AddRange(c);
            builder.AddRange(buffer2);
            builder.AddRange(buffer3);
            return(builder.ToArray());
        }
Example #12
0
        public byte[] ToByteArray()
        {
            byte[] c        = null;
            byte[] buffer2  = _Body.ToByteArray();
            byte[] arrayObj = null;
            _Header.CommandLength = 0x10 + buffer2.Length;
            if (_Tlv != null)
            {
                arrayObj = _Tlv.ToByteArray();
                _Header.CommandLength += arrayObj.Length;
            }
            c = _Header.ToByteArray();
            var builder = new ByteBuilder((c.Length + buffer2.Length) + SmppConverter.GetArrayLength(arrayObj));

            builder.AddRange(c);
            builder.AddRange(buffer2);
            if (arrayObj != null)
            {
                builder.AddRange(arrayObj);
            }
            return(builder.ToArray());
        }
Example #13
0
        internal static byte[] GetPduByteArray(ref SmppHeader Header, ISmppBasic Body, SmppTlv Tlv)
        {
            byte[] c        = null;
            byte[] buffer2  = null;
            byte[] arrayObj = null;
            buffer2 = Body.ToByteArray();
            Header.CommandLength = 0x10 + buffer2.Length;
            if (Tlv != null)
            {
                arrayObj              = Tlv.ToByteArray();
                Header.CommandLength += arrayObj.Length;
            }
            c = Header.ToByteArray();
            var builder = new ByteBuilder((c.Length + buffer2.Length) + GetArrayLength(arrayObj));

            builder.AddRange(c);
            builder.AddRange(buffer2);
            if (arrayObj != null)
            {
                builder.AddRange(arrayObj);
            }
            return(builder.ToArray());
        }
Example #14
0
            public byte[] ToByteArray()
            {
                var builder = new ByteBuilder(300);

                builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_ServiceType.Value)));
                builder.Add(_SourceAddressTon);
                builder.Add(_SourceAddressNpi);
                builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_SourceAddress)));
                builder.Add(_DestinationAddressTon);
                builder.Add(_DestinationAddressNpi);
                builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_DestinationAddress)));
                builder.Add(_EsmClass.Value);
                builder.Add(_ProtocolId);
                builder.Add(_PriorityFlag);
                if (_ScheduleDeliveryTime == null)
                {
                    builder.AddRange(SmppConverter.SmppNullEnd(null));
                }
                else
                {
                    builder.AddRange(
                        SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_ScheduleDeliveryTime.SmppDate)));
                }
                if (_ValidityPeriod == null)
                {
                    builder.AddRange(SmppConverter.SmppNullEnd(null));
                }
                else
                {
                    builder.AddRange(
                        SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_ValidityPeriod.SmppDate)));
                }
                builder.Add(_RegisteredDelivery.Value);
                builder.Add(_ReplaceIfPresent);
                builder.Add(_ShortMessage.DataCoding.Value);
                builder.Add(_SmDefaultMessageId);
                builder.Add(Convert.ToByte(_ShortMessage.Length));
                builder.AddRange(_ShortMessage.Value);
                return(builder.ToArray());
            }