-
Notifications
You must be signed in to change notification settings - Fork 15
VPS Widget
The VPS Widget is a TextAndImageRight type of Base Telemetry Widget. It shows the status of the vision positioning system as well as the height of the aircraft as received from the vision positioning system if available. The icon shows if the vision positioning system is enabled or disabled and the value text shows the height if available.
Following are the states of the widget.
State | Image |
---|---|
Disconnected | |
Metric Unit System | |
Imperial Unit System |
If creating the VPS widget through code it can be added using the convenience method:
- (void)installInViewController:(nullable UIViewController *)viewController
which adds the widget the method is called on, as a subview of the ViewController, that is passed in as an argument. Following this, add constraints to the widget using its widgetSizeHint
property to determine width, height and aspect ratio constraints.
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 VPSWidget
. From here you can create the constraints on the container view using the Telemetry Panel Widget's widgetSizeHint
property.
The UI elements can be customized to match the style of the user's application. The widget supports all the Text Customizations provided in the Base Telemetry Widget.
State | Image |
---|---|
Disconnected | |
Metric Unit System | |
Imperial Unit System |
vpsWidget.backgroundColor = UIColor.white
vpsWidget.labelTextColor = UIColor.black
vpsWidget.valueTextColor = UIColor.blue
vpsWidget.unitTextColor = UIColor.blue
vpsWidget.vpsEnabledImage = UIImage(named: "VPSEnabledImage")
vpsWidget.vpsDisabledImage = UIImage(named: "VPSDisabledImage")
vpsWidget.backgroundColor = [UIColor whiteColor];
vpsWidget.labelTextColor = [UIColor blackColor];
vpsWidget.valueTextColor = [UIColor blueColor];
vpsWidget.unitTextColor = [UIColor blueColor];
vpsWidget.vpsEnabledImage = [UIImage imageNamed: @"VPSEnabledImage"];
vpsWidget.vpsDisabledImage = [UIImage imageNamed: @"VPSDisabledImage"];
List of customization APIs
-
var vpsEnabledImage: UIImage
- The image for vision sensors enabled state. -
var vpsDisabledImage: UIImage
- The image for vision sensors disabled state.
The widget provides hooks for the users to add functionality based on the state changes in the widget. The VPSWidget provides the following hooks:
-
VPSModelState
- Provides hooks in events received by the widget from the widget model.-
public static func productConnected(_ isConnected: Bool) -> VPSModelState
- Event when the product is connected or disconnected. -
public static func VPSStateUpdated(_ vpsState: VPSState) -> VPSModelState
- Event when the vision sensors or height is updated.
-
DJI UX SDK Version 5 Beta 4.1