public void InitComponent()
 {
     dlgCom = new ComSettings();
     sdk2Com = new INEMO2_Device();
     dlgSensorSetting = new frmSensorSettings(sdk2Com);
     DeviceData = new INEMO2_FrameData();
     toolStripTxtSamples.Text = "1000";
     toolStripTxtSamples.AutoSize = false;
     toolStripTxtSamples.Width = 15;
     TCPMessages = new List<string>();
     m_Server = null;
     dbgTrace = null;
     availableModules = INEMO2_MODULES.INEMO2_MODULES_NONE;
     Settings.Click += new EventHandler(Settings_Click);
     toolStripCmbMode.SelectedIndexChanged += new EventHandler(toolStripCmbMode_SelectedIndexChanged);
     toolStripBtnConnect.Click += new EventHandler(toolStripBtnConnect_Click);
     toolStripBtnSensorSetting.Click += new EventHandler(toolStripBtnSensorSetting_Click);
     toolStripBtnStart.Click += new EventHandler(toolStripBtnStart_Click);
     toolStripBtnStop.Click += new EventHandler(toolStripBtnStop_Click);
     Connect.Click += new EventHandler(toolStripBtnConnect_Click);
     SensorSetting.Click += new EventHandler(toolStripBtnSensorSetting_Click);
     Start.Click += new EventHandler(toolStripBtnStart_Click);
     Stop.Click += new EventHandler(toolStripBtnStop_Click);
     ResetDevice.Click += new EventHandler(ResetDevice_Click);
     Enter_DFU_Mode.Click += new EventHandler(Enter_DFU_Mode_Click);
     Trace.Click += new EventHandler(Trace_Click);
     Identify.Click += new EventHandler(Identify_Click);
     toolStripTxtSamples.TextChanged += new EventHandler(toolStripTxtSamples_TextChanged);
     Samples.Click += new EventHandler(Samples_Click);
     Continous.Click += new EventHandler(Continous_Click);
     dlgSensorSetting.OnMessageToLogSettings = (MessageToLog) Delegate.Combine(dlgSensorSetting.OnMessageToLogSettings, new MessageToLog(MessageToLogFromSetting));
     TimerGetSamples.Interval = 30;
     TimerGetSamples.Enabled = false;
     base.DeviceConnected = false;
     toolStripBtnStart.Enabled = false;
     toolStripBtnStop.Enabled = false;
     toolStripLblNumSamples.Visible = false;
     toolStripBtnSensorSetting.Enabled = false;
     SensorSetting.Enabled = false;
     Start.Enabled = false;
     Stop.Enabled = false;
     toolStripProgressBarAcqSample.Visible = true;
     toolStripCmbMode.SelectedIndex = 1;
     Clear();
 }
Beispiel #2
0
 public INEMO2_DeviceError GetSample(ref INEMO2_FrameData data)
 {
     return(INEMO2_GetDataSample(m_DeviceHandle, ref data));
 }
Beispiel #3
0
 private static extern INEMO2_DeviceError INEMO2_GetDataSample(INEMO2_DeviceHandle hHandle, ref INEMO2_FrameData pFrame);
