user_cvt_data_from_device

Converts data from the general toolkit format to a format compatible with the given point type.

The Device Communications Toolkit calls user_read_data() to read data for multiple points at the same address. The data returned by user_read_data() should be in a format consistent with the device domain and the host data format.

  • For example, data from a word domain should be returned in little endian format (least significant byte first). If data in the device is in big endian format (most significant byte first), you should byte swap the data within user_read_data().

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

  • For example, if the point data type is INT (16 bit integer), it may be necessary to byte swap the little endian data returned from user_read_data().

You can find the template for this subroutine in:

usrtm_cvtfrom.c

Syntax

void user_cvt_data_from_device ( DEVICE_DATA *device_struct,
??????????????????????????????????????????????????????????????????ADDR_DATA *address_struct,
??????????????????????????????????????????????????????????????????int element_cnt,
??????????????????????????????????????????????????????????????????int element_size,
??????????????????????????????????????????????????????????????????int pnt_data_type,
??????????????????????????????????????????????????????????????????char *data_buffer)

Input Arguments

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>.

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

In addition, a device communication interface may optionally support:

  • TOOLKIT_UNSIGNED_ANALOG64
  • TOOLKIT_ANALOG64

Output Parameters

data_buffer

Is the buffer of data to be converted.

Return Value

None.