LeapDeviceΒΆ

LeapDevice Class Reference

The LeapDevice class represents a physically connected device. More...

Inherits NSObject.

Instance Methods

(float) - distanceToBoundary:
 The distance to the nearest edge of the Leap Motion controller's view volume. More...
 
(BOOL) - equals:
 Compare LeapDevice object inequality. More...
 

Class Methods

(LeapDevice *) + invalid
 Returns an invalid LeapDevice object. More...
 

Properties

float baseline
 The device baseline refers to the separation distance between stereo sensors on the device. More...
 
float horizontalViewAngle
 The angle of view along the x axis of this device, in radians. More...
 
BOOL isEmbedded
 
BOOL isLightingBad
 The software has detected excessive IR illumination, which may interfere with tracking. More...
 
BOOL isSmudged
 The software has detected a possible smudge on the translucent cover over the Leap Motion cameras. More...
 
BOOL isStreaming
 Reports whether this device is streaming data to your application. More...
 
BOOL isValid
 Reports whether this is a valid LeapDevice object. More...
 
float range
 The maximum reliable tracking range, in millimeters. More...
 
NSString * serialNumber
 An alphanumeric serial number unique to each device. More...
 
LeapDeviceType type
 The device type. More...
 
float verticalViewAngle
 The angle of view along the z axis of this device, in radians. More...
 

Detailed Description

The LeapDevice class represents a physically connected device.

The LeapDevice class contains information related to a particular connected device such as field of view, device id, and calibrated positions.

NSArray *devices = controller.devices;
LeapDevice *activeDevice = LeapDevice.invalid;
for (LeapDevice *device in devices) {
if (device.isStreaming) {
activeDevice = device;
break; //Only one device can be active at a time
}
}

Note that Device objects can be invalid, which means that they do not contain valid device information and do not correspond to a physical device. Test for validity with the [LeapDevice isValid] function.

Since 1.0

Method Documentation

- (float) distanceToBoundary: (const LeapVector *)  position

The distance to the nearest edge of the Leap Motion controller's view volume.

The view volume is an axis-aligned, inverted pyramid centered on the device origin and extending upward to the range limit. The walls of the pyramid are described by the horizontalViewAngle and verticalViewAngle properties and the roof by the range. This function estimates the distance between the specified input position and the nearest wall or roof of the view volume.

LeapFinger *front = frame.fingers.frontmost;
LeapVector *frontTipPosition = front.tipPosition;
float distanceToEdge = [device distanceToBoundary:frontTipPosition];
Parameters
positionThe point to use for the distance calculation.
Returns
The distance in millimeters from the input position to the nearest boundary.
Since 1.0
- (BOOL) equals: (const LeapDevice *)  other

Compare LeapDevice object inequality.

Two LeapDevice objects are equal if and only if both LeapDevice objects represent the exact same LeapDevice and both Devices are valid.

[thisDevice equals:thatDevice];
Since 1.0
+ (LeapDevice *) invalid

Returns an invalid LeapDevice object.

LeapDevice *invalidDevice = LeapDevice.invalid;
Returns
The invalid LeapDevice instance.
Since 1.0

Property Documentation

- (float) baseline
readnonatomicassign

The device baseline refers to the separation distance between stereo sensors on the device.

The baseline value, together with the maximum resolution, influence the maximum range.

Since 2.2.5
- (float) horizontalViewAngle
readnonatomicassign

The angle of view along the x axis of this device, in radians.

The Leap Motion controller scans a volume in the shape of an inverted pyramid centered at the device's center and extending upwards. The horizontalViewAngle reports the view angle along the long dimension of the device.

float angleAlongX = device.horizontalViewAngle;
Since 1.0
- (BOOL) isEmbedded
readnonatomicassign
- (BOOL) isLightingBad
readnonatomicassign

The software has detected excessive IR illumination, which may interfere with tracking.

If robust mode is enabled, the system will enter robust mode when isLightingBad is true.

Since
3.0
- (BOOL) isSmudged
readnonatomicassign

The software has detected a possible smudge on the translucent cover over the Leap Motion cameras.

Since
3.0
- (BOOL) isStreaming
readnonatomicassign

Reports whether this device is streaming data to your application.

if (device.isStreaming) {
activeDevice = device;
}

Currently only one controller can provide data at a time.

Since
1.2
- (BOOL) isValid
readnonatomicassign

Reports whether this is a valid LeapDevice object.

if(device.isValid)
{
//Use the data...
}
Returns
True, if this LeapDevice object contains valid data.
Since 1.0
- (float) range
readnonatomicassign

The maximum reliable tracking range, in millimeters.

The range reports the maximum recommended distance from the device center for which tracking is expected to be reliable. This distance is not a hard limit. Tracking may be still be functional above this distance or begin to degrade slightly before this distance depending on calibration and extreme environmental conditions.

float maxRange = device.range;
Since 1.0
- (NSString*) serialNumber
readnonatomicassign

An alphanumeric serial number unique to each device.

Consumer device serial numbers consist of 2 letters followed by 11 digits.

When using multiple devices, the serial number provides an unambiguous identifier for each device.

Since
2.2.2
- (LeapDeviceType) type
readnonatomicassign

The device type.

Use the device type value in the (rare) circumstances that you have an application feature which relies on a particular type of device.

LeapDeviceType type = device.type;
Returns
The physical device type as a member of the DeviceType enumeration.
Since
1.2
- (float) verticalViewAngle
readnonatomicassign

The angle of view along the z axis of this device, in radians.

The Leap Motion controller scans a region in the shape of an inverted pyramid centered at the device's center and extending upwards. The verticalViewAngle reports the view angle along the short dimension of the device.

float angleAlongZ = device.verticalViewAngle;
Since 1.0