Home |
Function RTUEndpointPacketSize Function RTUGetString |
Function RTUGetStringRTUGetString returns an ASCII string read from a string descriptor: int RTUGetString(RTUDeviceHandle Device, WORD LangId, WORD StringIndex, char * Buffer, int BufferSize); ParametersDeviceDevice handle passed to an attachment/detachment callback. LangIdWin32 language identifier or 0 to use the first language supported by the device. Some devices can supply strings in several different languages. Typical values to use are 1033 for English, 1031 for German, or 1036 for French. For most applications, 0 is recommended. StringIndexString index read from some other descriptor. This value must be greater than zero. BufferPointer to a buffer to receive the NUL terminated string. BufferSizeSize in bytes of the buffer pointed to by Buffer. The maximum size a string read from a string descriptor is 127 bytes. return valueIf the function succeeds, it returns RTU_SUCCESS. If the supplied buffer is too small, the required buffer size is returned. If communication with the device failed or no string descriptor for the desired language is available, a negative error code is returned. The string data supplied by a device is in Unicode format. Function RTUGetString converts the string from Unicode to ASCII by truncating 16-bit Unicode characters to 8-bit, effectively converting to code page 1252. The result for character values above 255 is undefined.
|