Skip to main content
Skip table of contents

eReadNameString

Read a device register that returns a string, specified by name.

Syntax

LJM_ERROR_RETURN LJM_eReadNameString(

int Handle,

const char * Name,

char * String)

Parameters

Handle [in]

A device handle. The handle is a connection ID for an active device. Generate a handle with LJM_Open or LJM_OpenS.

Name [in]

The name that specifies the Modbus string-type register to read.  Names can be found throughout the device datasheet or in the Modbus Map.

String [out]

A string that is updated to contain the result of the read. Must be allocated to size LJM_STRING_ALLOCATION_SIZE (50) or greater prior to calling this function.

Returns

LJM errorcodes or 0 for no error.

Remarks

See also LJM_eWriteNameString. This is a convenience function that uses LJM_eNames. Only for use with Modbus register(s) listed as type LJM_STRING (98).

Example

Read the device name.

C
int LJMError;
// LJM_STRING_ALLOCATION_SIZE is 50
char devName[LJM_STRING_ALLOCATION_SIZE];
// handle comes from LJM_Open()
LJMError = LJM_eReadNameString(handle, "DEVICE_NAME_DEFAULT", devName);
if (LJMError != LJME_NOERROR) {
    // Deal with error
}
printf ("%s \n", devName);
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.