Data APIs

rs_data_read_from_any_for_type

Defined in <sparklet_api.h>

Version

int rs_data_read_from_any_for_type (void *ptr_control, RS_DATA_ID data_id, void *ptr_value, int target_type);

Since 1.1

This function is used to read the data from the given ID to the specified memory. The target type can be set so that the Sparklet engine will automatically convert it.

PARAMETERS:

ptr_control

Flint ID of widget, if internal information is to be read

data_id

Data ID

ptr_value

Pointer to memory to store read value

target_type

Target memory type like RS_DATA_PROP_STORAGE_INT8U, RS_DATA_PROP_STORAGE_INT32S etc

RETURN VALUE:

RS_DATA_PROP_STORAGE_NO_CONV 0

RS_DATA_PROP_STORAGE_INT8U 1

RS_DATA_PROP_STORAGE_INT8S 2

RS_DATA_PROP_STORAGE_INT16U 3

RS_DATA_PROP_STORAGE_INT16S 4

RS_DATA_PROP_STORAGE_INT32U 5

RS_DATA_PROP_STORAGE_INT32S 6

RS_DATA_PROP_STORAGE_REAL32 7

RS_DATA_PROP_STORAGE_STRING 8

RS_DATA_PROP_STORAGE_REAL32_BE 9

RS_DATA_PROP_STORAGE_INT16U_BE 10

RS_DATA_PROP_STORAGE_TIME 11

RS_DATA_PROP_STORAGE_UESTRING 12

Error Code Failure -1

Example:

The below code reads the data ID 333 and stores to u32_value as 32-bit unsigned variable.

rs_data_read_from_any_for_type (ptr_control, 333, &u32_value, RS_DATA_PROP_STORAGE_INT32U);

rs_data_read_to_mem_for_type

Defined in <sparklet_api.h>

Version

int  rs_data_read_to_mem_for_type (RS_DATA_ID data_id, void *ptr_value, int target_type);

Since 1.1

This function is used to read the data from the given ID to the specified memory. The target type can be set so that the Sparklet engine will automatically convert it.

PARAMETERS:

data_id

Data ID

ptr_value

Pointer to memory to store read value

target_type

Target memory type like RS_DATA_PROP_STORAGE_INT8U, RS_DATA_PROP_STORAGE_INT32S etc

RETURN VALUE:

RS_DATA_PROP_STORAGE_NO_CONV 0

RS_DATA_PROP_STORAGE_INT8U 1

RS_DATA_PROP_STORAGE_INT8S 2

RS_DATA_PROP_STORAGE_INT16U 3

RS_DATA_PROP_STORAGE_INT16S 4

RS_DATA_PROP_STORAGE_INT32U 5

RS_DATA_PROP_STORAGE_INT32S 6

RS_DATA_PROP_STORAGE_REAL32 7

RS_DATA_PROP_STORAGE_STRING 8

RS_DATA_PROP_STORAGE_REAL32_BE 9

RS_DATA_PROP_STORAGE_INT16U_BE 10

RS_DATA_PROP_STORAGE_TIME 11

RS_DATA_PROP_STORAGE_UESTRING 12

Error Code Failure -1

Example:

The below code reads the data ID 333 and stores to u32_value as 32-bit unsigned variable.

rs_data_read_from_mem_for_type (333, &u32_value, RS_DATA_PROP_STORAGE_INT32U);

rs_data_info_write_from_mem

Defined in <sparklet_api.h>

Version

int  rs_data_info_write_from_mem (RS_DATA_ID data_id, void *ptr_value);

Since 1.1

This function is used to update the value to the given data ID.

PARAMETERS:

data_id

Data ID

ptr_value

Pointer to memory to write from. It must be in the same type as specified during variable creation.

RETURN VALUE:

RS_DATA_WRITE_SUCCESS 0

RS_DATA_WRITE_SUCCESS_NO_CHANGE 1

RS_DATA_WRITE_ERR_MORE_THAN_MAX -1

RS_DATA_WRITE_ERR_LESS_THAN_MIN -2

RS_DATA_WRITE_ERR_INVALID_ID -3

RS_DATA_ERR_INVALID_OFFSET -4

Example:

The below code writes the data stored in u32_value to data id 333 as 32-bit unsigned variable.

rs_data_info_write_from_mem (333, &u32_value);