Beispiel #1
0
 public PumpBoard(UInt16 Id, FlowrateConfig newconfig)
 {
     id       = Id;
     type     = (int)SensorType.PUMPBOARD;
     online   = false;
     online_t = false;
     port     = -1;
     for (int i = 0; i < 8; i++)
     {
         flowrate[i] = 0;
         if (Id == newconfig.id)
         {
             config[i] = newconfig.config[i];
         }
     }
     newindata = false;
     for (int i = 0; i < 8; i++)
     {
         pumpvalue[i] = 0;
     }
     for (int i = 0; i < 8; i++)
     {
         pumpspeed[i] = 65535;
     }
     newoutdata          = false;
     uploadcreatenewfile = true;
 }
Beispiel #2
0
 public PumpBoard(UInt16 Id,FlowrateConfig newconfig)
 {
     id = Id;
     type = (int)SensorType.PUMPBOARD;
     online = false;
     online_t = false;
     port = -1;
     for (int i = 0; i < 8; i++)
     {
         flowrate[i] = 0;
         if (Id == newconfig.id)
             config[i] = newconfig.config[i];
     }
     newindata = false;
     for (int i = 0; i < 8; i++)
         pumpvalue[i] = 0;
     for (int i = 0; i < 8; i++)
         pumpspeed[i] = 65535;
     newoutdata = false;
     uploadcreatenewfile = true;
 }
Beispiel #3
0
        private void ReadConfig(string dir, ref ArrayList array, int mode)
        {
            FileStream fs;
            StreamReader sr;
            var fileMode = FileMode.Open;
            fs = new FileStream(dir, fileMode, FileAccess.Read);
            sr = new StreamReader(fs, Encoding.Default);
            /*
            if (mode == 1)
            {
                try
                {
                    while (true)
                    {
                        string line = sr.ReadLine();
                        if (line.StartsWith("#"))
                            continue;
                        if (line.Length < 3)
                            continue;
                        string[] split1 = line.Split(':');
                        string[] split2 = split1[1].Split(',');
                        TemperatureConfig newconfig = new TemperatureConfig();
                        try
                        {
                            newconfig.id = UInt16.Parse(split1[0]);
                            for (int i = 0; i < 16; i++)
                            {
                                newconfig.config[i] = int.Parse(split2[i]);
                            }
                        }
                        catch
                        {
                        }
                        Temperatureconfig.Add(newconfig);
                    }
                }
                catch
                {
                }
            }
            else*/ if (mode == 2)
            {
                try
                {
                    while (true)
                    {
                        string line = sr.ReadLine();
                        if (line.StartsWith("#"))
                            continue;
                        if (line.Length < 3)
                            continue;
                        string[] split1 = line.Split(':');
                        string[] split2 = split1[1].Split(',');
                        FlowrateConfig newconfig = new FlowrateConfig();
                        try
                        {
                            newconfig.id = UInt16.Parse(split1[0]);
                            for (int i = 0; i < 8; i++)
                            {
                                newconfig.config[i] = int.Parse(split2[i]);
                            }
                        }
                        catch
                        {
                        }
                        Flowrateconfig.Add(newconfig);
                    }
                }
                catch
                {
                }
            }
            /*
            else if (mode == 3)
            {
                try
                {
                    while (true)
                    {
                        string line = sr.ReadLine();
                        if (line.StartsWith("#"))
                            continue;
                        if (line.Length < 3)
                            continue;
                        string[] split1 = line.Split(':');
                        TelosbConfig newconfig = new TelosbConfig();
                        try
                        {
                            newconfig.id = UInt16.Parse(split1[0]);
                            newconfig.config = int.Parse(split1[1]);
                        }
                        catch
                        {
                        }
                        Telosbconfig.Add(newconfig);
                    }
                }
                catch
                {
                }
            }
            */
            else
            {
            }

            sr.Close();
            fs.Close();
        }