Phidget Dictionary
|
Typedefs |
typedef struct
_CPhidgetDictionary * | CPhidgetDictionaryHandle |
typedef struct
_CPhidgetDictionaryListener * | CPhidgetDictionaryListenerHandle |
typedef int(* | CPhidgetDictionary_OnKeyChange_Function )(CPhidgetDictionaryHandle dict, void *userPtr, const char *key, const char *value, CPhidgetDictionary_keyChangeReason reason) |
Enumerations |
enum | CPhidgetDictionary_keyChangeReason { PHIDGET_DICTIONARY_VALUE_CHANGED = 1,
PHIDGET_DICTIONARY_ENTRY_ADDED,
PHIDGET_DICTIONARY_ENTRY_REMOVING,
PHIDGET_DICTIONARY_CURRENT_VALUE
} |
Functions |
int | CPhidgetDictionary_create (CPhidgetDictionaryHandle *dict) |
int | CPhidgetDictionary_close (CPhidgetDictionaryHandle dict) |
int | CPhidgetDictionary_delete (CPhidgetDictionaryHandle dict) |
int | CPhidgetDictionary_set_OnError_Handler (CPhidgetDictionaryHandle dict, int(*fptr)(CPhidgetDictionaryHandle, void *userPtr, int errorCode, const char *errorString), void *userPtr) |
int | CPhidgetDictionary_addKey (CPhidgetDictionaryHandle dict, const char *key, const char *value, int persistent) |
int | CPhidgetDictionary_removeKey (CPhidgetDictionaryHandle dict, const char *pattern) |
int | CPhidgetDictionary_set_OnKeyChange_Handler (CPhidgetDictionaryHandle dict, CPhidgetDictionaryListenerHandle *dictlistener, const char *pattern, CPhidgetDictionary_OnKeyChange_Function fptr, void *userPtr) |
int | CPhidgetDictionary_remove_OnKeyChange_Handler (CPhidgetDictionaryListenerHandle dictlistener) |
int | CPhidgetDictionary_getKey (CPhidgetDictionaryHandle dict, const char *key, char *value, int valuelen) |
int | CPhidgetDictionary_set_OnServerConnect_Handler (CPhidgetDictionaryHandle dict, int(*fptr)(CPhidgetDictionaryHandle dict, void *userPtr), void *userPtr) |
int | CPhidgetDictionary_set_OnServerDisconnect_Handler (CPhidgetDictionaryHandle dict, int(*fptr)(CPhidgetDictionaryHandle dict, void *userPtr), void *userPtr) |
int | CPhidgetDictionary_getServerID (CPhidgetDictionaryHandle dict, const char **serverID) |
int | CPhidgetDictionary_getServerAddress (CPhidgetDictionaryHandle dict, const char **address, int *port) |
int | CPhidgetDictionary_getServerStatus (CPhidgetDictionaryHandle dict, int *serverStatus) |
int | CPhidgetDictionary_openRemote (CPhidgetDictionaryHandle dict, const char *serverID, const char *password) |
int | CPhidgetDictionary_openRemoteIP (CPhidgetDictionaryHandle dict, const char *address, int port, const char *password) |
Detailed Description
These calls are specific to the Phidget Dictionary.
Typedef Documentation
A Phidget Dictionary handle. A Phidget Dictionary handle
A Dictionary key listener handle. A Phidget DictionaryListener handle
Callback function for KeyChange events.
- Parameters:
-
| dict | Dictionary from which this event originated. |
| userPtr | User defined data. |
| key | Key value. |
| value | Value value. |
| reason | Reason for KeyChange event. |
Enumeration Type Documentation
Possible reasons for a key event.
- Enumerator:
-
PHIDGET_DICTIONARY_VALUE_CHANGED |
The value of an existing key/value pair changed. |
PHIDGET_DICTIONARY_ENTRY_ADDED |
A new key/value pair was added. |
PHIDGET_DICTIONARY_ENTRY_REMOVING |
A key is being removed. |
PHIDGET_DICTIONARY_CURRENT_VALUE |
Initial state received once a handler was added. |
Function Documentation
Creates a Phidget Dictionary handle.
- Parameters:
-
| dict | A pointer to an unallocated phidget dictionary handle. |
Closes the connection to a Phidget Dictionary.
- Parameters:
-
| dict | An opened phidget dictionary handle. |
Frees a Phidget Dictionary handle.
- Parameters:
-
| dict | A closed dictionary handle. |
Sets the error handler callback function. This is called when an asynchronous error occurs.
- Parameters:
-
| dict | A phidget dictionary handle. |
| fptr | Callback function pointer. |
| userPtr | A pointer for use by the user - this value is passed back into the callback function. |
Adds a key/value pair to the dictionary. Or, changes an existing key's value.
- Parameters:
-
| dict | A connected dictionary handle. |
| key | The key value. |
| value | The value value. |
| persistent | Whether the key stays in the dictionary after disconnection. |
Removes a set of keys from the dictionary.
- Parameters:
-
| dict | A connected dictionary handle. |
| pattern | A regular expression representing th eset of keys to remove. |
Adds a key listener to an opened dictionary. Note that this should only be called after the connection to the dictionary has been made - unlike all other events.
- Parameters:
-
| dict | A connected dictionary handle. |
| dictlistener | A pointer to an unallocated dictionary key listener handle. |
| pattern | A regular expression representing the set of keys to monitor. |
| fptr | Callback function pointer. |
| userPtr | A pointer for use by the user - this value is passed back into the callback function. |
Removes a key listener.
- Parameters:
-
Gets a key value. If more then one key matches, only the first value is returned.
- Parameters:
-
| dict | A phidget dictionary handle. |
| key | A key value to look up. |
| value | A user array for the value to be stored in. Set to NULL if the key does not exist. |
| valuelen | Length of the value array. |
Sets a server connect handler callback function. This is called when a connection to the sever has been made.
- Parameters:
-
| dict | A phidget dictionary handle. |
| fptr | Callback function pointer. |
| userPtr | A pointer for use by the user - this value is passed back into the callback function. |
Sets a server disconnect handler callback function. This is called when a connection to the server has been lost.
- Parameters:
-
| dict | A phidget dictionary handle. |
| fptr | Callback function pointer. |
| userPtr | A pointer for use by the user - this value is passed back into the callback function. |
Gets the server ID.
- Parameters:
-
| dict | A connected dictionary handle. |
| serverID | A pointer which will be set to a char array containing the server ID string. |
Gets the address and port.
- Parameters:
-
| dict | A connected dictionary handle. |
| address | A pointer which will be set to a char array containing the address string. |
| port | An int pointer for returning the port number. |
Gets the connected to server status.
- Parameters:
-
Opens a Phidget dictionary by ServerID. Note that this requires Bonjour (mDNS) to be running on both the host and the server.
- Parameters:
-
| dict | A phidget dictionary handle. |
| serverID | Server ID. Specify NULL to open any. |
| password | Password. Can be NULL if the server is running unsecured. |
int CPhidgetDictionary_openRemoteIP |
( |
CPhidgetDictionaryHandle |
dict, |
|
|
const char * |
address, |
|
|
int |
port, |
|
|
const char * |
password | |
|
) |
| | |
Opens a Phidget dictionary by address and port.
- Parameters:
-
| dict | A phidget dictionary handle. |
| address | Address. This can be a hostname or IP address. |
| port | Port number. Default is 5001. |
| password | Password. Can be NULL if the server is running unsecured. |