protected override void ResetVariables()
        {
            base.ResetVariables();

            currentNavigationDataStruct = new NavigationDataStruct();
            currentNavigationDataHeaderStruct = new NavigationDataHeaderStruct();

            currentNavigationData = new DroneData();

            currentSequenceNumber = initialSequenceNumber;
        }
        private void updateInstruments()
        {
            DroneData droneData = null;
            if (droneControl.IsConnected)
               droneData = droneControl.NavigationData;
            else
                droneData = new DroneData();

            foreach (InstrumentControl instrumentControl in instrumentList)
            {
                try
                {
                    switch (instrumentControl.GetType().Name)
                    {
                        case "AttitudeIndicatorInstrumentControl":
                            updateInstrument((AttitudeIndicatorInstrumentControl)instrumentControl, droneData);
                            break;

                        case "AltimeterInstrumentControl":
                            updateInstrument((AltimeterInstrumentControl)instrumentControl, droneData);
                            break;

                        case "HeadingIndicatorInstrumentControl":
                            updateInstrument((HeadingIndicatorInstrumentControl)instrumentControl, droneData);
                            break;
                        case "VerticalSpeedIndicatorInstrumentControl":
                            updateInstrument((VerticalSpeedIndicatorInstrumentControl)instrumentControl, droneData);
                            break;
                    }
                }
                catch (InvalidOperationException)
                { }
                catch (Exception)
                {
                    this.stopManage();
                }
            }
        }
 private void updateInstrument(VerticalSpeedIndicatorInstrumentControl control, DroneData droneData)
 {
     control.BeginInvoke((MethodInvoker)delegate
     {
         control.SetVerticalSpeedIndicatorParameters(Convert.ToInt32(droneData.vZ));
     });
 }
        private void updateInstrument(HeadingIndicatorInstrumentControl control, DroneData droneData)
        {
            control.BeginInvoke((MethodInvoker)delegate
            {
                // Psi range -180..0..180 but heading indicator require 0..360
                if (droneData.Psi > 0)
                {
                    control.SetHeadingIndicatorParameters(Convert.ToInt32(droneData.Psi));
                }
                else
                {
                    control.SetHeadingIndicatorParameters(360 + Convert.ToInt32(droneData.Psi));
                }

            });
        }
 private void updateInstrument(AltimeterInstrumentControl control, DroneData droneData)
 {
     control.BeginInvoke((MethodInvoker)delegate
     {
         control.SetAlimeterParameters(droneData.Altitude);
     });
 }
 private void updateInstrument(AttitudeIndicatorInstrumentControl control, DroneData droneData)
 {
     control.BeginInvoke((MethodInvoker)delegate
     {
         control.SetAttitudeIndicatorParameters((droneData.Theta), -(droneData.Phi));
     });
 }
        private void DetermineNavigationData(byte[] buffer, int position)
        {
            unsafe
            {
                fixed (byte* entry = &buffer[position])
                {
                    currentNavigationDataStruct = *(NavigationDataStruct*)entry;
                }
            }

            currentNavigationData = new DroneData(currentNavigationDataStruct);
        }
 public DroneDataReadyEventArgs( DroneData data )
 {
     _data = data;
 }