Example #1
0
        /// <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);
        }
Example #2
0
 // instantiate the client
 private void Init()
 {
     _client = new ESP8266Client();
 }