-
Notifications
You must be signed in to change notification settings - Fork 15
GPS Signal Widget
The GPS signal widget shows the current GPS signal strength along with the number of satellites available and whether RTK is enabled on supported aircraft. By default, an icon with 5 vertical bars represents the current GPS signal strength.
The GPS icon changes color based on the connection status of the product. By default, it turns gray if the product is disconnected, and white if the product is connected.
The status of the RTK is represented by an R to the right of the signal strength icon. If the R is hidden, RTK is not supported by the product or not enabled. If the R is red, RTK is enabled but not connected to a base station, or the accuracy of the RTK signal is low. If the R is white, the RTK signal has a high accuracy.
The number of satellites is displayed to the right of the icon.
Note: The iOS GPS Signal Widget does not support showing a special icon for an external GPS unit.
If creating the GPS signal 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 DUXBetaGPSSignalWidget
. From here, you can create the constraints on the container view using the GPS signal widget's widgetSizeHint
property.
The GPS signal widget supports customization to match the style of the user's application.
To get this effect we would use the following code:
gpsWidget.setImage(UIImage(named: "customSignalBarLevel0")!, for: DUXBetaGPSSatelliteStrength.level0)
gpsWidget.setImage(UIImage(named: "customSignalBarLevel1")!, for: DUXBetaGPSSatelliteStrength.level1)
gpsWidget.setImage(UIImage(named: "customSignalBarLevel2")!, for: DUXBetaGPSSatelliteStrength.level2)
gpsWidget.setImage(UIImage(named: "customSignalBarLevel3")!, for: DUXBetaGPSSatelliteStrength.level3)
gpsWidget.setImage(UIImage(named: "customSignalBarLevel4")!, for: DUXBetaGPSSatelliteStrength.level4)
gpsWidget.setImage(UIImage(named: "customSignalBarLevel5")!, for: DUXBetaGPSSatelliteStrength.level5)
gpsWidget.setWidgetIcon(UIImage(named:"customGPSIcon")!)
gpsWidget.iconTintColorConnected = UIColor.black
gpsWidget.satelliteCountNumberColor = UIColor.black
[gpsWidget setImage:[UIImage imageNamed:@"customSignalBarLevel0"] forSatelliteStrength:DUXBetaGPSSatelliteStrengthLevel0];
[gpsWidget setImage:[UIImage imageNamed:@"customSignalBarLevel1"] forSatelliteStrength:DUXBetaGPSSatelliteStrengthLevel1];
[gpsWidget setImage:[UIImage imageNamed:@"customSignalBarLevel2"] forSatelliteStrength:DUXBetaGPSSatelliteStrengthLevel2];
[gpsWidget setImage:[UIImage imageNamed:@"customSignalBarLevel3"] forSatelliteStrength:DUXBetaGPSSatelliteStrengthLevel3];
[gpsWidget setImage:[UIImage imageNamed:@"customSignalBarLevel4"] forSatelliteStrength:DUXBetaGPSSatelliteStrengthLevel4];
[gpsWidget setImage:[UIImage imageNamed:@"customSignalBarLevel5"] forSatelliteStrength:DUXBetaGPSSatelliteStrengthLevel5];
gpsWidget.widgetIcon = [UIImage imageNamed:@"customGPSIcon"];
gpsWidget.iconTintColorConnected = [UIColor blackColor];
gpsWidget.satelliteCountNumberColor = [UIColor blackColor];
List of customization methods and properties
-
@property (nonatomic, strong) UIColor *widgetBackgroundColor;
The overall widget background color. -
@property (nonatomic, strong) UIImage *widgetIcon;
The satellite icon located to the left of the signal strength bars identifying this widget as the GPS widget. -
@property (nonatomic, strong) UIColor *iconBackgroundColor;
The background color of the icon. -
@property (nonatomic, strong) UIColor *iconTintColorConnected;
The tint color of the icon. -
@property (nonatomic, strong) UIColor *iconTintColorDisconnected;
The tint color of the icon when there is no connection to the flight controller. -
- (void)setImage:(UIImage *)image forSatelliteStrength:(DUXBetaGPSSatelliteStrength)satelliteStrength;
Set the image to be displayed for the corresponding signal strength level. -
- (UIImage *)imageForSatelliteStrength:(DUXBetaGPSSatelliteStrength)satelliteStrength;
Get the image for corresponding signal strength level. -
@property (nonatomic, strong) UIColor *signalBackgroundColor;
The background color signal indicator (signal strength bars). -
@property (nonatomic, strong) UIFont *satelliteCountNumberFont;
The font for the text that shows how many satellites are connected. -
@property (nonatomic, strong) UIColor *satelliteCountNumberColor;
The color of the text that shows how many satellites are connected. -
@property (nonatomic, strong) UIColor *satelliteCountBackgroundColor;
The background color of the text that shows how many satellites are connected. -
@property (nonatomic, strong) UIFont *rtkIndicatorFont;
The font of the RTK connection indicator (the R in the bottom right of the widget when RTK is in use). -
@property (nonatomic, strong) UIColor *rtkIndicatorTextColorAccurate;
The color of the RTK connection indicator (the R in the bottom right of the widget when RTK is in use) when the RTK connection is very strong. -
@property (nonatomic, strong) UIColor *rtkIndicatorTextColorInaccurate;
The color of the RTK connection indicator (the R in the bottom right of the widget when RTK is in use) when the RTK connection isn't very strong. -
@property (nonatomic, strong) UIColor *rtkIndicatorBackgroundColor;
The background color of the RTK connection indicator (the R in the bottom right of the widget when RTK is in use).
The widget provides hooks for users to add functionality based on state changes in the widget. The GPS signal widget provides the following hooks
-
GPSSignalModelState
- Provides hooks for events received by the widget from the widget model.
-
+ (instancetype)productConnected:(BOOL)isConnected;
- Event when product is connected or disconnected. -
+ (instancetype)gpsSignalQualityUpdated:(NSInteger)signalQuality;
- Event when GPS signal quality changes. -
+ (instancetype)satelliteCountUpdated:(NSInteger)satelliteCount;
- Event when displayed satellite count changes. -
+ (instancetype)rtkEnabledUpdated:(BOOL)isRTKEnabled;
- Event when RTK becomes enabled or disabled. -
+ (instancetype)rtkAccurateUpdated:(BOOL)isRTKAccurate;
- Event when RTK becomes accurate or inaccurate.
-
GPSSignalUIState
- Provides hooks for events received by the widget from user interactions.
-
+ (instancetype)widgetTapped;
- Event when user taps the widget.
DJI UX SDK Version 5 Beta 4.1