Esempio n. 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);
        }
Esempio n. 2
0
        public static void Fetch(SmsBase sms, ref string source)
        {
            sms._serviceCenterNumber = PopServiceCenterAddress(ref source);
            sms._pduType             = PopByte(ref source);

            global::System.Collections.BitArray bits = new global::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);
        }
Esempio n. 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)
            {
                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)
            {
                byte userDataHeaderLength = PopByte(ref source);
                sms._userDataHeader = PopBytes(ref source, userDataHeaderLength);
                userDataLength     -= userDataHeaderLength + 1;
            }

            if (userDataLength == 0)
            {
                return;
            }

            switch ((SmsEncoding)sms._dataCodingScheme & SmsEncoding.ReservedMask)
            {
            case SmsEncoding.SevenBit:
                sms._message = Decode7bit(source, userDataLength);
                break;

            case SmsEncoding.EightBit:
                sms._message = Decode8bit(source, userDataLength);
                break;

            case SmsEncoding.Ucs2:
                sms._message = DecodeUCS2(source, userDataLength);
                break;
            }
        }