Beispiel #1
0
        public bool ManualControl(UserWeb mysql, SerialPort Dongle)
        {
            reader = mysql.GetQuery("select * from manual");
            while (reader.Read())
            {
                control_unit = (string)reader[0];
            }
            reader.Close();
            if (control_unit.Equals(" "))
            {
                reader.Close();
                return(false);
            }
            if (control_unit.Equals("LmotorOn"))//on
            {
                Dongle.Write("A");
            }
            else if (control_unit.Equals("LmotorOff"))//off
            {
                Dongle.Write("B");
            }
            else if (control_unit.Equals("BmotorOn"))//on
            {
                Dongle.Write("C");
            }
            else if (control_unit.Equals("BmotorOff"))
            {
                Dongle.Write("D");
            }
            else if (control_unit.Equals("exWinOn"))//on
            {
                Dongle.Write("E");
            }
            else if (control_unit.Equals("exWinOff"))
            {
                Dongle.Write("F");
            }

            mysql.PutQuery("update manual set Mfield=' ' where list=1");
            return(true);
        }
Beispiel #2
0
 private void DBConnection_Click(object sender, EventArgs e)
 {
     if (Mysql == null)
     {
         Mysql        = new UserWeb(MsgEngine);
         isOnDB       = true;
         DBLabel.Text = "DB ON";
     }
     else
     {
         if (isOnPort == true)
         {
             MsgEngine.Enqueue("first, terminate SerialPort.");
             return;
         }
         isOnDB = false;
         Mysql.terminated();
         Mysql = null;
         MsgEngine.Enqueue("Mysql is closed..");
         DBLabel.Text = "DB OFF";
     }
 }
Beispiel #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            List <string> listOfCOM = GetConnectComDevice();

            foreach (string COM in listOfCOM)
            {
                Port_COM.Items.Add(COM);
            }


            MsgEngine    = new interfaceEngine(500);
            InsEngine    = new interfaceEngine(500);
            Sender       = new Protocol();
            Proto        = new string[5];
            Proto[0]     = "LTemp";
            Proto[1]     = "LHumi";
            Proto[2]     = "BTemp";
            Proto[3]     = "BHumi";
            Proto[4]     = "Parking";
            Mysql        = new UserWeb(MsgEngine);
            isOnDB       = true;
            DBLabel.Text = "DB ON";
        }