Leap Motion C# API Reference  0.8.0
Leap.Config Class Reference

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

Inherits Leap.Interface.

Public Types

enum  ValueType {
  TYPEUNKNOWN = 0, TYPEBOOLEAN = 1, TYPEINT32 = 2, TYPEFLOAT = 6,
  TYPESTRING = 8
}
 Enumerates the possible data types for configuration values. More...
 

Public Member Functions

 Config ()
 Constructs a Config object.
 
bool 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.
 
bool Save ()
 Saves the current state of the config.
 
bool SetBool (string key, bool value)
 Sets the boolean representation for the specified key.
 
bool SetFloat (string key, float value)
 Sets the floating point representation for the specified key.
 
bool SetInt32 (string key, int value)
 Sets the 32-bit integer representation for the specified key.
 
bool 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

Member Enumeration Documentation

Enumerates the possible data types for configuration values.

The Config::type() function returns an item from the ValueType enumeration.

Enumerator:
TYPEUNKNOWN 

The data type is unknown.

TYPEBOOLEAN 

A boolean value.

TYPEINT32 

A 32-bit integer.

TYPEFLOAT 

A floating-point number.

TYPESTRING 

A string of characters.

Constructor & Destructor Documentation

Leap.Config.Config ( )
inline

Constructs a Config object.

Member Function Documentation

bool Leap.Config.GetBool ( string  key)
inline

Gets the boolean representation for the specified key.

float Leap.Config.GetFloat ( string  key)
inline

Gets the floating point representation for the specified key.

int Leap.Config.GetInt32 ( string  key)
inline

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

string Leap.Config.GetString ( string  key)
inline

Gets the string representation for the specified key.

bool Leap.Config.Save ( )
inline

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.

Returns
true on success, false on failure.
bool Leap.Config.SetBool ( string  key,
bool  value 
)
inline

Sets the boolean representation for the specified key.

Returns
true on success, false on failure.
bool Leap.Config.SetFloat ( string  key,
float  value 
)
inline

Sets the floating point representation for the specified key.

Returns
true on success, false on failure.
bool Leap.Config.SetInt32 ( string  key,
int  value 
)
inline

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

Returns
true on success, false on failure.
bool Leap.Config.SetString ( string  key,
string  value 
)
inline

Sets the string representation for the specified key.

Returns
true on success, false on failure.
Config.ValueType Leap.Config.Type ( string  key)
inline

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

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.