Class RangingCapabilities
java.lang.Object
com.codename1.nearby.ranging.RangingCapabilities
What the current device can actually measure. Ask this before building a UI: a device may support distance but not direction, which is the common case on Android hardware and on any iPhone whose peer is behind it.
UNSUPPORTED is an all-false instance returned where ranging is absent,
so calling code needs no null check.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RangingCapabilitiesAll-false capabilities, returned byRanging.getCapabilities()on a platform or device with no UWB at all. -
Constructor Summary
ConstructorsConstructorDescriptionRangingCapabilities(boolean distance, boolean direction, boolean elevation, boolean cameraAssistance, boolean accessoryRanging, boolean backgroundRanging) Ports construct this; application code reads it fromRanging.getCapabilities(). -
Method Summary
Modifier and TypeMethodDescriptionbooleantruewhen third-party UWB accessories can be ranged, as opposed to only other phones.booleantruewhen a session may keep delivering updates while the app is in the background.booleantruewhen the platform can use the camera to converge on a sharper direction.booleantruewhen the device can report the horizontal direction to a peer.booleantruewhen the device can measure distance to a peer.booleantruewhen the device can report elevation as well as azimuth.toString()Returns a string representation of the object.
-
Field Details
-
UNSUPPORTED
All-false capabilities, returned byRanging.getCapabilities()on a platform or device with no UWB at all.
-
-
Constructor Details
-
RangingCapabilities
public RangingCapabilities(boolean distance, boolean direction, boolean elevation, boolean cameraAssistance, boolean accessoryRanging, boolean backgroundRanging) Ports construct this; application code reads it from
Ranging.getCapabilities().Parameters
distance: precise distance measurement is availabledirection: horizontal direction (azimuth) is availableelevation: vertical direction (elevation) is availablecameraAssistance: camera assistance can sharpen directionaccessoryRanging: third-party UWB accessories can be rangedbackgroundRanging: a session may keep running in the background
-
-
Method Details
-
isDistanceSupported
public boolean isDistanceSupported()truewhen the device can measure distance to a peer. This is the baseline capability: a device that answersfalsehere has no usable UWB radio andRanging.isSupported()will also befalse. -
isDirectionSupported
public boolean isDirectionSupported()truewhen the device can report the horizontal direction to a peer. Both platforms only produce a direction while the peer is roughly in front of the device, so an update may still omit it -- always checkRangingUpdate.hasDirection()as well. -
isElevationSupported
public boolean isElevationSupported()truewhen the device can report elevation as well as azimuth. -
isCameraAssistanceSupported
public boolean isCameraAssistanceSupported()truewhen the platform can use the camera to converge on a sharper direction. iOS only, and only while an AR session is running; the Codename One API does not turn it on by itself. -
isAccessoryRangingSupported
public boolean isAccessoryRangingSupported()truewhen third-party UWB accessories can be ranged, as opposed to only other phones. SeeRangingSession.startAccessory(byte[]). -
isBackgroundRangingSupported
public boolean isBackgroundRangingSupported()truewhen a session may keep delivering updates while the app is in the background. On iOS this additionally requires thecom.apple.developer.nearby-interactionentitlement, which Codename One never injects on its own -- see the developer guide. -
toString
Description copied from class:ObjectReturns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode())
-