コード例 #1
0
        public static void Fetch(SMSStatusReport statusReport, ref string source)
        {
            SMSBase.Fetch(statusReport, ref source);

            statusReport._messageReference       = PopByte(ref source);
            statusReport._phoneNumber            = PopPhoneNumber(ref source);
            statusReport._serviceCenterTimeStamp = PopDate(ref source);
            statusReport._reportTimeStamp        = PopDate(ref source);
            statusReport._reportStatus           = (ReportStatus)PopByte(ref source);
        }
コード例 #2
0
        public static void Fetch(SMSBase sms, ref string source)
        {
            sms._serviceCenterNumber = PopServiceCenterAddress(ref source);

            sms._pduType = PopByte(ref source);

            System.Collections.BitArray bits = new System.Collections.BitArray(new byte[] { sms._pduType });

            sms.ReplyPathExists          = bits[7];
            sms.UserDataStartsWithHeader = bits[6];
            sms.StatusReportIndication   = bits[5];

            sms.ValidityPeriodFormat = (ValidityPeriodFormat)(sms._pduType & 0x18);
            sms.Direction            = (SMSDirection)(sms._pduType & 1);
        }
コード例 #3
0
        public static void Fetch(SMS sms, ref string source)
        {
            SMSBase.Fetch(sms, ref source);

            if (sms._direction == SMSDirection.Submited)
            {
                sms._messageReference = PopByte(ref source);
            }

            sms._phoneNumber        = PopPhoneNumber(ref source);
            sms._protocolIdentifier = PopByte(ref source);
            sms._dataCodingScheme   = PopByte(ref source);

            if (sms._direction == SMSDirection.Submited)
            {
                if (sms._validityPeriod != 0x00)
                {
                    sms._validityPeriod = PopByte(ref source);
                }
            }

            if (sms._direction == SMSDirection.Received)
            {
                sms._serviceCenterTimeStamp = PopDate(ref source);
            }

            sms._userData = source;

            if (source == string.Empty)
            {
                return;
            }

            int userDataLength = PopByte(ref source);

            if (userDataLength == 0)
            {
                return;
            }

            if (sms._userDataStartsWithHeader)
            {
                sms._userDataHeaderLength = PeekByte(source);

                sms._userDataHeader = PeekBytes(source, 1, sms._userDataHeaderLength);
            }

            if (userDataLength == 0)
            {
                return;
            }

            switch ((SMSEncoding)sms._dataCodingScheme & SMSEncoding.ReservedMask)
            {
            case SMSEncoding._7bit:
                sms._message = Decode7bit(source, userDataLength);
                if (sms._userDataStartsWithHeader && sms._userDataHeaderLength > 0)
                {
                    sms._message = sms._message.Remove(0, ((sms._userDataHeaderLength + 1) * 8 + ((sms._userDataHeaderLength + 1) * 8) % 7) / 7);
                }
                break;

            case SMSEncoding._8bit:
                sms._message = Decode8bit(source, userDataLength);
                break;

            case SMSEncoding.UCS2:
                sms._message = DecodeUCS2(source, userDataLength);
                break;
            }
        }
コード例 #4
0
ファイル: SMSBase.cs プロジェクト: frankzzcn/sms-pdu
		public static void Fetch(SMSBase sms, ref string source)
		{
			sms._serviceCenterNumber = PopServiceCenterAddress(ref source);
			
			sms._pduType = PopByte(ref source);

			System.Collections.BitArray bits = new System.Collections.BitArray(new byte[] { sms._pduType });

			sms.ReplyPathExists = bits[7];
			sms.UserDataStartsWithHeader = bits[6];
			sms.StatusReportIndication = bits[5];

			sms.ValidityPeriodFormat = (ValidityPeriodFormat) (sms._pduType & 0x18);
			sms.Direction = (SMSDirection) (sms._pduType & 1);
		}