コード例 #1
0
        public async Task <bool> LogEventSetTest(Behavior behavior)
        {
            testConnection = new TestModbusTCPConnection(behavior, "172.19.103.8");
            _wtxDevice     = new WTXModbus(testConnection, 200, UpdateLogEventSetTest);

            _wtxDevice.Connect(this.OnConnect, 100);
            testConnection.IsConnected = true;

            _data = await testConnection.SyncData();

            if (testConnection._logObj.Args.Equals("Read successful: Registers have been read"))
            {
                return(true);
            }

            else
            if (testConnection._logObj.Args.Equals("Read failed : Registers have not been read"))
            {
                return(false);
            }

            else
            {
                return(false);
            }
            //return _wtxDevice.ApplicationMode;
        }
コード例 #2
0
        public async Task <ushort> ReadTestModbus(Behavior behavior)
        {
            testConnection = new TestModbusTCPConnection(behavior, "172.19.103.8");
            _wtxDevice     = new WTXModbus(testConnection, 200, UpdateReadTest);

            _wtxDevice.Connect(this.OnConnect, 100);

            await Task.Run(async() =>
            {
                ushort[] _data = await testConnection.SyncData();
            });

            _testValue = (ushort)_wtxDevice.ProcessData.Weight.Net;
            return(_testValue);
        }
コード例 #3
0
        public async Task <string> testModbus_Unit(Behavior behavior)
        {
            TestModbusTCPConnection testConnection = new TestModbusTCPConnection(behavior, "172.19.103.8");

            WTXModbus _wtxObj = new WTXModbus(testConnection, 200, update);

            _wtxObj.Connect(this.OnConnect, 100);

            await Task.Run(async() =>
            {
                ushort[] _data = await testConnection.SyncData();
            });


            return(_wtxObj.ProcessData.Unit);
        }
コード例 #4
0
        public async Task <string> testModbus_NetGrossValueStringComment(Behavior behavior)
        {
            TestModbusTCPConnection testConnection = new TestModbusTCPConnection(behavior, "172.19.103.8");
            WTXModbus _wtxObj = new WTXModbus(testConnection, 200, update);

            _wtxObj.Connect(this.OnConnect, 100);

            await Task.Run(async() =>
            {
                ushort[] _data = await testConnection.SyncData();
            });

            string strValue = _wtxObj.PrintableWeight.Net;

            return(strValue);
        }
コード例 #5
0
        public async Task <string> testModbus_WeightMovingStringComment(Behavior behavior)
        {
            TestModbusTCPConnection testConnection = new TestModbusTCPConnection(behavior, "172.19.103.8");
            WTXModbus _wtxObj = new WTXModbus(testConnection, 200, update);

            _wtxObj.Connect(this.OnConnect, 100);

            await Task.Run(async() =>
            {
                ushort[] _data = await testConnection.SyncData();
            });

            if (_wtxObj.WeightStable)
            {
                return("0=Weight is not moving.");
            }
            else
            {
                return("1=Weight is moving");
            }
        }