Exemple #1
0
        private void buttonConnect_Click(object sender, EventArgs e)
        {
            try
            {
                //Instant Trackpad Function
                tp_function = new TrackpadFunction();
                tp_thread   = new StatesThread(tp_function);

                //Register Trackpad Event
                tp_function.STEvent += new TrackpadFunction.StateEventHandler(tp_function_STEvent);


                //Instant MultiMeter Fucntion
                mm_fucntion = new MutliMeterFunction();
                mm_thread   = new StatesThread(mm_fucntion);

                //Register MultiMeter Event
                mm_fucntion.STEvent += new MutliMeterFunction.StateEventHandler(mm_fucntion_STEvent);

                tp_thread.run();
                mm_thread.run();
            }
            catch (Exception ex)
            {
                Trace.WriteLine("Error: " + ex.Message);

                tp_function = null;
                tp_thread   = null;


                mm_fucntion = null;
                mm_thread   = null;
            }
        }
Exemple #2
0
        private void buttonConnect_Click(object sender, EventArgs e)
        {
            try
            {

                //Instant Trackpad Function
                tp_function = new TrackpadFunction();
                tp_thread = new StatesThread(tp_function);

                //Register Trackpad Event
                 tp_function.STEvent += new TrackpadFunction.StateEventHandler(tp_function_STEvent);

                //Instant MultiMeter Fucntion
                mm_fucntion = new MutliMeterFunction();
                mm_thread = new StatesThread(mm_fucntion);

                //Register MultiMeter Event
                mm_fucntion.STEvent += new MutliMeterFunction.StateEventHandler(mm_fucntion_STEvent);

                tp_thread.run();
                mm_thread.run();

            }
            catch (Exception ex)
            {
                Trace.WriteLine("Error: " + ex.Message);

                tp_function = null;
                tp_thread = null;

                mm_fucntion = null;
                mm_thread = null;
            }
        }
Exemple #3
0
        private void tp_function_STEvent(object sender, StateMachineEventArgs e)
        {
            if (e.CurrentState == STATE.states.initialize)
            {
                if (e.PassOrFail)
                {
                    tp_ready = true;
                    if (mm_ready)
                    {
                        EnableButtonConnect(false);
                        EnableButtonSleep(true);
                        EnableButtonDeepSleep(true);
                    }
                }
            }

            if (e.CurrentState == STATE.states.exit)
            {
                try
                {
                    mm_thread.exit();

                    EnableButtonConnect(true);
                    EnableButtonSleep(false);
                    EnableButtonDeepSleep(false);

                    serialNumberScanned = false;
                    SetTxtBoxSN("");
                }
                catch { }



                tp_function = null;
                tp_thread   = null;
            }
        }
Exemple #4
0
        //#########################################################################//

        #region State Change

        /// <summary>
        /// The StateMachine EVENT of class TP
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tp_function_STEvent(object sender, StateMachineEventArgs e)
        {
            //trackpad thread init
            if (e.CurrentState == STATE.states.initialize)
            {
                if (e.PassOrFail)
                {
                    tp_ready = true;
                    if (mm_ready)
                    {
                        EnableButtonConnect(false);
                        EnableButtonSleep(true);
                        EnableButtonDeepSleep(true);
                    }
                }
            }

            //Trackpad thread exit
            if (e.CurrentState == STATE.states.exit)
            {
                if (mm_ready)
                {
                    try
                    {
                        EnableButtonConnect(true);
                        EnableButtonSleep(false);
                        EnableButtonDeepSleep(false);

                        serialNumberScanned = false;
                        SetTxtBoxSN("");

                        mm_thread.exit();
                    }
                    catch { }
                }


                tp_ready    = false;
                tp_function = null;
                tp_thread   = null;
            }

            //Trackpad Power On
            if (e.CurrentState == STATE.states.TP_PowerOn)
            {
            }

            //Sleep1
            if (e.CurrentState == STATE.states.TP_SendSleep1Command)
            {
                System.Threading.Thread.Sleep(Config.Delay.EnterSleepMode);

                List <STATE.states> MM_STATES = new List <STATE.states>();

                for (int i = 0; i < Config.MEAS_TIMES; i++)
                {
                    MM_STATES.Add(STATE.states.MM_ReadCurr);
                }
                MM_STATES.Add(STATE.states.MM_CalcSleep1Curr);

                mm_thread.en_queue(MM_STATES);
            }

            //Deep Sleep
            if (e.CurrentState == STATE.states.TP_SendDeepSleepCommand)
            {
                System.Threading.Thread.Sleep(Config.Delay.EnterSleepMode);

                List <STATE.states> MM_STATES = new List <STATE.states>();

                for (int i = 0; i < Config.MEAS_TIMES; i++)
                {
                    MM_STATES.Add(STATE.states.MM_ReadCurr);
                }
                MM_STATES.Add(STATE.states.MM_CalcDeepSleepCurr);

                mm_thread.en_queue(MM_STATES);
            }

            //Trackpad Power Off
            if (e.CurrentState == STATE.states.TP_PowerOff)
            {
                //mm_thread.en_queue(STATE.states.idle);
            }
        }
