Exemplo n.º 1
0
        private void Load_button_Click(object sender, EventArgs e)
        {
            button_load.Enabled = false;
            Application.DoEvents();

            if (checkBox_LoadAll.Checked && (current_command.CompareTo("all") == 0))
            {
                info_panel_clean_text_fields();
                Application.DoEvents();

                //LoadWocketsParameters();
            }
            else
            {
                Command cmd;
                switch (current_command)
                {
                    case "hw_version":
                        info_cmd_value_hwversion.Text = "";
                        Application.DoEvents();
                        cmd = new GET_HV();
                        ((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(cmd._Bytes);
                        break;
                    case "sw_version":
                        info_cmd_value_swversion.Text = "";
                        Application.DoEvents();
                        cmd = new GET_FV();
                        ((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(cmd._Bytes);
                        break;
                    case "packet_count":
                        info_cmd_value_pkt_count.Text = "";
                        Application.DoEvents();
                        //cmd = new GET_PC();
                        //((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(cmd._Bytes);
                        break;
                    case "battery_level":
                        info_cmd_value_battery_level.Text = "";
                        Application.DoEvents();
                        cmd = new GET_BT();
                        ((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(cmd._Bytes);
                        break;
                    case "battery_percent":
                        info_cmd_value_btpercent.Text = "";
                        Application.DoEvents();
                        cmd = new GET_BP();
                        ((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(cmd._Bytes);
                        break;
                    case "battery_calibration":
                        info_cmd_value_btcalibration.Text = "";
                        Application.DoEvents();
                        cmd = new GET_BTCAL();
                        ((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(cmd._Bytes);
                        break;
                    case "calibration":
                        info_cmd_value_calibration.Text = "";
                        Application.DoEvents();
                        cmd = new GET_CAL();
                        ((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(cmd._Bytes);
                        break;
                    case "sensor_sensitivity":
                        info_cmd_value_sensitivity.Text = "";
                        Application.DoEvents();
                        cmd = new GET_SEN();
                        ((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(cmd._Bytes);
                        break;
                    case "transmission_mode":
                        info_cmd_value_tr_rate.Text = "";
                        Application.DoEvents();
                        cmd = new GET_TM();
                        ((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(cmd._Bytes);
                        break;
                    case "sampling_rate":
                        info_cmd_value_sampling_rate.Text = "";
                        Application.DoEvents();
                        cmd = new GET_SR();
                        ((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(cmd._Bytes);
                        break;
                    case "power_down":
                        info_cmd_value_pwr_timeout.Text = "";
                        Application.DoEvents();
                        cmd = new GET_PDT();
                        ((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(cmd._Bytes);
                        break;
                }
            }

            button_load.Enabled = true;
        }
Exemplo n.º 2
0
        private void cal_panel_button_ok_Click(object sender, EventArgs e)
        {
            // if sensor data file is valid
            if (is_sensordata_valid)
            {

                if (current_command.CompareTo("calibration") == 0)
                {
                    // set the calibration parameters
                    // SET_CAL setcal = new SET_CAL();
                    //((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(setcal._Bytes);

                    //clean field
                    info_cmd_value_calibration.Text = "";
                    Application.DoEvents();
                    //System.Threading.Thread.Sleep(200);

                    // get the calibration parameters
                    GET_CAL cal = new GET_CAL();
                    ((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(cal._Bytes);
                }
                else if( current_command.CompareTo("battery_calibration") == 0)
                {
                    // set the battery calibration parameters
                    // SET_BTCAL btcal = new SET_BTCAL();
                    //((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(btcal._Bytes);

                    //clean field
                    info_cmd_value_btcalibration.Text = "";
                    Application.DoEvents();
                    System.Threading.Thread.Sleep(200);

                    // get the calibration parameters
                    GET_BTCAL btcal = new GET_BTCAL();
                    ((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(btcal._Bytes);
                }

                //restore status panel
                restore_status_panel();

            }
            else
            {
                if(current_command.CompareTo("calibration") == 0)
                    cal_panel_label_status.Text = "The path for the sensordata file is not valid. Please enter a valid file or click CANCEL to exit.";
                else if(current_command.CompareTo("battery_calibration") == 0)
                    cal_panel_label_status.Text = "The path for the battery calibration file is not valid. Please enter a valid file or click CANCEL to exit.";

            }
        }
Exemplo n.º 3
0
        private void LoadWocketsParameters()
        {
            Command cmd;

            //-----  Read the commands when the form is loaded  -------
            cmd = new GET_FV();
            ((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(cmd._Bytes);

            cmd = new GET_HV();
            ((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(cmd._Bytes);

            //cmd = new GET_PC();
            //((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(cmd._Bytes);

            cmd = new GET_BT();
            ((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(cmd._Bytes);

            cmd = new GET_BP();
            ((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(cmd._Bytes);

            cmd = new GET_BTCAL();
            ((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(cmd._Bytes);

            cmd = new GET_CAL();
            ((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(cmd._Bytes);

            cmd = new GET_SEN();
            ((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(cmd._Bytes);

            cmd = new GET_TM();
            ((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(cmd._Bytes);

            cmd = new GET_SR();
            ((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(cmd._Bytes);

            cmd = new GET_PDT();
            ((RFCOMMReceiver)CurrentWockets._Controller._Receivers[0]).Write(cmd._Bytes);
        }