private static void Wudp_weaveReceiveDtuEvent(byte[] data, System.Net.Sockets.Socket soc) { try { string text = System.Text.ASCIIEncoding.Default.GetString(data); if (text == ":138xxxxxxxx.") { return; } if (text.IndexOf("id:") >= 0) { string id = text.Split(':')[1]; foreach (nqdtu nqd in LISTDTU) { if (nqd.ID == id) { nqd.soc = soc; nqd.state = true; return; } } nqdtu ndt = new nqdtu(); ndt.ID = id; ndt.soc = soc; ndt.state = true; LISTDTU.Add(ndt); } } catch { } }
static void openfan(nqdtu nqd) { nqd.soc.Send(dtccommand.CLOSE(0)); System.Threading.Thread.Sleep(100); nqd.soc.Send(dtccommand.CLOSE(2)); System.Threading.Thread.Sleep(100); nqd.soc.Send(dtccommand.OPEN(1)); System.Threading.Thread.Sleep(100); nqd.soc.Send(dtccommand.OPEN(3)); }
static void closejuanlian(nqdtu nqd) { nqd.soc.Send(dtccommand.CLOSE(0)); System.Threading.Thread.Sleep(100); nqd.soc.Send(dtccommand.CLOSE(1)); System.Threading.Thread.Sleep(100); nqd.soc.Send(dtccommand.CLOSE(2)); System.Threading.Thread.Sleep(100); nqd.soc.Send(dtccommand.CLOSE(3)); }
private static void Wudp_weaveReceiveDtuEvent(byte[] data, System.Net.Sockets.Socket soc) { try { string text = System.Text.ASCIIEncoding.Default.GetString(data); if (text == ":138xxxxxxxx.") { return; } if (text.IndexOf("id:") >= 0) { string id = text.Split(':')[1]; foreach (nqdtu nqd in LISTDTU) { if (nqd.ID == id) { nqd.soc = soc; nqd.state = true; nqd.soc.Send(dtccommand.chaxun); nqd.tiaojiancc = dutiaojian(id); return; } } nqdtu ndt = new nqdtu(); ndt.ID = id; ndt.soc = soc; ndt.state = true; ndt.tiaojiancc = dutiaojian(id); LISTDTU.Add(ndt); } if (data[0] == 0xfe) { if (data[1] == 0x01) { foreach (nqdtu nqd in LISTDTU) { if (nqd.soc == soc) { for (int i = 0; i < 8; i++) { nqd.kg[i] = Convert.ToBoolean(((int)data[3]) >> i & 1); } //Console.WriteLine("状态:" + data[3].ToString()); return; } } } } } catch { } }