USER_CVT_DATA_TO_DEVICE

Converts data from the format for the given point type to the general toolkit format.

The Device Communications Toolkit calls user_write_data() to write to the same device domain from various points of different data types. The user_write_data() subroutine assumes data is in little endian format (least significant byte first) and is otherwise consistent with the data type of the device domain.

For example, an SINT (8 bit integer) point can be configured in a bit domain and used to set eight (8) bits at a time, or the individual bits can be set with BOOL setpoints.

The Device Communications Toolkit calls user_cvt_data_to_device() for individual points to perform data conversion specific to the point data type.

For example, if the point data type is not SINT (8 bit integer), it may be necessary to swap bytes or swap words in the point data to make it little endian for user_write_data().

You can find the template for this subroutine in:

usrtm_cvtto.c

Syntax

void user_cvt_data_to_device ( device_struct,

        address_struct, element_cnt, element_size,

        pnt_data_type, data_buffer)

DEVICE_DATA *device_struct;

ADDR_DATA   *address_struct;

int         element_cnt;

int         element_size;

int         pnt_data_type;

char        *data_buffer;

Input Parameters

device_struct

Is a pointer to the structure defining device data. DEVICE_DATA is a typedef to a structure defined in <inc_path/toolkit.h>.

address_struct

Is a pointer to the address from which the data was read. ADDR_DATA is a typedef to a structure defined in <inc_path/toolkit.h>.

element_cnt

Is the number of point elements to convert.

element_size

Is the number of bytes per point element.

pnt_data_type

Is the CIMPLICITY point type. The standard CIMPLICITY point types supported by the Device Communications Toolkit are:

TOOLKIT_BOOLEAN

TOOLKIT_BITSTRING

TOOLKIT_OCTETSTRING

TOOLKIT_TEXTPOINT

TOOLKIT_UNSIGNED_ANALOG8

TOOLKIT_UNSIGNED_ANALOG16

TOOLKIT_UNSIGNED_ANALOG32

TOOLKIT_ANALOG8

TOOLKIT_ANALOG16

TOOLKIT_ANALOG32

TOOLKIT_FLOATINGPOINT

Output Parameters

data_buffer

Is the buffer of data to be converted.

Return Value

None.

More information

Device Communications toolkit subroutines.