Ejemplo n.º 1
0
        public override void DeSerialize(byte[] data)
        {
            Version = data[0];
            Cells   = data[1];

            ActiveEAM   = ((Sensors)data[2] & Sensors.EAM) == Sensors.EAM;
            ActiveGAM   = ((Sensors)data[2] & Sensors.GAM) == Sensors.GAM;
            ActiveGPS   = ((Sensors)data[2] & Sensors.GPS) == Sensors.GPS;
            ActiveVario = ((Sensors)data[2] & Sensors.Vario) == Sensors.Vario;

            GPSAltSource             = (AltSourceEnum)data[3];
            GPSFlightdirectionSource = (FlightDirSourceEnum)data[4];
            int offset = 5;

            List <VoltageAlarm> voltageAlarms = new List <VoltageAlarm>();

            for (int i = 0; i < VOLTAGE_ALARMS; i++)
            {
                VoltageAlarm alarm = new VoltageAlarm();
                alarm.Voltage  = data[offset++];
                alarm.Tone     = (HoTTAlarmTone)data[offset++];
                alarm.Interval = data[offset++];
                alarm.Repeat   = data[offset++];
                alarm.Invert   = data[offset++] > 0;
                voltageAlarms.Add(alarm);
            }
            VoltageAlarms = voltageAlarms.ToArray();

            List <DistanceAlarm> distanceAlarms = new List <DistanceAlarm>();

            for (int i = 0; i < DISTANCE_ALARMS; i++)
            {
                DistanceAlarm alarm = new DistanceAlarm();
                alarm.Distance = Converter.ToUInt16(data, offset++); offset++;
                alarm.Tone     = (HoTTAlarmTone)data[offset++];
                alarm.Interval = data[offset++];
                alarm.Repeat   = data[offset++];
                alarm.Invert   = data[offset++] > 0;
                distanceAlarms.Add(alarm);
            }
            DistanceAlarms = distanceAlarms.ToArray();
        }
Ejemplo n.º 2
0
        public ProtocolHoTTConfiguration()
            : base()
        {
            Version = 1;

            Cells                    = 3;
            GPSAltSource             = AltSourceEnum.Baro;
            GPSFlightdirectionSource = FlightDirSourceEnum.GPS;

            ActiveGPS   = true;
            ActiveEAM   = true;
            ActiveGAM   = true;
            ActiveVario = true;

            VoltageAlarms = new VoltageAlarm[] {
                new VoltageAlarm()
                {
                    Voltage = 20, Tone = HoTTAlarmTone.Tone_P, Interval = 8, Invert = true, Repeat = 0
                },
                new VoltageAlarm()
                {
                    Voltage = 10, Tone = HoTTAlarmTone.Tone_R, Interval = 5, Invert = true, Repeat = 0
                },
                new VoltageAlarm()
                {
                    Voltage = 5, Tone = HoTTAlarmTone.Tone_S, Interval = 2, Invert = true, Repeat = 0
                },
            };
            DistanceAlarms = new DistanceAlarm[] {
                new DistanceAlarm()
                {
                    Distance = 3000, Tone = HoTTAlarmTone.Tone_D, Interval = 10, Invert = true, Repeat = 0
                },
                new DistanceAlarm(),
                new DistanceAlarm(),
            };
        }