Example #1
0
 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();
 }
Example #2
0
        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();
        }
Example #3
0
        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();
        }