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; } }
public ATResponse SendSms(Sms sms, TimeSpan timeout) { sms.Direction = SmsDirection.Submited; string pdu = sms.Compose(SmsEncoding.Ucs2); ATResponse response = ATCommand( new ATRequest( String.Format("at+cmgs={0}\r", (pdu.Length / 2) - 1), new string(new char[] { (char)13, (char)10, (char)62, (char)32 })), timeout); if (response.IsSpecial) { response = ATCommand(new ATRequest(String.Format("{0}{1}\r", pdu, (char)26)), timeout); } return(response); }
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; } }