/// <summary> /// Handles an unsolicited message of the specified input string. /// </summary> /// <param name="input">The input string to handle, the unsolicited message will be removed</param> /// <param name="description">Receives a textual description of the message, may be empty</param> /// <returns>The message indication object generated from the message</returns> /// <exception cref="T:System.ArgumentException">Input string does not match any of the supported /// unsolicited messages</exception> public IMessageIndicationObject HandleUnsolicitedMessage(ref string input, out string description) { IMessageIndicationObject messageIndicationObject; List <MessageIndicationHandlers.UnsoMessage> .Enumerator enumerator = this.messages.GetEnumerator(); try { while (enumerator.MoveNext()) { MessageIndicationHandlers.UnsoMessage current = enumerator.Current; if (!current.IsMatch(input)) { continue; } IMessageIndicationObject messageIndicationObject1 = current.Handler(ref input); description = current.Description; messageIndicationObject = messageIndicationObject1; return(messageIndicationObject); } throw new ArgumentException("Input string does not match any of the supported unsolicited messages."); } finally { enumerator.Dispose(); } return(messageIndicationObject); }
public MessageIndicationHandlers() { this.messages = new List <MessageIndicationHandlers.UnsoMessage>(); MessageIndicationHandlers.UnsoMessage unsoMessage = new MessageIndicationHandlers.UnsoMessage("\\+CMTI: \"(\\w+)\",(\\d+)", new MessageIndicationHandlers.UnsoHandler(this.HandleDeliverMemoryIndication)); unsoMessage.StartPattern = "\\+CMTI: "; unsoMessage.Description = "New SMS-DELIVER received (indicated by memory location)"; this.messages.Add(unsoMessage); MessageIndicationHandlers.UnsoMessage unsoCompleteChecker = new MessageIndicationHandlers.UnsoMessage("\\+CMT: (\\w*),(\\d+)\\r\\n(\\w+)", new MessageIndicationHandlers.UnsoHandler(this.HandleDeliverPduModeIndication)); unsoCompleteChecker.StartPattern = "\\+CMT: "; unsoCompleteChecker.Description = "New SMS-DELIVER received (indicated by PDU mode version)"; unsoCompleteChecker.CompleteChecker = new MessageIndicationHandlers.UnsoCompleteChecker(this.IsCompleteDeliverPduModeIndication); this.messages.Add(unsoCompleteChecker); MessageIndicationHandlers.UnsoMessage unsoMessage1 = new MessageIndicationHandlers.UnsoMessage("\\+CDSI: \"(\\w+)\",(\\d+)", new MessageIndicationHandlers.UnsoHandler(this.HandleStatusReportMemoryIndication)); unsoMessage1.StartPattern = "\\+CDSI: "; unsoMessage1.Description = "New SMS-STATUS-REPORT received (indicated by memory location)"; this.messages.Add(unsoMessage1); MessageIndicationHandlers.UnsoMessage unsoCompleteChecker1 = new MessageIndicationHandlers.UnsoMessage("\\+CDS: (\\d+)\\r\\n(\\w+)", new MessageIndicationHandlers.UnsoHandler(this.HandleStatusReportPduModeIndication)); unsoCompleteChecker1.StartPattern = "\\+CDS: "; unsoCompleteChecker1.Description = "New SMS-STATUS-REPORT received (indicated by PDU mode version)"; unsoCompleteChecker1.CompleteChecker = new MessageIndicationHandlers.UnsoCompleteChecker(this.IsCompleteStatusReportPduModeIndication); this.messages.Add(unsoCompleteChecker1); }
public MessageIndicationHandlers() { this.messages = new List<MessageIndicationHandlers.UnsoMessage>(); MessageIndicationHandlers.UnsoMessage unsoMessage = new MessageIndicationHandlers.UnsoMessage("\\+CMTI: \"(\\w+)\",(\\d+)", new MessageIndicationHandlers.UnsoHandler(this.HandleDeliverMemoryIndication)); unsoMessage.StartPattern = "\\+CMTI: "; unsoMessage.Description = "New SMS-DELIVER received (indicated by memory location)"; this.messages.Add(unsoMessage); MessageIndicationHandlers.UnsoMessage unsoCompleteChecker = new MessageIndicationHandlers.UnsoMessage("\\+CMT: (\\w*),(\\d+)\\r\\n(\\w+)", new MessageIndicationHandlers.UnsoHandler(this.HandleDeliverPduModeIndication)); unsoCompleteChecker.StartPattern = "\\+CMT: "; unsoCompleteChecker.Description = "New SMS-DELIVER received (indicated by PDU mode version)"; unsoCompleteChecker.CompleteChecker = new MessageIndicationHandlers.UnsoCompleteChecker(this.IsCompleteDeliverPduModeIndication); this.messages.Add(unsoCompleteChecker); MessageIndicationHandlers.UnsoMessage unsoMessage1 = new MessageIndicationHandlers.UnsoMessage("\\+CDSI: \"(\\w+)\",(\\d+)", new MessageIndicationHandlers.UnsoHandler(this.HandleStatusReportMemoryIndication)); unsoMessage1.StartPattern = "\\+CDSI: "; unsoMessage1.Description = "New SMS-STATUS-REPORT received (indicated by memory location)"; this.messages.Add(unsoMessage1); MessageIndicationHandlers.UnsoMessage unsoCompleteChecker1 = new MessageIndicationHandlers.UnsoMessage("\\+CDS: (\\d+)\\r\\n(\\w+)", new MessageIndicationHandlers.UnsoHandler(this.HandleStatusReportPduModeIndication)); unsoCompleteChecker1.StartPattern = "\\+CDS: "; unsoCompleteChecker1.Description = "New SMS-STATUS-REPORT received (indicated by PDU mode version)"; unsoCompleteChecker1.CompleteChecker = new MessageIndicationHandlers.UnsoCompleteChecker(this.IsCompleteStatusReportPduModeIndication); this.messages.Add(unsoCompleteChecker1); }