private void Send() { var rnd = new Random(); if (chkInterval.Checked) { SetBox(txtHum, (int.Parse(txtHumSet.Text) + rnd.Next(-9, 9)).ToString()); SetBox(txtTemp, $"{rnd.Next(20, 30)}.{rnd.Next(10, 99)}"); } List <byte> list = new List <byte>(); list.Add(byte.Parse(txtOn.Text)); list.Add(byte.Parse(txtMode.Text)); list.Add(byte.Parse(txtSpeed.Text)); list.AddRange(EncodingHelper.HexToBytes(txtZT.Text)); list.AddRange(EncodingHelper.HexToBytes(int.Parse(txtHum.Text).ToYmHex(2))); list.AddRange(EncodingHelper.HexToBytes(double.Parse(txtTemp.Text).ToYmHex(4))); list.AddRange(EncodingHelper.HexToBytes(int.Parse(txtHumSet.Text).ToYmHex(2))); list.AddRange(EncodingHelper.HexToBytes(int.Parse(txtHumOut.Text).ToYmHex(2))); list.AddRange(EncodingHelper.HexToBytes(double.Parse(txtTempOut.Text).ToYmHex(4))); list.AddRange(EncodingHelper.HexToBytes(int.Parse(txtPM25.Text).ToYmHex(4))); list.AddRange(EncodingHelper.HexToBytes(double.Parse(txtTempNet.Text).ToYmHex(4))); list.AddRange(EncodingHelper.HexToBytes(int.Parse(txtCO2.Text).ToYmHex(4))); list.Add(byte.Parse(txtVOC.Text)); list.AddRange(EncodingHelper.HexToBytes(int.Parse(txtNetDay.Text).ToYmHex(4))); var req = IotRequest.CreateRequest(filter, txtMac.Text.Trim(), "0001", list.ToArray().ToHex()); if (sessions.ContainsKey(req.Device.Mac)) { req.SessionId = sessions[req.Device.Mac]; } Send(req); }
private void Send() { var rnd = new Random(); if (chkInterval.Checked) { SetBox(txtInt, (rnd.Next(1, 255) - 128).ToString()); SetBox(txtNum, $"{rnd.Next(1, 255) - 128}.{rnd.Next(0, 255)}"); SetBox(txtBit, rnd.Next(0, 255).ToString()); } List <byte> list = new List <byte>(); list.Add(byte.Parse(txtOn.Text)); list.AddRange(EncodingHelper.HexToBytes(int.Parse(txtInt.Text).ToYmHex(2))); list.AddRange(EncodingHelper.HexToBytes(double.Parse(txtNum.Text).ToYmHex(4))); list.Add(byte.Parse(txtBit.Text)); var req = IotRequest.CreateRequest(filter, txtMac.Text.Trim(), "0001", list.ToArray().ToHex()); if (sessions.ContainsKey(req.Device.Mac)) { req.SessionId = sessions[req.Device.Mac]; } Send(req); }
private void btnLogin_Click(object sender, EventArgs e) { var wifi = EncodingHelper.ToBytes(txtWifi.Text).ToHex(); var hard = NaryHelper.ToYmHex(txtHard.Text.Trim(), 4); var soft = NaryHelper.ToYmHex(txtSoft.Text.Trim(), 4); var req = IotRequest.CreateRequest(filter, txtMac.Text.Trim(), "00F1", soft + hard + wifi); Send(req); }