public override string ToText(MonitorContent content) { switch (content.Subtype) { case "stat": return(EnumToText((int)DoorStatus, DoorStatus.ToString(), content)); case "open": return(BoolToText(Open, "Open", "", content)); case "close": return(BoolToText(Close, "Close", "", content)); default: return(base.ToText(content)); } }
/// <summary> /// Server asks to check the door /// </summary> /// <param name="id">id of the session</param> /// <param name="on"></param> private async void ReportDoorStatus(string id, string doorName) { // create the client ESP8266Client client = new ESP8266Client(); // obtain the status from ESP8266 // it is unknown in case of exception DoorStatus status = DoorStatus.Unknown; try { status = await client.GetDoorStatus(mainView.DeviceIP); } catch (Exception) { } // build the parameters for the method that will be invoked on the hub var arr = new string[] { id, mainView.DeviceName, status.ToString() }; // call the method on the hub await _hubProxy.Invoke("SetDoorStatus", arr); }