Beispiel #1
0
        private void mainForm_Load(object sender, EventArgs e)
        {
            _chronos = new Chronos();
            try
            {
                _chronos.OpenComPort(_chronos.GetComPortName());
            }
            catch
            {
                MessageBox.Show("Error cannot open port. Please check USB is connected");
                return;
            }

            if (_chronos.GetID(out _chronosId))
            {
                textBox1.AppendText(string.Concat("Chronos ID = ", _chronosId.ToString()) + System.Environment.NewLine);
            }
            _chronos.StartSimpliciTI();
            _list_AccX = new PointPairList();
            _list_AccY = new PointPairList();
            _list_AccZ = new PointPairList();
            _list_Temp = new PointPairList();
            _list_Alt = new PointPairList();
        }
Beispiel #2
0
        public void handleSimpliciTI()
        {
            chron = new Chronos();

               while (true)
               {
               try
               {
                   chron.OpenComPort(chron.GetComPortName());
                   writeLog("Found access point on port: " + chron.GetComPortName());
                   break;
               }
               catch (Exception)
               {
                   System.Threading.Thread.Sleep(1000);
               }
               }

               chron.StartSimpliciTI();

               writeLog("SimpliciTI started");

               while (true)
               {
               uint data;
               if (!chron.GetData(out data))
                   break;

               if(data!=0xFF)
                  writeLog("Got data: "+data);

               //Star
               if (data == 2)
               {
                   key.pressKey(0x44);
               }
               if (data == 3)
               {
                   key.releaseKey(0x44);
               }

               //NUM
               if (data == 4)
               {
                   key.pressKey(0x41);
               }
               if (data == 5)
               {
                   key.releaseKey(0x41);
               }

               //UP
               if (data == 6)
               {
                   key.pressKey(0x57);
               }
               if (data == 7)
               {
                   key.releaseKey(0x57);
               }

               }

               writeLog("Error!");
        }