Example #1
0
        public PduUdSegment(IPduProfileSettings settings, PduDcsSegment dcs)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("Profile settings not specified.");
            }

            if (dcs == null || dcs.GetCodingScheme() == DCS.Other)
            {
                throw new NotSupportedException("Data coding scheme not supported.");
            }

            _dcs    = dcs;
            _source = settings?.UserData?.Value ?? string.Empty;

            encode(_source, dcs.GetCoder());
        }
Example #2
0
        private void createSegments()
        {
            _segmentType.Clear();

            var header = Settings.CanSubmit ? new PduSendHeaderSegment(Settings) as IPduSegment : new PduReceiveHeaderSegment(Settings) as IPduSegment;

            var dcs = new PduDcsSegment(Settings);

            _segmentType[PduSegment.ServiceCenterAddress]   = new PduScaSegment(Settings);
            _segmentType[PduSegment.PduHeader]              = header;
            _segmentType[PduSegment.MessageReference]       = new PduMrSegment(Settings);
            _segmentType[PduSegment.DestinationAddress]     = new PduDaSegment(Settings);
            _segmentType[PduSegment.ProtocolIdentifier]     = new PduPidSegment(Settings);
            _segmentType[PduSegment.DataCodingScheme]       = dcs;
            _segmentType[PduSegment.ValidityPeriod]         = new PduVpSegment(Settings);
            _segmentType[PduSegment.ServiceCenterTimestamp] = new PduSctsSegment(Settings);
            _segmentType[PduSegment.UserData] = new PduUdSegment(Settings, dcs);
        }