private void _transport_OnMessageReceived(object sender, UasMessage arg) { switch (arg.MessageId) { case UasMessages.Statustext: var stat = arg as UasStatustext; var message = new String(stat.Text); if (message.ToLower().Contains("calibration successful") || message.ToLower().Contains("calibration failed")) { IsDone = true; IsActive = false; DoneCommand.RaiseCanExecuteChanged(); UserMessage = message; } break; case UasMessages.CommandLong: var cmd = arg as UasCommandLong; if (cmd.Command == (ushort)MavCmd.AccelcalVehiclePos) { var pos = (AccelcalVehiclePos)cmd.Param1; UserMessage = "Please place vehicle " + pos.ToString(); } break; } }
public void Done() { _connectedUasManager.Active.Transport.SendMessage(UasCommands.PreflightCalibration(_connectedUasManager.Active.Uas.SystemId, _connectedUasManager.Active.Uas.ComponentId, 0, 0, 0, 0, 2, 0, 0)); BeginCommand.RaiseCanExecuteChanged(); CancelCommand.RaiseCanExecuteChanged(); DoneCommand.RaiseCanExecuteChanged(); NextCommand.RaiseCanExecuteChanged(); }
public void Next() { if (IsActive) { var ack = new UasCommandAck() { TargetComponent = _connectedUasManager.Active.Uas.ComponentId, TargetSystem = _connectedUasManager.Active.Uas.SystemId, Command = 1, Result = 1, }; _connectedUasManager.Active.Transport.SendMessage(ack); } _connectedUasManager.Active.Transport.SendMessage(UasCommands.PreflightCalibration(_connectedUasManager.Active.Uas.SystemId, _connectedUasManager.Active.Uas.ComponentId, 0, 0, 0, 0, 1, 0, 0)); BeginCommand.RaiseCanExecuteChanged(); CancelCommand.RaiseCanExecuteChanged(); DoneCommand.RaiseCanExecuteChanged(); NextCommand.RaiseCanExecuteChanged(); }