int sleeptime = 3 * 1000; //发包间隔 public BlindTest(ZingoTIFUART serial, string id, int time) : base(serial, id) { this.time = time; zingoTIFUART = serial; shortid = id; BlindTestCMD(shortid); }
public BulbTest(ZingoTIFUART mySerial, string shortid) : base(mySerial, shortid) { zingoTIFUART = mySerial; this.shortid = shortid; //BulbFFTest(); //BulbOnOffTest(2500); BulbTestAction = new Action <string>((s) => { if (!IsResponse(s)) { return; } if (s.Contains("command 0x8034") && s.Contains("status: 0x00")) { if ((BublCMD)status == BublCMD.Leave) { status++; } } else if (s.Contains("Level Control") && s.Contains("cmd 0B payload[00 00 ]")) { if ((BublCMD)status == BublCMD.MoveToLevel) { status++; } } else if (s.Contains("Color Control") && s.Contains("cmd 0B payload[0A 00 ]")) { if ((BublCMD)status == BublCMD.MoveToColorTemp) { status++; } } else { return; } switch ((BublCMD)status) { case BublCMD.MoveToLevel: MoveToLevel(); break; case BublCMD.MoveToColorTemp: MoveToColorTemp(); break; case BublCMD.Leave: Leave(shortid); break; case BublCMD.Remove: zingoTIFUART.RemoveCallback(BulbTestAction); break; default: break; } }); //zingoTIFUART.AddCallback(BulbTestAction); BulbTestCMD(); }