OkoLib
library for accessing Okolab devices
Property information

Typedefs

typedef enum _oko_prop_type oko_prop_type
 Specifies the available property types.
 
typedef enum _oko_write_type oko_write_type
 Specifies the available write types.
 

Enumerations

enum  _oko_prop_type {
  OKO_PROP_UNDEF = 0,
  OKO_PROP_STRING = 1,
  OKO_PROP_INT = 2,
  OKO_PROP_DOUBLE = 3,
  OKO_PROP_ENUM = 4
}
 Specifies the available property types. More...
 
enum  _oko_write_type {
  OKO_WRITE_NONE = 0,
  OKO_WRITE_EEPROM = 1,
  OKO_WRITE_VOLATILE = 2,
  OKO_WRITE_BOTH = 3
}
 Specifies the available write types. More...
 

Functions

oko_res_type oko_PropertiesGetNumber (uint32_t deviceh, uint32_t *num)
 Get the number of available properties of the current device. More...
 
oko_res_type oko_PropertyGetName (uint32_t deviceh, uint32_t index, char *name)
 Get the name of the specified property, using its index. More...
 
oko_res_type oko_PropertyGetType (uint32_t deviceh, const char *name, oko_prop_type *prop_type)
 Get the type of the specified property. More...
 
oko_res_type oko_PropertyGetEnumNumber (uint32_t deviceh, const char *name, unsigned int *num)
 Get the number of availables enum values of the specified property. More...
 
oko_res_type oko_PropertyGetEnumName (uint32_t deviceh, const char *name, uint32_t enumh, char *enumname)
 Get the name of the specified enum field of the specified property. More...
 
oko_res_type oko_PropertyGetUnit (uint32_t deviceh, const char *name, char *unit)
 Get the measure unit of the specified property. More...
 
oko_res_type oko_PropertyGetDescription (uint32_t deviceh, const char *name, char *desc)
 Get the description of the specified property. More...
 
oko_res_type oko_PropertyGetReadOnly (uint32_t deviceh, const char *name, bool *read_only)
 Verify if the specified property is read-only. More...
 
oko_res_type oko_PropertyGetWriteOnly (uint32_t deviceh, const char *name, bool *write_only)
 Verify if the specified property is write-only. More...
 
oko_res_type oko_PropertyGetWriteType (uint32_t deviceh, const char *name, oko_write_type *write_type)
 Get the write type of the specified property. More...
 
oko_res_type oko_PropertyHasLimits (uint32_t deviceh, const char *name, bool *has_limits)
 Verify if the specified property has readable limits. More...
 
oko_res_type oko_PropertyGetLimits (uint32_t deviceh, const char *name, double *min, double *max)
 Get the minimum and maximum value that can be set for the specified property. More...
 
oko_res_type oko_PropertyIsMain (uint32_t deviceh, const char *name, bool *is_main)
 Verify if the specified property is a main feature of the device. More...
 
oko_res_type oko_PropertyIsAdvanced (uint32_t deviceh, const char *name, bool *is_adv)
 Verify if the specified property is an advanced feature of the device. More...
 

Detailed Description

Enumeration Type Documentation

Specifies the available property types.

Enumerator
OKO_PROP_UNDEF 

Undefined property type.

OKO_PROP_STRING 

String property type.

OKO_PROP_INT 

Integer (long) property type.

OKO_PROP_DOUBLE 

Double property type.

OKO_PROP_ENUM 

Enum property type.

Specifies the available write types.

Enumerator
OKO_WRITE_NONE 

No write available (read-only)

OKO_WRITE_EEPROM 

Only standard write is available.

OKO_WRITE_VOLATILE 

Only volatile write is available.

OKO_WRITE_BOTH 

Standard and volatile write types are available.

Function Documentation

oko_res_type oko_PropertiesGetNumber ( uint32_t  deviceh,
uint32_t *  num 
)

Get the number of available properties of the current device.

Parameters
[in]devicehA valid device handle.
[out]numThe total number of properties for the current device.
Returns
OKO_OK upon success, an error code otherwise.
oko_res_type oko_PropertyGetDescription ( uint32_t  deviceh,
const char *  name,
char *  desc 
)

Get the description of the specified property.

Parameters
[in]devicehA valid device handle.
[in]nameThe property name.
[out]descDescription string, pre-allocated by the caller.
Returns
OKO_OK upon success, an error code otherwise.
oko_res_type oko_PropertyGetEnumName ( uint32_t  deviceh,
const char *  name,
uint32_t  enumh,
char *  enumname 
)

Get the name of the specified enum field of the specified property.

