Exemplo n.º 1
0
 private void OnConfigurationPacketAcquired(ConfigurationPacket packet)
 {
     if (UpdateConfiguration(packet))
     {
         if (_DroneClient.RequestedState == RequestedState.GetConfiguration)
         {
             _DroneClient.RequestedState = RequestedState.None;
         }
         ConfigurationViewModelHelper.UpdateConfigurationSections(_DroneClient.ConfigurationSectionsViewModel, _DroneClient.Configuration);
     }
 }
Exemplo n.º 2
0
        private void OnDataReadCompletion(uint bytesRead, Streams.DataReader reader)
        {
            if (reader == null)
            {
                return;
            }

            uint unreadLength = reader.UnconsumedBufferLength;

            if (unreadLength == 0)
            {
                return;
            }

            byte[] buffer = new byte[unreadLength];
            reader.ReadBytes(buffer);

            StringBuilder stringBuffer = new StringBuilder();

            stringBuffer.Append(Encoding.UTF8.GetString(buffer, 0, buffer.Length));
            Debug.WriteLine("Configuration Brute: " + stringBuffer.ToString());

            var packet = new ConfigurationPacket
            {
                Timestamp = DateTime.UtcNow.Ticks,
                Data      = buffer
            };

            if (UpdateConfiguration(packet))
            {
                if (_DroneClient.RequestedState == RequestedState.GetConfiguration)
                {
                    _DroneClient.RequestedState = RequestedState.None;
                }
                ConfigurationViewModelHelper.UpdateConfigurationSections(_DroneClient.ConfigurationSectionsViewModel, _DroneClient.Configuration);
            }
        }