The Xamarin implementation of Mission Planner is a cross-platform solution that enables the application to run on mobile devices (Android, iOS), macOS, and Windows 10 UWP (Universal Windows Platform). Rather than completely rewriting the application for mobile platforms, this implementation uses a hybrid bridge architecture. The existing WinForms-based Mission Planner logic and UI are rendered via SkiaSharp onto a Xamarin.Forms canvas, while platform-specific hardware abstraction layers provide access to USB, Bluetooth, and GPS.
The implementation runs the standard Mission Planner MainV2 engine in a background thread. UI draw calls are intercepted and redirected to a SkiaSharp surface. Touch input from the mobile OS is captured by Xamarin.Forms and translated back into standard Windows Forms mouse events (MouseDown, MouseMove, MouseUp).
The following diagram bridges the high-level system concepts to the specific classes and files in the codebase.
Diagram: Entity Mapping
Sources:
The WinForms class in ExtLibs/Xamarin/Xamarin/GCSViews/WinForms.xaml.cs is the primary leaf node for the mobile implementation. It handles the lifecycle of the WinForms-to-Skia translation.
Device.Info.ScaledScreenSize and Device.Info.PixelScreenSize to ensure the desktop UI fits mobile aspect ratios. It specifically handles scaling for high-resolution displays (Full HD and above) on macOS and UWP ExtLibs/Xamarin/Xamarin/GCSViews/WinForms.xaml.cs50-82SerialPort.DefaultType to route serial requests to platform-specific handlers. This includes Bluetooth (BT/BLE), USB-Serial, and a specialized GPS injection mode that simulates NMEA GGA strings from the mobile device's onboard GPS ExtLibs/Xamarin/Xamarin/GCSViews/WinForms.xaml.cs98-180Platform-specific features are abstracted via the ITest interface structure, allowing the shared Xamarin code to remain platform-agnostic.
| Interface | Purpose | Key Implementation Class |
|---|---|---|
IUSBDevices | Enumerates and connects to USB-Serial converters | USBDevices.cs (Android) |
IBlueToothDevice | Manages BT/BLE discovery and sockets | BTDevice.cs (Android) |
IGPS | Accesses onboard mobile GPS for GCS location | MainActivity.cs (Android) |
ISpeech | Provides Text-to-Speech (TTS) for telemetry alerts | Speech.cs |
Sources:
MainActivity.cs defines the Android entry point and handles the complex permission model required for drone communication.
USB_PERMISSION, BLUETOOTH_ADMIN, ACCESS_FINE_LOCATION, and WAKE_LOCK to prevent the device from sleeping during flight ExtLibs/Xamarin/Xamarin.Android/MainActivity.cs55-79.tlog and .bin (DataFlash) files via Android Intents, allowing Mission Planner to open logs directly from the Android file system or web links ExtLibs/Xamarin/Xamarin.Android/MainActivity.cs85-91Android serial communication is facilitated by the UsbSerialForAndroid library. The MainActivity manages UsbDeviceReceiver to detect hardware attachment and detachment events ExtLibs/Xamarin/Xamarin.Android/MainActivity.cs99-103 It also implements AndroidSerial for low-level byte streaming ExtLibs/Xamarin/Xamarin.Android/AndroidSerial.cs1-20
The implementation includes specific logic for the CubePilot HereLink handheld GCS.
App.xaml.cs checks SystemInfo for the "CubePilot" tag ExtLibs/Xamarin/Xamarin/App.xaml.cs77-78The following diagram details how a physical touch on a mobile screen reaches the internal Mission Planner logic.
Diagram: Input Translation Flow
Sources:
The solution uses several projects and CI/CD pipelines to target multiple platforms:
netstandard2.0 library MissionPlannerLib.csproj1-22.github/workflows/android.yml and mac.yml automate the building of Android AAB/APK packages, iOS builds, and macOS DMG installers android.yml1-100 mac.yml1-88Sources:
Refresh this wiki