Beispiel #1
0
        public void RTU_ADU_DocSampleReq()
        {
            var DocRequest = new byte[]
            {
                0x01,
                0x10, 0x00, 0x01, 0x00, 0x01, 0x02, 0xFF, 0xFF,
                0xA6, 0x31,
            };

            var DocResponse = new byte[]
            {
                0x01,
                0x10, 0x00, 0x01, 0x00, 0x01,
                0x50, 0x09,
            };

            var ClientPDU = new WriteMultipleRegistersPDU(1, new int[] { 0xFFFF });
            var Device    = new RTU_Device(1);

            var ClientADU = new RTU_ADU(Device, ClientPDU);

            CollectionAssert.AreEqual(DocRequest, ClientADU.BuildRequest());

            Assert.AreEqual(Status.OK, ClientADU.CheckResponse(DocResponse));
        }
Beispiel #2
0
        public void RTU_ADU_LifeCycle()
        {
            var ClientPDU = new ReadHoldingRegistersPDU(5, 10);
            var Device    = new RTU_Device(1);
            var ClientADU = new RTU_ADU(Device, ClientPDU);

            var ServerADU = new RTU_ADU(Device);

            ServerADU.CheckRequest(ClientADU.BuildRequest());
        }
Beispiel #3
0
            public myDevice()
            {
                Client          = new RTU_Client("COM10", 19200);
                Client.MaxCount = 10;
                Device          = new RTU_Device(1);

                Value          = 0;
                Timer          = new Timer(25);
                Timer.Elapsed += Timer_Elapsed;
                Timer.Enabled  = true;
            }