Esempio n. 1
0
        public object GetRealData()
        {
            IfType x   = FactoryType.CreateType(GetDataType());//(m_packet.getDataType());
            object res = x.getRealData(m_packet.getData());

            return(res);
        }
Esempio n. 2
0
        public string GetRealDataToString()
        {
            IfType x   = FactoryType.CreateType(GetDataType());//(m_packet.getDataType());
            string res = x.ToStringRealData(m_packet.getData());

            return(res);
        }
Esempio n. 3
0
        public async Task <bool> SaveRealDataToDbAsync(string adress)
        {
            Packet.DataType type = GetDataType();
            IfType          x    = FactoryType.CreateType(type);

            return(await x.SaveToDbAsync(m_packet.getData(), "127.0.0.1"));
        }
Esempio n. 4
0
        // <summary>
        // check length of date with length
        // </summary>
        public bool checkLengthOfData()
        {
            byte[] data = GetData();

            IfType x        = FactoryType.CreateType((Packet.DataType)GetDataType());
            int    type_len = x.getFieldLength();

            return(type_len == data.Length);
        }
Esempio n. 5
0
        public override Packet.PacketType createWrite(byte[] hexAddress, Packet.DataType type, string strData)
        {
            //byte[] addr = Packet.HexNiblleToAsciiByte(hexAddress);
            int    lenRaw = strData.Length / 2;
            IfType x      = FactoryType.CreateType(type);

            byte[] type_ascii = x.setFieldType();
            byte[] data_ascii = x.setFieldData(strData);
            //m_packet = new Packet(Packet.PacketType.Read, Packet.DataType.Merenja, data_ascii, 0x01);
            return(Packet.PacketType.Write);
        }
Esempio n. 6
0
        public override Packet.PacketType createRead(byte idDest, Packet.DataType command)
        {
            IfType x = FactoryType.CreateType(command);

            byte[] command_data = x.setFieldType();
            byte[] data         = x.setFieldData("0");
            //

            m_packet = new Packet(Packet.PacketType.Read, command_data, data, idDest);

            return(Packet.PacketType.Read);
        }
Esempio n. 7
0
        public override Packet.PacketType createWrite(byte[] hexAddress, Packet.DataType type, byte[] hexData)
        {
            // byte[] addr = Packet.HexNiblleToAsciiByte(hexAddress);

            //byte[] data = Packet.HexNiblleToAsciiByte(hexData);

            IfType x = FactoryType.CreateType(type);

            byte[] type_ascii = x.setFieldType();

            // m_packet = new Packet(Packet.PacketType.Read, Packet.DataType.Merenja, data, 0x01);

            return(Packet.PacketType.Write);
        }
Esempio n. 8
0
        public bool checkMinMax(Packet.DataType type, string input, string min, string max)
        {
            IfType x = FactoryType.CreateType(type);

            return(x.checkMinMax(input, min, max));
        }
Esempio n. 9
0
        public bool checkPattern(Packet.DataType type, string text)
        {
            IfType x = FactoryType.CreateType(type);

            return(x.checkStringPattern(text));
        }