OkoLib
library for accessing Okolab devices
|
Functions | |
oko_res_type | oko_LibGetNumberOfPorts (uint32_t *count) |
Refresh available ports and return the number of them. More... | |
oko_res_type | oko_LibGetPortNames (char **names) |
Refresh available ports and return their names. More... | |
oko_res_type | oko_LibGetPortName (uint32_t portidx, char *portname) |
Get the name of the specified port, using the ports refreshed by oko_LibGetNumberOfPorts. More... | |
oko_res_type | oko_DeviceOpen (const char *port, uint32_t *deviceh) |
Open the specified device, returning a handle for it. More... | |
oko_res_type | oko_DevicesDetect (uint32_t max_num, uint32_t *devicesh, uint32_t *detected_num) |
Detect available devices and open them, returning an handle for each device. More... | |
oko_res_type | oko_DevicesDetectByName (uint32_t max_num, uint32_t *devicesh, char *name_filter, uint32_t *detected_num) |
Detect the first available device matching the filter name and open it, returning a handle for it. More... | |
oko_res_type | oko_DeviceDetectSingle (uint32_t *deviceh) |
Detect the first available device and open it, returning a handle for it. More... | |
oko_res_type | oko_DeviceDetectSingleByName (uint32_t *deviceh, char *name_filter) |
Detect the first available device matching the filter name and open it, returning a handle for it. More... | |
oko_res_type | oko_DeviceClose (uint32_t deviceh) |
Close the specified device. More... | |
oko_res_type | oko_DeviceGetLastError (uint32_t deviceh, char *errmsg, unsigned int maxsize) |
Return a text message that describes the error for the most recent failed call on a specified device. More... | |
oko_res_type | oko_DevicesCloseAll (void) |
Close all the opened devices. More... | |
oko_res_type oko_DeviceClose | ( | uint32_t | deviceh | ) |
Close the specified device.
[in] | deviceh | A valid device handle. |
oko_res_type oko_DeviceDetectSingle | ( | uint32_t * | deviceh | ) |
Detect the first available device and open it, returning a handle for it.
[out] | deviceh | The device handle. |
oko_res_type oko_DeviceDetectSingleByName | ( | uint32_t * | deviceh, |
char * | name_filter | ||
) |
Detect the first available device matching the filter name and open it, returning a handle for it.
[out] | deviceh | The device handle. |
[in] | name_filter | The filter on the product name (Product.name) |
oko_res_type oko_DeviceGetLastError | ( | uint32_t | deviceh, |
char * | errmsg, | ||
unsigned int | maxsize | ||
) |
Return a text message that describes the error for the most recent failed call on a specified device.
[in] | deviceh | A valid device handle. |
[out] | errmsg | A pointer to a valid string, pre-allocated by the caller, where the error message will be stored in. |
[in] | maxsize | Maximum size of the error message. If bigger, the message will be truncated. |
oko_res_type oko_DeviceOpen | ( | const char * | port, |
uint32_t * | deviceh | ||
) |
Open the specified device, returning a handle for it.
[in] | port | The serial port name (eg. 'COM1' on Windows and '/dev/ttyS0' on Linux). |
[out] | deviceh | The device handle. |
oko_res_type oko_DevicesCloseAll | ( | void | ) |
Close all the opened devices.
oko_res_type oko_DevicesDetect | ( | uint32_t | max_num, |
uint32_t * | devicesh, | ||
uint32_t * | detected_num | ||
) |
Detect available devices and open them, returning an handle for each device.
[in] | max_num | The max number of devices to detect. |
[out] | devicesh | Array of handles to the detected devices. |
[out] | detected_num | number of detected devices. It is the length of devicesh array. |
oko_res_type oko_DevicesDetectByName | ( | uint32_t | max_num, |
uint32_t * | devicesh, | ||
char * | name_filter, | ||
uint32_t * | detected_num | ||
) |
Detect the first available device matching the filter name and open it, returning a handle for it.
[in] | max_num | The max number of devices to detect. |
[out] | devicesh | Array of handles to the detected devices. |
[in] | name_filter | The filter on the product name (Product.name). If void no filter will be applied on the name. |
[out] | detected_num | number of detected devices. It is the length of devicesh array. |
oko_res_type oko_LibGetNumberOfPorts | ( | uint32_t * | count | ) |
Refresh available ports and return the number of them.
[out] | count | number of available ports |
oko_res_type oko_LibGetPortName | ( | uint32_t | portidx, |
char * | portname | ||
) |
Get the name of the specified port, using the ports refreshed by oko_LibGetNumberOfPorts.
[in] | portidx | zero-based port index |
[out] | portname | the specified port name, pre-allocated by the caller. |
oko_res_type oko_LibGetPortNames | ( | char ** | names | ) |
Refresh available ports and return their names.
[out] | names | array of names, pre-allocated by the caller |