public bool TurnRegulator(bool state) { bool result = true; try { Thread.Sleep(400); if (state) { Thread.Sleep(400); Byte[] bytes = System.Text.Encoding.UTF8.GetBytes("N"); Thread.Sleep(400); ESPstream.Write(bytes, 0, bytes.Length); Thread.Sleep(400); } else { Thread.Sleep(400); Byte[] bytes = System.Text.Encoding.UTF8.GetBytes("K"); Thread.Sleep(400); ESPstream.Write(bytes, 0, bytes.Length); Thread.Sleep(400); } } catch { result = false; } return(result); }
public bool SetPhoneNumber(string telnum) { bool result = true; try { Byte[] bytes = System.Text.Encoding.UTF8.GetBytes("P" + telnum); Thread.Sleep(400); ESPstream.Write(bytes, 0, bytes.Length); this.phoneNumber = telnum; } catch { result = false; } return(result); }
public bool SetValues(double lowT, double highT, double lowL) { bool result = true; string tmp1 = ""; Thread.Sleep(400); tmp1 = "A" + this.minTemperature + ".L" + TempToCode(lowT) + ".H" + TempToCode(highT) + ".Z" + this.maxTemperature + ".X" + LuxToCode(lowL) + ".C" + this.normalizeTime + "."; try { tmp1 += '\n'; Byte[] bytes = System.Text.Encoding.UTF8.GetBytes(tmp1); Thread.Sleep(400); ESPstream.Write(bytes, 0, bytes.Length); Thread.Sleep(400); } catch { result = false; } return(result); }