Phidget Manager


Typedefs

typedef struct _CPhidgetManager * CPhidgetManagerHandle

Functions

int CPhidgetManager_create (CPhidgetManagerHandle *phidm)
int CPhidgetManager_open (CPhidgetManagerHandle phidm)
int CPhidgetManager_close (CPhidgetManagerHandle phidm)
int CPhidgetManager_delete (CPhidgetManagerHandle phidm)
int CPhidgetManager_set_OnAttach_Handler (CPhidgetManagerHandle phidm, int(*fptr)(CPhidgetHandle phid, void *userPtr), void *userPtr)
int CPhidgetManager_set_OnDetach_Handler (CPhidgetManagerHandle phidm, int(*fptr)(CPhidgetHandle phid, void *userPtr), void *userPtr)
int CPhidgetManager_getAttachedDevices (CPhidgetManagerHandle phidm, CPhidgetHandle *phidArray[], int *count)
int CPhidgetManager_freeAttachedDevicesArray (CPhidgetHandle phidArray[])
int CPhidgetManager_set_OnError_Handler (CPhidgetManagerHandle phidm, int(*fptr)(CPhidgetManagerHandle phidm, void *userPtr, int errorCode, const char *errorString), void *userPtr)
int CPhidgetManager_set_OnServerConnect_Handler (CPhidgetManagerHandle phidm, int(*fptr)(CPhidgetManagerHandle phidm, void *userPtr), void *userPtr)
int CPhidgetManager_set_OnServerDisconnect_Handler (CPhidgetManagerHandle phidm, int(*fptr)(CPhidgetManagerHandle phidm, void *userPtr), void *userPtr)
int CPhidgetManager_getServerID (CPhidgetManagerHandle phidm, const char **serverID)
int CPhidgetManager_getServerAddress (CPhidgetManagerHandle phidm, const char **address, int *port)
int CPhidgetManager_getServerStatus (CPhidgetManagerHandle phidm, int *serverStatus)
int CPhidgetManager_openRemote (CPhidgetManagerHandle phidm, const char *serverID, const char *password)
int CPhidgetManager_openRemoteIP (CPhidgetManagerHandle phidm, const char *address, int port, const char *password)

Detailed Description

These calls are specific to the Phidget Manager. The Phidget Manager allows enumeration of all connected devices and notification of device attach and detach events.

Typedef Documentation

typedef struct _CPhidgetManager* CPhidgetManagerHandle

A Phidget Manager handle. A Phidget Manager handle


Function Documentation

int CPhidgetManager_create ( CPhidgetManagerHandle phidm  ) 

Creates a Phidget Manager handle.

Parameters:
phidm A pointer to an empty phidget manager handle.

int CPhidgetManager_open ( CPhidgetManagerHandle  phidm  ) 

Opens a Phidget Manager.

Parameters:
phidm A phidget manager handle.

int CPhidgetManager_close ( CPhidgetManagerHandle  phidm  ) 

Closes a Phidget Manager.

Parameters:
phidm An opened phidget manager handle.

int CPhidgetManager_delete ( CPhidgetManagerHandle  phidm  ) 

Frees a Phidget Manager handle.

Parameters:
phidm A closed phidget manager handle.

int CPhidgetManager_set_OnAttach_Handler ( CPhidgetManagerHandle  phidm,
int(*)(CPhidgetHandle phid, void *userPtr)  fptr,
void *  userPtr 
)

Sets an attach handler callback function. This is called when a Phidget is plugged into the system.

Parameters:
phidm A phidget manager handle.
fptr Callback function pointer.
userPtr A pointer for use by the user - this value is passed back into the callback function.

int CPhidgetManager_set_OnDetach_Handler ( CPhidgetManagerHandle  phidm,
int(*)(CPhidgetHandle phid, void *userPtr)  fptr,
void *  userPtr 
)

Sets a detach handler callback function. This is called when a Phidget is unplugged from the system.

Parameters:
phidm A phidget manager handle.
fptr Callback function pointer.
userPtr A pointer for use by the user - this value is passed back into the callback function.

