/// <summary>
 /// Method to send the data to the learning hub
 /// </summary>
 private void SendData()
 {
     try
     {
         List <string> values = new List <string>();
         values.Add(OrientationW.ToString());
         values.Add(OrientationX.ToString());
         values.Add(OrientationY.ToString());
         values.Add(OrientationZ.ToString());
         values.Add(AccelerometerX.ToString());
         values.Add(AccelerometerY.ToString());
         values.Add(AccelerometerZ.ToString());
         values.Add(GyroscopeX.ToString());
         values.Add(GyroscopeY.ToString());
         values.Add(GyroscopeZ.ToString());
         values.Add(GripPressure.ToString());
         values.Add(EMGdata[0].ToString());
         values.Add(EMGdata[1].ToString());
         values.Add(EMGdata[2].ToString());
         values.Add(EMGdata[3].ToString());
         values.Add(EMGdata[4].ToString());
         values.Add(EMGdata[5].ToString());
         values.Add(EMGdata[6].ToString());
         values.Add(EMGdata[7].ToString());
         myConnector.storeFrame(values);
     }
     catch (Exception ex)
     {
         //Debug.WriteLine(ex.StackTrace);
         if (DebugText != ex.ToString())
         {
             DebugText = ex.ToString();
         }
     }
 }
Esempio n. 2
0
        public void UpdateSensorValues(string[] rawValues)
        {
            if (rawValues == null || rawValues.Length == 0)
            {
                throw new Exception("Incomming data is incomplete");
            }

            Slider.UpdateValue(Convert.ToInt16(rawValues[SensorValuesOrderTable.SliderOrder]));
            LightSensor.UpdateValue(Convert.ToInt16(rawValues[SensorValuesOrderTable.LightSensorOrder]));
            Temperature.UpdateValue(Convert.ToInt16(rawValues[SensorValuesOrderTable.TemperatureOrder]));
            Microphone.UpdateValue(Convert.ToInt16(rawValues[SensorValuesOrderTable.MicrophoneOrder]));

            JoystickSwitch.UpdateValue(Convert.ToInt16(rawValues[SensorValuesOrderTable.JoystickSwitchOrder]));
            JoystickButton.UpdateValue(rawValues[SensorValuesOrderTable.JoystickButtonOrder] != "1");

            AccelerometerX.UpdateValue(Convert.ToInt16(rawValues[SensorValuesOrderTable.AccelerometerXOrder]));
            AccelerometerY.UpdateValue(Convert.ToInt16(rawValues[SensorValuesOrderTable.AccelerometerYOrder]));
            AccelerometerZ.UpdateValue(Convert.ToInt16(rawValues[SensorValuesOrderTable.AccelerometerZOrder]));

            ButtonDown.UpdateValue(rawValues[SensorValuesOrderTable.ButtonDownOrder] != "1");
            ButtonLeft.UpdateValue(rawValues[SensorValuesOrderTable.ButtonLeftOrder] != "1");
            ButtonUp.UpdateValue(rawValues[SensorValuesOrderTable.ButtonUpOrder] != "1");
            ButtonRight.UpdateValue(rawValues[SensorValuesOrderTable.ButtonRightOrder] != "1");

            JoystickX.UpdateValue(Convert.ToInt16(rawValues[SensorValuesOrderTable.JoystickXOrder]));
            JoystickY.UpdateValue(Convert.ToInt16(rawValues[SensorValuesOrderTable.JoystickYOrder]));

            LedRed.UpdateValue(Convert.ToByte(rawValues[SensorValuesOrderTable.LedRedOrder]));
            LedGreen.UpdateValue(Convert.ToByte(rawValues[SensorValuesOrderTable.LedGreenOrder]));
            LedBlue.UpdateValue(Convert.ToByte(rawValues[SensorValuesOrderTable.LedBlueOrder]));
        }
Esempio n. 3
0
        /// <summary>
        /// Method to send the data to the learning hub
        /// </summary>
        private void SendData()
        {
            try
            {
                List <string> TempValues = new List <string>();
                TempValues.Add(OrientationW.ToString());
                TempValues.Add(OrientationX.ToString());
                TempValues.Add(OrientationY.ToString());
                TempValues.Add(OrientationZ.ToString());
                TempValues.Add(AccelerometerX.ToString());
                TempValues.Add(AccelerometerY.ToString());
                TempValues.Add(AccelerometerZ.ToString());
                TempValues.Add(GyroscopeX.ToString());
                TempValues.Add(GyroscopeY.ToString());
                TempValues.Add(GyroscopeZ.ToString());
                TempValues.Add(EMGdata[0].ToString());
                TempValues.Add(EMGdata[1].ToString());
                TempValues.Add(EMGdata[2].ToString());
                TempValues.Add(EMGdata[3].ToString());
                TempValues.Add(EMGdata[4].ToString());
                TempValues.Add(EMGdata[5].ToString());
                TempValues.Add(EMGdata[6].ToString());
                TempValues.Add(EMGdata[7].ToString());

                ValuesChangedEventArgs e = new ValuesChangedEventArgs();
                e.values = TempValues;
                OnValuesChanged(e);
            }
            catch (Exception ex)
            {
                //Debug.WriteLine(ex.StackTrace);
                if (DebugText != ex.ToString())
                {
                    DebugText = ex.ToString();
                }
            }
        }