LeapConfigΒΆ

LeapConfig Class Reference

The LeapConfig class provides access to Leap system configuration information. More...

Inherits NSObject.

Instance Methods

(BOOL) - getBool:
 Gets the boolean representation for the specified key. More...
 
(float) - getFloat:
 Gets the floating point representation for the specified key. More...
 
(int32_t) - getInt32:
 Gets the 32-bit integer representation for the specified key. More...
 
(NSString *) - getString:
 Gets the NSString representation for the specified key. More...
 
(BOOL) - save
 Saves the current state of the config. More...
 
(BOOL) - setBool:value:
 Sets the boolean representation for the specified key. More...
 
(BOOL) - setFloat:value:
 Sets the floating point representation for the specified key. More...
 
(BOOL) - setInt32:value:
 Sets the 32-bit integer representation for the specified key. More...
 
(BOOL) - setString:value:
 Sets the string representation for the specified key. More...
 
(LeapValueType) - type:
 Reports the natural data type for the value related to the specified key. More...
 

Detailed Description

The LeapConfig class provides access to Leap system configuration information.

You can get and set gesture configuration parameters using the LeapConfig object obtained from a connected LeapController object.

LeapConfig *config = controller.config;

The key strings required to identify a configuration parameter include:

embed:rst:leading-asterisk
* ====================================  ========== ============= =======
* Key string                            Value type Default value Units
* ====================================  ========== ============= =======
* Gesture.Circle.MinRadius              float      5.0           mm
* Gesture.Circle.MinArc                 float      1.5 * pi      radians
* Gesture.Swipe.MinLength               float      150           mm
* Gesture.Swipe.MinVelocity             float      1000          mm/s
* Gesture.KeyTap.MinDownVelocity        float      50            mm/s
* Gesture.KeyTap.HistorySeconds         float      0.1           s
* Gesture.KeyTap.MinDistance            float      3.0           mm
* Gesture.ScreenTap.MinForwardVelocity  float      50            mm/s
* Gesture.ScreenTap.HistorySeconds      float      0.1           s
* Gesture.ScreenTap.MinDistance         float      5.0           mm
* ====================================  ========== ============= =======
* 

After setting a configuration value, you must call the [LeapConfig save] method to commit the changes. You can save after the LeapController has connected to the Leap Motion service/daemon. In other words, after the LeapController has dispatched the serviceConnected or connected events or LeapController::isConnected is true. The configuration value changes are not persistent; your application needs to set the values everytime it runs.

See also
LeapCircleGesture
LeapKeyTapGesture
LeapScreenTapGesture
LeapSwipeGesture
Since 1.0

Method Documentation

- (BOOL) getBool: (NSString *)  key

Gets the boolean representation for the specified key.

bool booleanValue = [controller.config getBool:@"Key.For.Bool.Setting"];
Since 1.0
- (float) getFloat: (NSString *)  key

Gets the floating point representation for the specified key.

float floatValue = [controller.config getFloat:@"Gesture.Swipe.MinLength"];
Since 1.0
- (int32_t) getInt32: (NSString *)  key

Gets the 32-bit integer representation for the specified key.

int32_t intValue = [controller.config getInt32:@"Key.For.Integer.Setting"];
Since 1.0
- (NSString *) getString: (NSString *)  key

Gets the NSString representation for the specified key.

NSString *stringValue = [controller.config getString:@"Key.For.String.Setting"];
Since 1.0
- (BOOL) save

Saves the current state of the config.

Call [LeapConfig save:] after making a set of configuration changes. The [LeapConfig save:] function transfers the configuration changes to the Leap application. You can save after the LeapController has connected to the Leap Motion service/daemon. In other words, after the LeapController has dispatched the serviceConnected or connected events or LeapController::isConnected is true. The configuration value changes are not persistent; your application needs to set the values every time it runs.

[controller.config setFloat:@"Gesture.Circle.MinRadius" value:15];
[controller.config setFloat:@"Gesture.Circle.MinArc" value:1.7];
bool success = [controller.config save];
Returns
TRUE on success, NO on failure.
Since 1.0
- (BOOL) setBool: (NSString *)  key
value: (BOOL)  value 

Sets the boolean representation for the specified key.

[controller.config setBool:@"tracking_tool_enabled" value:true];
[controller.config save];
Returns
YES on success, NO on failure.
Since 1.0
- (BOOL) setFloat: (NSString *)  key
value: (float)  value 

Sets the floating point representation for the specified key.

[controller.config setFloat:@"Gesture.Circle.MinRadius" value:15];
[controller.config save];
Returns
YES on success, NO on failure.
Since 1.0
- (BOOL) setInt32: (NSString *)  key
value: (int32_t)  value 

Sets the 32-bit integer representation for the specified key.

[controller.config setInt32:@"background_app_mode" value:2];
[controller.config save];
Returns
YES on success, NO on failure.
Since 1.0
- (BOOL) setString: (NSString *)  key
value: (NSString *)  value 

Sets the string representation for the specified key.

[controller.config setString:@"Key.For.String.Setting" value:@"A String"];
[controller.config save];
Returns
YES on success, NO on failure.
Since 1.0
- (LeapValueType) type: (NSString *)  key

Reports the natural data type for the value related to the specified key.

The supported data types defined by the members of the LeapValueType enumeration:

TYPE_BOOLEAN

TYPE_INT32

TYPE_FLOAT

TYPE_STRING

TYPE_UNKNOWN

LeapValueType dataType = [config type:@"Key.For.Config"];
Parameters
keyThe key for the looking up the value in the configuration dictionary.
Returns
The native data type of the value, that is, the type that does not require a data conversion.
Since 1.0