Esempio n. 1
0
        public static InputRegister Parse(SqlString stringToParse)
        {
            if (stringToParse.IsNull)
            {
                return(Null);
            }

            var parsedInputRegisterData = stringToParse.Value.Split(",".ToCharArray());
            var parsedInputRegister     = new InputRegister()
            {
                Address = ModbusAddress.Parse(parsedInputRegisterData[0]), ByteSwap = bool.Parse(parsedInputRegisterData[1]), Value = UInt16.Parse(parsedInputRegisterData[2])
            };

            return(parsedInputRegister);
        }
Esempio n. 2
0
        public static StringRegister Parse(SqlString stringToParse)
        {
            if (stringToParse.IsNull)
            {
                return(Null);
            }

            var parsedStringRegisterData = stringToParse.Value.Split(",".ToCharArray());
            var parsedStringRegister     = new StringRegister()
            {
                Address = ModbusAddress.Parse(parsedStringRegisterData[0]), Length = byte.Parse(parsedStringRegisterData[1]), Value = parsedStringRegisterData[2]
            };

            return(parsedStringRegister);
        }
Esempio n. 3
0
        public static CoilRegister Parse(SqlString stringToParse)
        {
            if (stringToParse.IsNull)
            {
                return(Null);
            }

            var parsedCoilRegisterData = stringToParse.Value.Split(",".ToCharArray());
            var parsedCoilRegister     = new CoilRegister()
            {
                Address = ModbusAddress.Parse(parsedCoilRegisterData[0]), Value = bool.Parse(parsedCoilRegisterData[1])
            };

            return(parsedCoilRegister);
        }
Esempio n. 4
0
        public static ModbusAddress Parse(SqlString stringToParse)
        {
            if (stringToParse.IsNull)
            {
                return(Null);
            }

            var parsedMODBUSAddressData = stringToParse.Value.Split(";".ToCharArray());
            var parsedMODBUSAddress     = new ModbusAddress()
            {
                IsZeroBased = bool.Parse(parsedMODBUSAddressData[0]), RelativeAddress = int.Parse(parsedMODBUSAddressData[1])
            };

            return(parsedMODBUSAddress);
        }