Beispiel #4
0
 public override void LoadDataFile(string strFileToLoad)
 {
     StreamReader reader = null;
     string[] strArray;
     INEMO2_FrameData structure = new INEMO2_FrameData();
     bool flag = true;
     this.Cursor = Cursors.WaitCursor;
     if (base.OnMessageToLog != null)
     {
         base.OnMessageToLog("Loading data file [" + strFileToLoad + "]");
     }
     try
     {
         reader = new StreamReader(strFileToLoad);
     }
     catch (Exception exception)
     {
         if (base.OnMessageToLog != null)
         {
             base.OnMessageToLog("Error opening the selected file :" + exception.Message);
         }
         MessageBox.Show("Error opening the selected file :" + exception.Message);
         flag = false;
     }
     if (flag)
     {
         try
         {
             bool flag2 = false;
             strArray = reader.ReadLine().Split(new char[] { '\t' }, 0x13);
             if (((strArray.Length <= 0x13) && (strArray[0] == "Timestamp")) && (strArray[10] == "Pressure"))
             {
                 flag2 = true;
                 if (((strArray.Length == 0x13) && (strArray[12] == "Roll")) && (strArray[0x12] == "Q3"))
                 {
                     this.EnableRotationDataView = true;
                 }
             }
             if (!flag2)
             {
                 if (base.OnMessageToLog != null)
                 {
                     base.OnMessageToLog("Unkwnon file format [" + strFileToLoad + "]");
                 }
                 flag = false;
             }
         }
         catch
         {
             if (base.OnMessageToLog != null)
             {
                 base.OnMessageToLog("Unkwnon header file format [" + strFileToLoad + "] ");
             }
             flag = false;
         }
     }
     if (flag)
     {
         try
         {
             string str;
             while ((str = reader.ReadLine()) != null)
             {
                 strArray = str.Split(new char[] { '\t' }, 0x13);
                 structure.Size = (uint) Marshal.SizeOf(structure);
                 structure.ValidFields = INEMO2_FRAME_VALID_FIELD.FRAME_DATA_VALID_FIELD_ALL_SENS;
                 structure.TimeStamp = Convert.ToUInt32(strArray[0]);
                 structure.Accelometer.X = Convert.ToInt16(strArray[1]);
                 structure.Accelometer.Y = Convert.ToInt16(strArray[2]);
                 structure.Accelometer.Z = Convert.ToInt16(strArray[3]);
                 structure.Gyroscope.X = Convert.ToInt16(strArray[4]);
                 structure.Gyroscope.Y = Convert.ToInt16(strArray[5]);
                 structure.Gyroscope.Z = Convert.ToInt16(strArray[6]);
                 structure.Magnetic.X = Convert.ToInt16(strArray[7]);
                 structure.Magnetic.Y = Convert.ToInt16(strArray[8]);
                 structure.Magnetic.Z = Convert.ToInt16(strArray[9]);
                 structure.Pressure = Convert.ToUInt16(strArray[10]);
                 structure.Temperature = Convert.ToInt16(strArray[11]);
                 if (strArray.Length == 0x13)
                 {
                     structure.ValidFields = INEMO2_FRAME_VALID_FIELD.FRAME_DATA_VALID_FIELD_ALL;
                     structure.Rot.Roll = (float) Convert.ToDouble(strArray[12]);
                     structure.Rot.Pitch = (float) Convert.ToDouble(strArray[13]);
                     structure.Rot.Yaw = (float) Convert.ToDouble(strArray[14]);
                     structure.Quat.Q0 = (float) Convert.ToDouble(strArray[15]);
                     structure.Quat.Q1 = (float) Convert.ToDouble(strArray[0x10]);
                     structure.Quat.Q2 = (float) Convert.ToDouble(strArray[0x11]);
                     structure.Quat.Q3 = (float) Convert.ToDouble(strArray[0x12]);
                 }
                 this.AddDataObject(structure);
             }
         }
         catch (Exception exception2)
         {
             if (base.OnMessageToLog != null)
             {
                 base.OnMessageToLog("Error reading line " + exception2.Message);
             }
             flag = false;
         }
     }
     if (flag)
     {
         this.ThereAreDataNotSaved = false;
         if (base.OnMessageToLog != null)
         {
             base.OnMessageToLog("Loaded data file [" + strFileToLoad + "]");
         }
     }
     reader.Close();
     this.Cursor = Cursors.Default;
 }
Beispiel #5
0
 private static extern INEMO2_DeviceError INEMO2_GetDataSample(INEMO2_DeviceHandle hHandle, ref INEMO2_FrameData pFrame);
Beispiel #6
0
 public INEMO2_DeviceError GetSample(ref INEMO2_FrameData data)
 {
     return INEMO2_GetDataSample(this.m_DeviceHandle, ref data);
 }