Example #1
0
 /// <summary>
 /// Decodes an outgoing SMS PDU stream.
 /// </summary>
 /// <param name="pdu">The PDU string to decode</param>
 /// <param name="includesSmscData">Specify true if the PDU data contains an SMSC header, otherwise false.</param>
 /// <param name="actualLength">The length of the PDU in bytes, not including the SMSC header.</param>
 /// <returns>An <see cref="T:GSMCommunication.PDUDecoder.OutgoingSmsPdu" /> object representing the decoded message.</returns>
 public static OutgoingSmsPdu Decode(string pdu, bool includesSmscData, int actualLength)
 {
     if (pdu != string.Empty)
     {
         int num = 0;
         if (includesSmscData)
         {
             int num1 = num;
             num = num1 + 1;
             byte num2 = BcdWorker.GetByte(pdu, num1);
             if (num2 > 0)
             {
                 num = num + num2;
             }
         }
         int num3 = num;
         OutgoingMessageType messageType         = OutgoingSmsPdu.GetMessageType(BcdWorker.GetByte(pdu, num3));
         OutgoingMessageType outgoingMessageType = messageType;
         if (outgoingMessageType != OutgoingMessageType.SmsSubmit)
         {
             throw new NotSupportedException(string.Concat("Message type ", messageType.ToString(), " recognized, but not supported by the SMS decoder."));
         }
         else
         {
             return(new SmsSubmitPdu(pdu, includesSmscData, actualLength));
         }
     }
     else
     {
         throw new ArgumentException("pdu must not be an empty string.");
     }
 }
Example #2
0
 /// <summary>
 /// Decodes an outgoing SMS PDU stream.
 /// </summary>
 /// <param name="pdu">The PDU string to decode.</param>
 /// <param name="includesSmscData">Specify true if the PDU data contains an SMSC header, otherwise false.</param>
 /// <returns>An <see cref="T:GSMCommunication.PDUDecoder.OutgoingSmsPdu" /> object representing the decoded message.</returns>
 /// <remarks>Use this method when the actual length of the message is not known.</remarks>
 public static OutgoingSmsPdu Decode(string pdu, bool includesSmscData)
 {
     return(OutgoingSmsPdu.Decode(pdu, includesSmscData, -1));
 }