-
Notifications
You must be signed in to change notification settings - Fork 15
RTK Widget
The RTK Widget controls and gets information related to RTK. It will only appear for products that are equipped with an RTK system.
The RTK Widget contains the following sub-widgets:
- RTK Enabled Widget: Contains the widget header and a switch which enables or disables RTK.
- RTK Satellite Status Widget: Contains all the information related to RTK. This includes coordinates and altitude of the aircraft and base station or network receiver, course angle, GLONASS, Beidou, Galileo, and GPS satellite counts for both antennas and the base station, and overall status of the RTK system.
This widget contains all sub-widgets in a scrollable view, as well as an "OK" button at the bottom which hides the widget when pressed.
When RTK is disabled the DUXBetaRTKSatelliteStatusWidget
will be hidden and an informative message will be displayed in its place.
If creating the rtk widget through code it can be added using the convenience method:
- (void)installInViewController:(nullable UIViewController *)viewController
If creating the widget through storyboard use the object library to drag a container view controller into the desired view controller like so:
Following this make sure to change the class of the child view controller to be DUXBetaRTKWidget
. From here you can create the constraints on the container view using the RTK Widget's widgetSizeHint
property.
The RTK Widget supports customization to match the style of the user's application. An example of a customized RTK Widget could look something like this:
To get this effect we would use the following code:
rtkWidget.rtkDescriptionTextColor = UIColor.black
rtkWidget.okTextColor = UIColor.black
rtkWidget.separatorColor = UIColor.gray
rtkWidget.backgroundColor = UIColor.white
rtkWidget.rtkDescriptionTextColor = [UIColor blackColor];
rtkWidget.okTextColor = [UIColor blackColor];
rtkWidget.separatorColor = [UIColor grayColor];
rtkWidget.backgroundColor = [UIColor whiteColor];
List of customization methods and properties
-
@property (nonatomic, strong) DUXBetaRTKEnabledWidget *rtkEnabledWidget;
- The DUXBetaRTKEnabledWidget positioned at the top of the widget. -
@property (nonatomic, strong) DUXBetaRTKSatelliteStatusWidget *rtkSatelliteStatusWidget;
- The DUXBetaRTKSatelliteStatusWidget positioned near the bottom of the widget. -
@property (nonatomic, strong) UIFont *rtkDescriptionFont;
- The font of the RTK description label. Default point size = 11.0. -
@property (nonatomic, strong) UIColor *rtkDescriptionTextColor;
- The text color of the RTK description label. -
@property (nonatomic, strong) UIColor *rtkDescriptionBackgroundColor;
- The background color of the RTK description label. -
@property (nonatomic, strong) UIFont *okFont;
- The font of the OK button. Default point size = 16.0. -
@property (nonatomic, strong) UIColor *okTextColor;
- The text color of the OK button. -
@property (nonatomic, strong) UIColor *okBackgroundColor;
- The background color of the OK button. -
@property (nonatomic, strong) UIColor *separatorColor;
- The color of the separator lines for this widget and all sub-widgets. -
@property (nonatomic, strong) UIColor *backgroundColor;
- The background color of the widget.
The widget provides hooks for users to add functionality based on state changes in the widget. The RTK widget provides the following hooks:
-
RTKWidgetModelState
- Provides hooks in events received by the widget from the widget model.
-
+ (instancetype)productConnected:(BOOL)isConnected;
- Event when product is connected or disconnected. -
+ (instancetype)rtkEnabledUpdate:(BOOL)isEnabled;
- Event when the RTK enabled state is updated. -
+ (instancetype)visibilityUpdate:(BOOL)isVisible;
- Event when the visibility of the widget is updated due to a state change in the coupled widget.
-
RTKWidgetUIState
- Provides hooks in events related to user interaction with the widget.
-
+ (instancetype)okTap;
- Event when the OK button is tapped.
This widget contains a switch to enable or disable RTK as well as a message to the user. If the user tried to enable RTK when the motors are running, a warning message will appear notifying the user to stop the motors and try again.
If creating the rtk enabled widget through code it can be added using the convenience method:
- (void)installInViewController:(nullable UIViewController *)viewController
If creating the widget through storyboard use the object library to drag a container view controller into the desired view controller like so:
Following this make sure to change the class of the child view controller to be DUXBetaRTKEnabledWidget
. From here you can create the constraints on the container view using the RTK Enabled Widget's widgetSizeHint
property.
The RTK Enabled Widget supports customization to match the style of the user's application. An example of a customized RTK Enabled Widget could look something like this:
To get this effect we would use the following code:
rtkEnabledWidget.titleTextColor = UIColor.black
rtkEnabledWidget.descriptionTextColor = UIColor.black
rtkEnabledWidget.widgetBackgroundColor = UIColor.white
rtkEnabledWidget.titleTextColor = [UIColor blackColor];
rtkEnabledWidget.descriptionTextColor = [UIColor blackColor];
rtkEnabledWidget.widgetBackgroundColor = [UIColor whiteColor];
To customize the UISwitch appearance for the On or Off state or to enable the visible ring in iOS 13+, (the ring tint can't be set in previous iOS versions and is always white), the following code can be used.
rtkEnabledWidget.enableSwitchOnTintColor = UIColor.blueColor()
rtkEnabledWidget.enableSwitchOffTintColor = UIColor. redColor()
rtkEnabledWidget.enableSwitchTrackColor = UIColor.yellowColor()
rtkEnabledWidget.enableSwitchOnTintColor = [UIColor blueColor];
rtkEnabledWidget.enableSwitchOffTintColor = [UIColor redColor];
rtkEnabledWidget.enableSwitchTrackColor = [UIColor yellowColor];
List of customization methods and properties
-
@property (nonatomic, strong) UIFont *titleFont;
The font of the title (RTK Positioning). Default point size = 20. -
@property (nonatomic, strong) UIColor *titleTextColor;
The color of the title (RTK Positioning). -
@property (nonatomic, strong) UIColor *titleBackgroundColor;
The background color of the title (RTK Positioning). -
@property (nonatomic, strong) UIFont *descriptionFont;
The font of the description: (When RTK module malfunctions, manually disable...). Default point size = 14. -
@property (nonatomic, strong) UIColor *descriptionTextColor;
The color of the description text: (When RTK module malfunctions, manually disable...). -
@property (nonatomic, strong) UIColor *descriptionBackgroundColor;
The background color of the description label: (When RTK module malfunctions, manually disable...). -
@property (nonatomic, strong) UIColor *enabledSwitchTintColor;
The color the enable switch shows when enabled. -
@property (nonatomic, strong) UIColor *widgetBackgroundColor;
The widget's background color. -
@property (nonatomic, strong) UIColor *enableSwitchOnTintColor;
The UISwitch on color tint, or nil for iOS default color. -
@property (nonatomic, strong) UIColor *enableSwitchOffTintColor;
The UISwitch off color tint, or nil for iOS default color. -
@property (nonatomic, strong) UIColor *enableSwitchTrackColor;
The UISwitch ring tint color. Only valid for iOS 13+.
The widget provides hooks for users to add functionality based on state changes in the widget. The RTK Enabled widget provides the following hooks:
-
RTKEnabledModelState
- Provides hooks in events received by the widget from the widget model.
-
+ (instancetype)productConnected:(BOOL)isConnected;
- Event when product is connected or disconnected. -
+ (instancetype)rtkEnabledUpdate:(BOOL)isRTKEnabled;
- Event when the RTK enabled state is updated.
-
RTKEnabledUIState
- Provides hooks in events related to user interaction with the widget.
-
+ (instancetype)switchChanged:(BOOL)isEnabled;
- Event when the switch is toggled.
The RTK Satellite Status Widget displays the connection status of the RTK Reference Station Source and a table of other information related to the status of the RTK.
Image | Status Item | Description |
---|---|---|
Orientation | The orientation of the aircraft. Displays as an image with on and off states for older products and text for newer products. | |
Positioning | The positioning of the aircraft. | |
Coordinates | The latitude, longitude, and altitude of the aircraft and base station or network receiver | |
Course Angle | The heading of the aircraft. | |
Satellite Counts | The number of satellites detected by each receiver for each of the satellite providers. The Antenna 2 column will only appear on products with two antennae attached to the aircraft. | |
Standard Deviation | The standard deviation of location accuracy for the latitude, longitude, and altitude. Only supported by Phantom 4 RTK. |
If creating the RTK Satellite Status widget through code it can be added using the convenience method:
- (void)installInViewController:(nullable UIViewController *)viewController
If creating the widget through storyboard use the object library to drag a container view controller into the desired view controller like so:
Following this make sure to change the class of the child view controller to be DUXBetaRTKSatelliteStatusWidget
. From here you can create the constraints on the container view using the RTK Satellite Status Widget's widgetSizeHint
property.
The RTK Satellite Status Widget supports customization to match the style of the user's application. An example of a customized RTK Satellite Status Widget could look something like this:
To get this effect we would use the following code:
rtkSatelliteStatusWidget.titleLabelTextColor = UIColor.black
rtkSatelliteStatusWidget.valueLabelTextColor = UIColor.black
rtkSatelliteStatusWidget.statusTitleLabelTextColor = UIColor.black
rtkSatelliteStatusWidget.setStatusTextColor(UIColor.blue, for: DUXBetaRTKConnectionStatus.inUse);
rtkSatelliteStatusWidget.setStatusTextColor(UIColor.orange, for: DUXBetaRTKConnectionStatus.notInUse);
rtkSatelliteStatusWidget.setStatusTextColor(UIColor.gray, for: DUXBetaRTKConnectionStatus.disconnected);
rtkSatelliteStatusWidget.backgroundColor = UIColor.white
rtkSatelliteStatusWidget.titleLabelTextColor = [UIColor blackColor];
rtkSatelliteStatusWidget.valueLabelTextColor = [UIColor blackColor];
rtkSatelliteStatusWidget.statusTitleLabelTextColor = [UIColor blackColor];
[rtkSatelliteStatusWidget setStatusTextColor:[UIColor blueColor] forConnectionStatus:DUXBetaRTKConnectionStatusInUse];
[rtkSatelliteStatusWidget setStatusTextColor:[UIColor orangeColor] forConnectionStatus:DUXBetaRTKConnectionStatusNotInUse];
[rtkSatelliteStatusWidget setStatusTextColor:[UIColor grayColor] forConnectionStatus:DUXBetaRTKConnectionStatusDisconnected];
rtkSatelliteStatusWidget.backgroundColor = [UIColor whiteColor];
List of customization methods and properties
-
@property (nonatomic, strong) UIFont *statusTitleLabelFont;
The font of the status title label (Base Station Status:). Default point size = 12. -
@property (nonatomic, strong) UIColor *statusTitleLabelTextColor;
The color of the status title label. -
@property (nonatomic, strong) UIColor *statusTitleLabelBackgroundColor;
The background color of the status title label. -
@property (nonatomic, strong) UIFont *statusLabelFont;
The font of the status label (follows the status title label). Default point size = 12. -
@property (nonatomic, strong) UIColor *statusLabelBackgroundColor;
The background color of the status label. -
@property (nonatomic, strong) UIFont *titleLabelFont;
The font of the title labels (labels in the first row or column of the table). Default point size = 12. -
@property (nonatomic, strong) UIColor *titleLabelTextColor;
The text color of the title labels. -
@property (nonatomic, strong) UIColor *titleLabelBackgroundColor;
The background color of the title labels. -
@property (nonatomic, strong) UIFont *valueLabelFont;
The font of the value labels (labels in the first row or column of the table). Default point size = 12. -
@property (nonatomic, strong) UIColor *valueLabelTextColor;
The text color of the value labels. -
@property (nonatomic, strong) UIColor *valueLabelBackgroundColor;
The background color of the value labels. -
@property (nonatomic, strong) UIColor *tableColor;
The table line color (default gray). -
@property (nonatomic, assign) BOOL isBeidouCountVisible;
The visibility of the Beidou satellite counts row of the table. -
@property (nonatomic, assign) BOOL isGlonassCountVisible;
The visibility of the Glonass satellite counts row of the table. -
@property (nonatomic, assign) BOOL isGalileoCountVisible;
The visibility of the Galileo satellite counts row of the table. -
@property (nonatomic, strong) UIImage *orientationValidImage;
The image asset for the valid orientation icon (only shown for M210RTK). -
@property (nonatomic, strong) UIImage *orientationInvalidImage;
The image asset for the invalid orientation icon (only shown for M210RTK). -
@property (nonatomic, strong) UIColor *orientationValidTint;
The image tint for the valid orientation icon (only shown for M210RTK). -
@property (nonatomic, strong) UIColor *orientationInvalidTint;
The image tint for the invalid orientation icon (only shown for M210RTK). -
@property (nonatomic, strong) UIColor *backgroundColor;
- The background color of the widget. -
- (void)setStatusTextColor:(UIColor *)fontColor forConnectionStatus:(DUXBetaRTKConnectionStatus)status;
Set the color of the connection status text for the specified connection status state. -
- (UIColor *)getStatusTextColorForConnectionStatus:(DUXBetaRTKConnectionStatus)status;
Get the color of the connection status text for the specified connection status state.
The widget provides hooks for users to add functionality based on state changes in the widget. The RTK Satellite Status widget provides the following hooks:
-
RTKSatelliteStatusModelState
- Provides hooks in events received by the widget from the widget model.
-
+ (instancetype)productConnected:(BOOL)isConnected;
- Event when product is connected or disconnected. -
+ (instancetype)rtkConnectionUpdated:(BOOL)isConnected;
- Event when the RTK connected state is updated. -
+ (instancetype)rtkStateUpdated:(DJIRTKState *)rtkState;
- Event when the RTK state is updated. -
+ (instancetype)modelUpdated:(NSString *)modelName;
- Event when the product model is updated. -
+ (instancetype)rtkSignalUpdated:(DJIRTKReferenceStationSource)rtkReferenceSource;
- Event when the RTK reference source is updated. -
+ (instancetype)standardDeviationUpdated:(DJILocationStandardDeviation *)locationStandardDeviation;
- Event when the standard deviation is updated. -
+ (instancetype)rtkBaseStationStateUpdated:(DUXBetaRTKConnectionStatus)connectionStatus;
- Event when the RTK base station status is updated. -
+ (instancetype)rtkNetworkServiceStateUpdated:(DJIRTKNetworkServiceState *)networkServiceState;
- Event when the network service status is updated.
DJI UX SDK Version 5 Beta 4.1