Documentation

com.leapmotion.leap.Config Class Reference

The Config class provides access to Leap Motion system configuration information. More...

Inherits com.leapmotion.leap.Interface.

Classes

enum ValueType
Enumerates the possible data types for configuration values. More...

Public Member Functions

Config ()
Constructs a Config object.
boolean getBool (String key)
Gets the boolean representation for the specified key.
float getFloat (String key)
Gets the floating point representation for the specified key.
int getInt32 (String key)
Gets the 32-bit integer representation for the specified key.
String getString (String key)
Gets the string representation for the specified key.
boolean save ()
Saves the current state of the config.
boolean setBool (String key, boolean value)
Sets the boolean representation for the specified key.
boolean setFloat (String key, float value)
Sets the floating point representation for the specified key.
boolean setInt32 (String key, int value)
Sets the 32-bit integer representation for the specified key.
boolean setString (String key, String value)
Sets the string representation for the specified key.
Config.ValueType type (String key)
Reports the natural data type for the value related to the specified key.

Detailed Description

The Config class provides access to Leap Motion system configuration information.

You can get and set gesture configuration parameters using the Config object obtained from a connected Controller object. The key strings required to identify a configuration parameter include:

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 Config::save method to commit the changes. The configuration value changes are not persistent; your application needs to set the values everytime it runs.

See Also
CircleGesture
KeyTapGesture
ScreenTapGesture
SwipeGesture
Since
1.0

Constructor & Destructor Documentation

com.leapmotion.leap.Config.Config ( )

Constructs a Config object.

Do not create your own Config objects. Get a Config object using the Controller::config() function.

Config config = controller.config();
Since
1.0

Member Function Documentation

boolean com.leapmotion.leap.Config.getBool ( String key )

Gets the boolean representation for the specified key.

Boolean booleanValue = controller.config().getBool("Key.For.Boolean.Setting");
Since
1.0
float com.leapmotion.leap.Config.getFloat ( String key )

Gets the floating point representation for the specified key.

float floatValue = controller.config().getFloat("Gesture.Swipe.MinDistance");
Since
1.0
int com.leapmotion.leap.Config.getInt32 ( String key )

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

int intValue = controller.config().getInt32("Key.For.Integer.Setting");
Since
1.0
String com.leapmotion.leap.Config.getString ( String key )

Gets the string representation for the specified key.

String stringValue = controller.config().getString("Key.For.String.Setting");
Since
1.0
boolean com.leapmotion.leap.Config.save ( )

Saves the current state of the config.

Call save() after making a set of configuration changes. The save() function transfers the configuration changes to the Leap Motion service. The configuration value changes are not persistent; your application must set the values everytime it runs.

controller.config().setFloat("Gesture.Circle.MinRadius", 15);
controller.config().setFloat("Gesture.Circle.MinArc", 1.7f);
Boolean success = controller.config().save();
Returns
true on success, false on failure.
Since
1.0
boolean com.leapmotion.leap.Config.setBool ( String key,
boolean value
)

Sets the boolean representation for the specified key.

controller.config().setBool("Key.For.Boolean.Setting", true);
Returns
true on success, false on failure.
Since
1.0
boolean com.leapmotion.leap.Config.setFloat ( String key,
float value
)

Sets the floating point representation for the specified key.

controller.config().setFloat("Gesture.Circle.MinRadius", 15);
Returns
true on success, false on failure.
Since
1.0
boolean com.leapmotion.leap.Config.setInt32 ( String key,
int value
)

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

controller.config().setInt32("Key.For.Integer.Setting", 12);
Returns
true on success, false on failure.
Since
1.0
boolean com.leapmotion.leap.Config.setString ( String key,
String value
)

Sets the string representation for the specified key.

controller.config().setString("Key.For.String.Setting", "A String");
Returns
true on success, false on failure.
Since
1.0
Config.ValueType com.leapmotion.leap.Config.type ( String key )

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

Config.ValueType dataType = controller.config().type("Gesture.KeyTap.MinDistance");
Parameters
key The 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