Exemple #5
0
        /// <summary>
        /// The StateMachine EVENT of class TP
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tp_function_STEvent(object sender, StateMachineEventArgs e)
        {
            //trackpad thread init
            if (e.CurrentState == STATE.states.initialize)
            {
                if (e.PassOrFail)
                {
                    tp_ready=true;
                    if (mm_ready)
                    {
                        EnableButtonConnect(false);
                        EnableButtonSleep(true);
                        EnableButtonDeepSleep(true);

                    }
                }
            }

            //Trackpad thread exit
            if (e.CurrentState == STATE.states.exit)
            {

                if (mm_ready)
                {
                    try
                    {
                        EnableButtonConnect(true);
                        EnableButtonSleep(false);
                        EnableButtonDeepSleep(false);

                        serialNumberScanned = false;
                        SetTxtBoxSN("");

                        mm_thread.exit();
                    }
                    catch { }
                }

                tp_ready = false;
                tp_function = null;
                tp_thread = null;

            }

            //Trackpad Power On
            if (e.CurrentState == STATE.states.TP_PowerOn)
            {

            }

            //Sleep1
            if (e.CurrentState == STATE.states.TP_SendSleep1Command)
            {
                System.Threading.Thread.Sleep(Config.Delay.EnterSleepMode);

                List<STATE.states> MM_STATES = new List<STATE.states>();

                for (int i = 0; i < Config.MEAS_TIMES; i++)
                {
                    MM_STATES.Add(STATE.states.MM_ReadCurr);
                }
                MM_STATES.Add(STATE.states.MM_CalcSleep1Curr);

                mm_thread.en_queue(MM_STATES);
            }

            //Deep Sleep
            if (e.CurrentState==STATE.states.TP_SendDeepSleepCommand)
            {
                System.Threading.Thread.Sleep(Config.Delay.EnterSleepMode);

                List<STATE.states> MM_STATES = new List<STATE.states>();

                for (int i = 0; i < Config.MEAS_TIMES; i++)
                {
                    MM_STATES.Add(STATE.states.MM_ReadCurr);
                }
                MM_STATES.Add(STATE.states.MM_CalcDeepSleepCurr);

                mm_thread.en_queue(MM_STATES);
            }

            //Trackpad Power Off
            if (e.CurrentState==STATE.states.TP_PowerOff)
            {
                //mm_thread.en_queue(STATE.states.idle);
            }
        }
Exemple #6
0
        private void tp_function_STEvent(object sender, StateMachineEventArgs e)
        {
            if (e.CurrentState == STATE.states.initialize)
            {
                if (e.PassOrFail)
                {
                    tp_ready=true;
                    if (mm_ready)
                    {
                        EnableButtonConnect(false);
                        EnableButtonSleep(true);
                        EnableButtonDeepSleep(true);

                    }
                }
            }

            if (e.CurrentState == STATE.states.exit)
            {
                try
                {
                    mm_thread.exit();

                    EnableButtonConnect(true);
                    EnableButtonSleep(false);
                    EnableButtonDeepSleep(false);

                    serialNumberScanned = false;
                    SetTxtBoxSN("");
                }
                catch { }

                tp_function = null;
                tp_thread = null;

            }
        }