public override void SetReceiverMode(string ReceiverToken, ReceiverMode Mode) { ParametersValidation validation = new ParametersValidation(); validation.Add(ParameterType.String, "ReceiverToken", ReceiverToken); validation.Add(ParameterType.String, "Mode", Mode.ToString()); ExecuteVoidCommand(validation, ReceiverServiceTest.SetReceiverModeTest); }
public void SetCurrentMode(ReceiverMode mode) { var json = string.Format("{{ \"params\": {{ \"currentMode\": \"{0}\" }} }}", mode.ToString().ToLower()); Mode = mode; PostRequest("/cgi-bin/json_xfer", json, (userobj, error) => { if (error != HTTP_CALLBACK_ERROR.COMPLETED || userobj == null) { CheckComms(false); return; } try { var data = JToken.Parse(userobj.ContentString); #if DEBUG CrestronConsole.PrintLine("{0} received response:", GetType().Name); CrestronConsole.PrintLine(data.ToString(Formatting.Indented)); #endif CheckComms(true); } catch (Exception e) { #if DEBUG CrestronConsole.PrintLine(userobj.ContentString); #endif CloudLog.Error("Error in {0}.SetCurrentMode(ReceiverMode mode), {1}", GetType().Name, e.Message); CheckComms(false); } }); }