public override ValidatedRxData ValidateResponse(string response, SupportedCommandGroups commandGroup) { ValidatedRxData validatedData = new ValidatedRxData(false, string.Empty); // response has delimiter? If not, excape validation if (!response.Contains(delimiter)) { return(validatedData); } // remove modified delimter from command before sending it to the base validation response = response.Substring(0, response.Length - delimiter.Length); return(base.ValidateResponse(response, commandGroup)); }
public override ValidatedRxData ValidateResponse(string response, CommonCommandGroupType commandGroup) { ValidatedRxData validatedData = new ValidatedRxData(false, string.Empty); _protocol.Log(string.Format("Christie:Group:{0} Validate:{1}", commandGroup, response)); List <string> responseList = response.Split(new char[] { '(', ')' }).Where(l => !string.IsNullOrEmpty(l)).ToList(); foreach (string c in responseList) { _protocol.Log(string.Format("Christie: Split:{0}", c)); } if (responseList.FirstOrDefault() == "$") { validatedData.CommandGroup = CommonCommandGroupType.AckNak; validatedData.Data = DataValidation.AckDefinition; validatedData.Ready = true; return(validatedData); } else if (responseList.FirstOrDefault() == "^") { validatedData.CommandGroup = CommonCommandGroupType.AckNak; validatedData.Data = DataValidation.NakDefinition; validatedData.Ready = true; return(validatedData); } foreach (string responseItem in responseList) { //_protocol.Log(string.Format("Christie:Processing:{0}", responseItem)); if (responseItem.StartsWith(DataValidation.PowerFeedback.GroupHeader)) { validatedData.CommandGroup = CommonCommandGroupType.Power; validatedData.Data = responseItem.Substring(DataValidation.PowerFeedback.GroupHeader.Length, 3); validatedData.Ready = true; break; } else if (responseItem.StartsWith(DataValidation.VideoMuteFeedback.GroupHeader)) { validatedData.CommandGroup = CommonCommandGroupType.VideoMute; validatedData.Data = responseItem.Substring(DataValidation.VideoMuteFeedback.GroupHeader.Length, 3); validatedData.Ready = true; break; } else if (responseItem.StartsWith(DataValidation.InputFeedback.GroupHeader)) { validatedData.CommandGroup = CommonCommandGroupType.Input; validatedData.Data = responseItem.Substring(DataValidation.VideoMuteFeedback.GroupHeader.Length, 3); validatedData.Ready = true; break; } else if (responseItem.StartsWith(DataValidation.LampHourFeedback.GroupHeader)) { validatedData.CommandGroup = CommonCommandGroupType.LampHours; validatedData.Data += responseItem + CrestronEnvironment.NewLine; validatedData.Ready = true; continue; } else if (responseItem.StartsWith("SST+VERS!000")) { if (responseItem.Contains("Boxer")) { _protocol.Log("Christie: dialect is Boxer."); _protocol._boxerDialect = true; _protocol._lampHours = new uint[4]; // remove StandardCommandsEnum.VideoMutePoll from polling sequence as no command found for Boxer2k _protocol.ValidatedData.PowerOnPollingSequence = _protocol.ValidatedData.PowerOnPollingSequence.Where(item => item != StandardCommandsEnum.VideoMutePoll).ToArray(); } else { _protocol.Log("Christie: dialect is HD-MD14K."); _protocol._lampHours = new uint[2]; } validatedData.CommandGroup = CommonCommandGroupType.AckNak; validatedData.Data = DataValidation.AckDefinition; validatedData.Ready = true; break; } else if (!validatedData.Ready && responseItem.StartsWith("65535 00000 FYI")) { validatedData.CommandGroup = CommonCommandGroupType.AckNak; validatedData.Data = DataValidation.AckDefinition; validatedData.Ready = true; continue; } else if (!validatedData.Ready && responseItem.StartsWith("65535 00000 ERR")) { validatedData.CommandGroup = CommonCommandGroupType.AckNak; validatedData.Data = DataValidation.NakDefinition; validatedData.Ready = true; continue; } //_protocol.Log(string.Format("Christie:Processed:{0}", responseItem)); } //_protocol.Log(string.Format("Christie: Validated Data {0}", validatedData.Data)); return(validatedData); }
protected override void ChooseDeconstructMethod(ValidatedRxData validatedData) { }