Ejemplo n.º 1
0
        public bool command_hi(SerialCommand.CommandReturn ret, String data)
        {
            string[] prm = data.Split(';');
            if (prm.Length > 3 && prm[0].Equals("hi") && prm[1].Length == 23)
            {
                Console.WriteLine(prm[1]);
                ArrayList opt = new ArrayList();
                for (int i = 3; i < prm.Length; i++)
                {
                    if (prm[i].Contains("+") && !opt.Contains(prm[i]))
                    {
                        opt.Add(prm[i]);
                    }
                }

                this.UUID      = prm[1];
                this.FlashSize = Int32.Parse(prm[2]);
                this.options   = opt;

                this.authenticated = true;

                Console.WriteLine(this.toString());
            }

            return(true);
        }
Ejemplo n.º 2
0
 public bool updateTimeGUI(SerialCommand.CommandReturn res, String data)
 {
     if (res == SerialCommand.CommandReturn.COMMAND_OK)
     {
         this.form.UpdateRefreshTime(updateTime.ToString());
     }
     return(true);
 }
Ejemplo n.º 3
0
 public bool command_dhtadd(SerialCommand.CommandReturn ret, String data)
 {
     if (ret == SerialCommand.CommandReturn.COMMAND_OK)
     {
         refreshSensors();
     }
     return(true);
 }
Ejemplo n.º 4
0
 public bool command_del(SerialCommand.CommandReturn ret, String data)
 {
     if (ret == SerialCommand.CommandReturn.COMMAND_OK)
     {
         string sresultString = Regex.Match(data, @"\d+").Value;
         int    index;
         if (Int32.TryParse(sresultString, out index))
         {
             removesensor(index, true);
             Console.WriteLine("Del sensor:" + index);
         }
     }
     return(true);
 }
Ejemplo n.º 5
0
 public bool command_list(SerialCommand.CommandReturn ret, String data)
 {
     if (ret == SerialCommand.CommandReturn.COMMAND_OK)
     {
         string[] subPars = data.Split(
             new[] { "\r\n" },     //, "\r", "\n", "\n\r"
             StringSplitOptions.None
             );
         for (int i = 1; i < subPars.Length; i++)
         {
             addSensor(subPars[i]);
             Console.WriteLine("Sensor: " + subPars[i]);
         }
     }
     else if (ret == SerialCommand.CommandReturn.COMMAND_TIMEOUT)
     {
     }
     return(true);
 }
Ejemplo n.º 6
0
 public bool pwmCommandSet(SerialCommand.CommandReturn ret, String data)
 {
     UpdatePWMValue(actualPWM.ToString());
     return(true);
 }
Ejemplo n.º 7
0
 public bool command_load(SerialCommand.CommandReturn ret, String data)
 {
     return(true);
 }