Beispiel #1
0
 public TemperatueBoard(UInt16 Id, TemperatureConfig newconfig)
 {
     id       = Id;
     type     = (int)SensorType.TEMPBOARD;
     online   = true;
     online_t = false;
     port     = -1;
     for (int i = 0; i < 16; i++)
     {
         temperature[i] = 0x4000;
         if (Id == newconfig.id)
         {
             config[i] = newconfig.config[i];
         }
     }
     newindata           = false;
     uploadcreatenewfile = true;
 }
Beispiel #2
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();
        }
Beispiel #3
0
 public TemperatueBoard(UInt16 Id, TemperatureConfig newconfig)
 {
     id = Id;
     type = (int)SensorType.TEMPBOARD;
     online = true;
     online_t = false;
     port = -1;
     for (int i = 0; i < 16; i++)
     {
         temperature[i] = 0x4000;
         if(Id == newconfig.id)
             config[i] = newconfig.config[i];
     }
     newindata = false;
     uploadcreatenewfile = true;
 }