Пример #1
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]));
        }