int CPhidgetManager_getAttachedDevices ( CPhidgetManagerHandle  phidm,
CPhidgetHandle phidArray[],
int *  count 
)

Gets a list of all currently attached Phidgets. When you are finished with the list, free it with CPhidgetManager_freeAttachedDevicesArray.

Parameters:
phidm An opened phidget manager handle.
phidArray An empty pointer for returning the list of Phidgets. Note that this list is created internally, you don't need to pass in a array.
count An int pointer for returning the list size

int CPhidgetManager_freeAttachedDevicesArray ( CPhidgetHandle  phidArray[]  ) 

Frees the array that is allocated when CPhidgetManager_getAttachedDevices is called. Since the array is malloced internally to the library, it should also be freed internally to the library.

Parameters:
phidArray An array of CPhidgetHandles.

int CPhidgetManager_set_OnError_Handler ( CPhidgetManagerHandle  phidm,
int(*)(CPhidgetManagerHandle phidm, void *userPtr, int errorCode, const char *errorString)  fptr,
void *  userPtr 
)

Sets the error handler callback function. This is called when an asynchronous error occurs.

Parameters:
phidm A phidget manager handle.
fptr Callback function pointer.
userPtr A pointer for use by the user - this value is passed back into the callback function.

int CPhidgetManager_set_OnServerConnect_Handler ( CPhidgetManagerHandle  phidm,
int(*)(CPhidgetManagerHandle phidm, void *userPtr)  fptr,
void *  userPtr 
)

Sets a server connect handler callback function. This is used for opening Phidget Managers remotely, and is called when a connection to the sever has been made.

Parameters:
phidm A phidget manager handle.
fptr Callback function pointer.
userPtr A pointer for use by the user - this value is passed back into the callback function.

int CPhidgetManager_set_OnServerDisconnect_Handler ( CPhidgetManagerHandle  phidm,
int(*)(CPhidgetManagerHandle phidm, void *userPtr)  fptr,
void *  userPtr 
)

Sets a server disconnect handler callback function. This is used for opening Phidget Managers remotely, and is called when a connection to the server has been lost.

Parameters:
phidm A phidget manager handle.
fptr Callback function pointer.
userPtr A pointer for use by the user - this value is passed back into the callback function.

int CPhidgetManager_getServerID ( CPhidgetManagerHandle  phidm,
const char **  serverID 
)

Gets the server ID of a remotely opened Phidget Manager. This will fail if the manager was opened locally.

Parameters:
phidm A connected phidget manager handle.
serverID A pointer which will be set to a char array containing the server ID string.

int CPhidgetManager_getServerAddress ( CPhidgetManagerHandle  phidm,
const char **  address,
int *  port 
)

Gets the address and port of a remotely opened Phidget Manager. This will fail if the manager was opened locally.

Parameters:
phidm A connected phidget manager 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.

int CPhidgetManager_getServerStatus ( CPhidgetManagerHandle  phidm,
int *  serverStatus 
)

Gets the connected to server status of a remotely opened Phidget Manager. This will fail if the manager was opened locally.

Parameters:
phidm An opened phidget manager handle.
serverStatus An int pointer for returning the server status. Possible codes are PHIDGET_ATTACHED and PHIDGET_NOTATTACHED.

int CPhidgetManager_openRemote ( CPhidgetManagerHandle  phidm,
const char *  serverID,
const char *  password 
)

Opens a Phidget manager remotely by ServerID. Note that this requires Bonjour (mDNS) to be running on both the host and the server.

Parameters:
phidm A phidget manager handle.
serverID Server ID. Specify NULL to open any.
password Password. Can be NULL if the server is running unsecured.

int CPhidgetManager_openRemoteIP ( CPhidgetManagerHandle  phidm,
const char *  address,
int  port,
const char *  password 
)

Opens a Phidget manager remotely by address and port.

Parameters:
phidm A phidget manager 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.


Generated on Wed Jan 5 12:08:42 2022 for Phidget21 by  doxygen 1.5.9