private Task <MethodResponse> ControlRelay(MethodRequest methodRequest, object userContext) { Debug.WriteLine("\t{0}", methodRequest.DataAsJson); MotorMethodData m = JsonConvert.DeserializeObject <MotorMethodData>(methodRequest.DataAsJson); sensorController.ControlRelay(m.onoff); this.callMeLogger(methodRequest.DataAsJson); return(Task.FromResult(new MethodResponse(200))); }
private Task <MethodResponse> ControlRelay(MethodRequest methodRequest, object userContext) { Debug.WriteLine(String.Format("method ControlRelay: {0}", methodRequest.DataAsJson)); try { MotorMethodData m = JsonConvert.DeserializeObject <MotorMethodData>(methodRequest.DataAsJson); sensorController.ControlRelay(m.onoff); } catch (Exception e) { this.callMeLogger(String.Format("Wrong message: {0}", methodRequest.DataAsJson)); return(Task.FromResult(new MethodResponse(400))); } this.callMeLogger(methodRequest.DataAsJson); return(Task.FromResult(new MethodResponse(200))); }