Macros | |
| #define | OM_VERSION 108 |
Typedefs | |
| typedef void(* | OmLogCallback) (void *, const char *) |
| typedef void(* | OmDeviceCallback) (void *, int, OM_DEVICE_STATUS) |
Enumerations | |
| enum | OM_DEVICE_STATUS { OM_DEVICE_REMOVED, OM_DEVICE_CONNECTED } |
Functions | |
| int | OmStartup (int version) |
| int | OmShutdown (void) |
| int | OmSetLogStream (int fd) |
| int | OmSetLogCallback (OmLogCallback logCallback, void *reference) |
| int | OmSetDeviceCallback (OmDeviceCallback deviceCallback, void *reference) |
| int | OmGetDeviceIds (int *deviceIds, int maxDevices) |
Functions to support API initialization and device discovery. The API must be initialized before first use with OmStartup(), and shut down after use with OmShutdown().
To be notified when a device is added or removed from the system, the user can register a 'callback' function with OmSetDeviceCallback().
Alternatively, users may call OmGetDeviceIds() at any time to list all of the currently connected devices.
| #define OM_VERSION 108 |
A numeric code for current API version defined in this header file.
| typedef void(* OmDeviceCallback) (void *, int, OM_DEVICE_STATUS) |
Device change callback function type.
Called for device addition or removal. Callback functions take a user-defined reference pointer, a device ID, and a state code.
| typedef void(* OmLogCallback) (void *, const char *) |
Log callback function type.
Called for API log messages. Callback functions take a user-defined reference pointer, and a log message.
| enum OM_DEVICE_STATUS |
Device states used in the OmDeviceCallback handler.
| Enumerator | |
|---|---|
| OM_DEVICE_REMOVED | Device is being removed, or is already removed. |
| OM_DEVICE_CONNECTED | Device has been connected. |
| int OmGetDeviceIds | ( | int * | deviceIds, |
| int | maxDevices | ||
| ) |
Obtains the device IDs of all connected devices.
Call
to get the number of devices connected.
| [out] | deviceIds | A pointer to a buffer used to return the device IDs. May be NULL if maxDevices = 0. |
| maxDevices | The maximum number of device IDs the supplied buffer can store. |
| >=0 | the actual number of devices present, which may be more or less than maxDevices passed. |
| <0 | An error code. |
| int OmSetDeviceCallback | ( | OmDeviceCallback | deviceCallback, |
| void * | reference | ||
| ) |
Sets the callback function that is called whenever a device is added or removed.
| deviceCallback | The function to call when a device is added or removed, or NULL to remove the callback. | |
| [in] | reference | A user-defined reference to pass to the callback function (or NULL if unwanted). |
| int OmSetLogCallback | ( | OmLogCallback | logCallback, |
| void * | reference | ||
| ) |
Sets the callback function that is called whenever an API log message is written.
| logCallback | The function to call when a log message is written, or NULL to remove the callback. | |
| [in] | reference | A user-defined reference to pass to the callback function (or NULL if unwanted). |
| int OmSetLogStream | ( | int | fd | ) |
Sets the stream to use for log messages.
| fd | The file descriptor to use. Specify -1 for none; fileno(stderr) for standard error; or fileno(fopen("log.txt", "wt")) for a file. |
| int OmShutdown | ( | void | ) |
Shuts down the Open Movement API.
This call frees resources used by the API.
| int OmStartup | ( | int | version | ) |
Initializes the Open Movement API.
Allocates required resources for the API, initializes its state, and initiates device discovery.
| version | The version number of the API required (use OM_VERSION). |