ConfigΒΆ

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

Public Types

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

Public Member Functions

 Config (int connectionKey)
 Creates a new Config object for setting runtime configuration settings. More...
 
bool Get< T > (string key, Action< T > onResult)
 Requests a configuration value. More...
 
bool GetBool (string key)
 Gets the boolean representation for the specified key. More...
 
bool GetFloat (string key)
 Gets the floating point representation for the specified key. More...
 
bool GetInt32 (string key)
 Gets the 32-bit integer representation for the specified key. More...
 
bool GetString (string key)
 Gets the string representation for the specified key. More...
 
bool Save ()
 Saves the current state of the config. More...
 
bool Set< T > (string key, T value, Action< bool > onResult)
 Sets a configuration value. More...
 
bool SetBool (string key, bool value)
 Sets the boolean representation for the specified key. More...
 
bool SetFloat (string key, float value)
 Sets the floating point representation for the specified key. More...
 
bool SetInt32 (string key, int value)
 Sets the 32-bit integer representation for the specified key. More...
 
bool SetString (string key, string value)
 Sets the string representation for the specified key. More...
 
Config.ValueType Type (string key)
 The data type for a configuration parameter. More...
 

Detailed Description

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

Since
1.0

Member Enumeration Documentation

enum ValueType
strong

Enumerates the possible data types for configuration values.

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

Since
1.0
Enumerator
TYPE_UNKNOWN 

The data type is unknown.

Since
1.0
TYPE_BOOLEAN 

A boolean value.

Since
1.0
TYPE_INT32 

A 32-bit integer.

Since
1.0
TYPE_FLOAT 

A floating-point number.

Since
1.0
TYPE_STRING 

A string of characters.

Since
1.0

Constructor & Destructor Documentation

Config ( int  connectionKey)

Creates a new Config object for setting runtime configuration settings.

Note that the Controller.Config provides a properly initialized Config object already.

Parameters
connectionKeyThe id of the connnection. This id must match the key used to create the Controller.
Since
3.0

Member Function Documentation

bool Get< T > ( string  key,
Action< T >  onResult 
)

Requests a configuration value.

Parameters
keyThe string identifier for the setting.
onResultThe action to take when the Leap service returns the config value. The Action delegate must take a parameter matching the config value type. The current value of the setting is passed to this delegate.
Since
3.0
bool GetBool ( string  key)

Gets the boolean representation for the specified key.

@ deprecated use Get<bool>(key, delegate)

Since
1.0
bool GetFloat ( string  key)

Gets the floating point representation for the specified key.

@ deprecated use Get<float>(key, delegate)

Since
1.0
bool GetInt32 ( string  key)

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

@ deprecated use Get<Int32>(key, delegate)

Since
1.0
bool GetString ( string  key)

Gets the string representation for the specified key.

@ deprecated use Get<string>(key, delegate)

Since
1.0
bool Save ( )

Saves the current state of the config.

bool Set< T > ( string  key,
value,
Action< bool >  onResult 
)

Sets a configuration value.

Parameters
keyThe string identifier for the setting.
onResultThe action to take when the Leap service sets the config value. The Action delegate must take a boolean parameter. The service calls this delegate with the value true if the setting was changed successfully and false, otherwise.
Since
3.0
Type Constraints
T :IConvertible 
bool SetBool ( string  key,
bool  value 
)

Sets the boolean representation for the specified key.

controller.Config.Set<bool> ("websockets_enabled", true, delegate( bool success){
if(!success)
Console.WriteLine("Warning: Could not enable WebSockets");
});
Returns
true on success, false on failure.
Since
1.0
bool SetFloat ( string  key,
float  value 
)

Sets the floating point representation for the specified key.

controller.Config.Set<float> ("Key.For.Float.Setting", 15, delegate(bool success){
if(!success)
Console.WriteLine("Warning: Could not set configuration.");
});
Returns
true on success, false on failure.
Since
1.0
bool SetInt32 ( string  key,
int  value 
)

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

controller.Config.Set<Int32> ("Key.For.Integer.Setting", 12, delegate(bool success){
if(!success)
Console.WriteLine("Warning: Could not set configuration.");
});
Returns
true on success, false on failure.
Since
1.0
bool SetString ( string  key,
string  value 
)

Sets the string representation for the specified key.

controller.Config.Set<string> ("Key.For.String.Setting", "A String", delegate(bool success){
if(!success)
Console.WriteLine("Warning: Could not set configuration.");
});
Returns
true on success, false on failure.
Since
1.0
Config.ValueType Type ( string  key)

The data type for a configuration parameter.

@ deprecated Always returns Config.ValueType.TYPE_UNKNOWN