public ZoneScanner(Zone z, JDQVisitor visitor) { this._zone = z; this._visitor = visitor; int dueTime = 1000;//Timeout.Infinite; _timer = new Timer(new TimerCallback(OnTimerCallback), null, dueTime, DEV_SCAN_INTERVAL); }
public void TestFastReadOutput() { JDQVisitor visitor = new JDQVisitor(); JDQRequest req = new JDQRequest(1, JDQRequestType.ReadOutput); string ip = "192.168.0.18"; // turn off JDQResponse resp; for (int i = 0; i < 100; i++) { resp = visitor.Request(ip, req); } visitor.Terminate(); }
public void TestFastSetOutput() { JDQVisitor visitor = new JDQVisitor(); JDQRequest req = new JDQRequest(1, JDQRequestType.SetOutput); string ip = "192.168.0.18"; for (int i = 0; i < 20; i++) { // turn on all req.TurnOnOutput(JDQRequest.ALL); visitor.Request(ip, req); // turn off all req.TurnOffOutput(JDQRequest.ALL); visitor.Request(ip, req); } visitor.Terminate(); }
public void TestReadOutput() { JDQVisitor visitor = new JDQVisitor(); JDQRequest req = new JDQRequest(1, JDQRequestType.SetOutput); string ip = "192.168.0.18"; // turn off req.TurnOffOutput(JDQRequest.ALL); req.TurnOnOutput(0); req.TurnOnOutput(4); JDQResponse resp = visitor.Request(ip, req); Assert.IsTrue(resp.IsOK); //SetOutput OK JDQRequest ro = new JDQRequest(1, JDQRequestType.ReadOutput); resp = visitor.Request(ip, ro); Assert.IsTrue(resp.IsOK); // ReadOutputOK Assert.AreEqual(RelayState.ACTION, resp.GetRelayState(0)); Assert.AreEqual(RelayState.RESET, resp.GetRelayState(1)); Assert.AreEqual(RelayState.RESET, resp.GetRelayState(2)); Assert.AreEqual(RelayState.RESET, resp.GetRelayState(3)); Assert.AreEqual(RelayState.ACTION, resp.GetRelayState(4)); Assert.AreEqual(RelayState.RESET, resp.GetRelayState(5)); Assert.AreEqual(RelayState.RESET, resp.GetRelayState(6)); Assert.AreEqual(RelayState.RESET, resp.GetRelayState(7)); visitor.Terminate(); }
public void TestSetOutput() { JDQVisitor visitor = new JDQVisitor(); JDQRequest req = new JDQRequest(1, JDQRequestType.SetOutput); string ip = "192.168.0.18"; // turn off req.TurnOnOutput(JDQRequest.ALL); JDQResponse resp = visitor.Request(ip, req); Assert.IsTrue(resp.IsOK); Thread.Sleep(2000); // turn off req.TurnOffOutput(JDQRequest.ALL); resp = visitor.Request(ip, req); Assert.IsTrue(resp.IsOK); Thread.Sleep(2000); // turn on 1,3,5 req.TurnOnOutput(0); req.TurnOnOutput(2); req.TurnOnOutput(4); resp = visitor.Request(ip, req); Assert.IsTrue(resp.IsOK); Thread.Sleep(2000); // turn off 3 req.TurnOffOutput(2); resp = visitor.Request(ip, req); Assert.IsTrue(resp.IsOK); }