Parameters
[in]devicehA valid device handle.
[in]nameThe property name.
[in]enumhA valid enum handle.
[out]enumnamethe desired value. String needs to be pre-allocated by the caller.
Returns
OKO_OK upon success, an error code otherwise.
oko_res_type oko_PropertyGetEnumNumber ( uint32_t  deviceh,
const char *  name,
unsigned int *  num 
)

Get the number of availables enum values of the specified property.

Parameters
[in]devicehA valid device handle.
[in]nameThe property name.
[out]numpointer to desired value
Returns
OKO_OK upon success, an error code otherwise.
oko_res_type oko_PropertyGetLimits ( uint32_t  deviceh,
const char *  name,
double *  min,
double *  max 
)

Get the minimum and maximum value that can be set for the specified property.

Values are zero if the property has no limits.

Parameters
[in]devicehA valid device handle.
[in]nameThe property name.
[out]minMinimum value that can be set.
[out]maxMaximum value that can be set.
Returns
OKO_OK upon success, an error code otherwise.
oko_res_type oko_PropertyGetName ( uint32_t  deviceh,
uint32_t  index,
char *  name 
)

Get the name of the specified property, using its index.

Index is zero-based, so the first property has index 0 and the last num-1 (oko_PropertiesGetNumber= This should be used at start to obtain the property names.

Parameters
[in]devicehA valid device handle.
[in]indexIndex of the property. Index is zero-based.
[out]nameThe name of the property. It needs to be pre-allocated by the caller.
Returns
OKO_OK upon success, an error code otherwise.
oko_res_type oko_PropertyGetReadOnly ( uint32_t  deviceh,
const char *  name,
bool *  read_only 
)

Verify if the specified property is read-only.

Parameters
[in]devicehA valid device handle.
[in]nameThe property name.
[out]read_onlyTRUE if the property is read-only.
Returns
OKO_OK upon success, an error code otherwise.
oko_res_type oko_PropertyGetType ( uint32_t  deviceh,
const char *  name,
oko_prop_type prop_type 
)

Get the type of the specified property.

Parameters
[in]devicehA valid device handle.
[in]nameThe property name.
[out]prop_typeThe property type as defined in oko_prop_type.
Returns
OKO_OK upon success, an error code otherwise.
oko_res_type oko_PropertyGetUnit ( uint32_t  deviceh,
const char *  name,
char *  unit 
)

Get the measure unit of the specified property.

Parameters
[in]devicehA valid device handle.
[in]nameThe property name string, pre-allocated by the caller.
[out]unitUnit of measure string, pre-allocated by the caller.
Returns
OKO_OK upon success, an error code otherwise.
oko_res_type oko_PropertyGetWriteOnly ( uint32_t  deviceh,
const char *  name,
bool *  write_only 
)

Verify if the specified property is write-only.

Parameters
[in]devicehA valid device handle.
[in]nameThe property name.
[out]write_onlyTRUE if the property is write-only.
Returns
OKO_OK upon success, an error code otherwise.
oko_res_type oko_PropertyGetWriteType ( uint32_t  deviceh,
const char *  name,
oko_write_type write_type 
)

Get the write type of the specified property.

Parameters
[in]devicehA valid device handle.
[in]nameThe property name.
[out]write_typeThe property type as defined in oko_prop_type.
Returns
OKO_OK upon success, an error code otherwise.
oko_res_type oko_PropertyHasLimits ( uint32_t  deviceh,
const char *  name,
bool *  has_limits 
)

Verify if the specified property has readable limits.

It can be used with write properties to know if the high and low value can be requested to the device.

Parameters
[in]devicehA valid device handle.
[in]nameThe property name.
[out]has_limitsTRUE if the property limits can be read.
Returns
OKO_OK upon success, an error code otherwise.
oko_res_type oko_PropertyIsAdvanced ( uint32_t  deviceh,
const char *  name,
bool *  is_adv 
)

Verify if the specified property is an advanced feature of the device.

Advanced feature should are mainly used for advanced application or debugging.

Parameters
[in]devicehA valid device handle.
[in]nameThe property name.
[out]is_advTRUE if the property is an advanced feature.
Returns
OKO_OK upon success, an error code otherwise.
oko_res_type oko_PropertyIsMain ( uint32_t  deviceh,
const char *  name,
bool *  is_main 
)

Verify if the specified property is a main feature of the device.

Parameters
[in]devicehA valid device handle.
[in]nameThe property name.
[out]is_mainTRUE if the property is one of the main feature.
Returns
OKO_OK upon success, an error code otherwise.