Item Value Retrieval

nxLibGetJson

const char *nxLibGetJson(int32_t *result, const char *itemPath, int32_t prettyPrint, int32_t numberPrecision, int32_t scientificNumberFormat)

Retrieves an item value or an entire subtree in JSON representation.

Parameters
  • result – A pointer to a variable for the error code of the operation

  • itemPath – The path of the item to access

  • prettyPrint – Specify true here to format the resulting string with line breaks and tabs.

  • numberPrecision – The floating point precision of the returned numbers.

  • scientificNumberFormat – Specifies whether to use scientific notation for all numbers.

Returns

A JSON string representing the item value or subtree. Please refer to the string type description for information about usage restrictions applying to the returned pointer.

nxLibGetJsonMeta

const char *nxLibGetJsonMeta(int32_t *result, const char *itemPath, int32_t numLevels, int32_t prettyPrint, int32_t numberPrecision, int32_t scientificNumberFormat)

Retrieves an item value or an entire subtree in JSON representation including item metadata (protection, extended type, internal flags). This function is only intended to be used by NxTreeEdit to visualize the entire tree state.

Parameters
  • result – A pointer to a variable for the error code of the operation

  • itemPath – The path of the item to access.

  • numLevels – The depth of the returned subtree. Nodes in lower levels will be omitted.

  • prettyPrint – Specify true here to format the resulting string with line breaks and tabs.

  • numberPrecision – The floating point precision of the returned numbers.

  • scientificNumberFormat – Specifies whether to use scientific notation for all numbers.

Returns

A JSON string representing the item value or subtree including each item’s metadata. Please refer to the string type description for information about usage restrictions applying to the returned pointer.

nxLibGetInt

int32_t nxLibGetInt(int32_t *result, const char *itemPath)

Retrieves the integer value of a Number item.

Parameters
  • result – A pointer to a variable for the error code of the operation

  • itemPath – The path of the item to access.

Returns

The integer value of the item. If the item’s number value was a floating point number, the rounded value will be returned.

nxLibGetDouble

double nxLibGetDouble(int32_t *result, const char *itemPath)

Retrieves the floating point value of a Number item.

Parameters
  • result – A pointer to a variable for the error code of the operation.

  • itemPath – The path of the item to access.

Returns

The floating point value of the item.

nxLibGetBool

int32_t nxLibGetBool(int32_t *result, const char *itemPath)

Retrieves the value of a Boolean item.

Parameters
  • result – A pointer to a variable for the error code of the operation.

  • itemPath – The path of the item to access.

Returns

The boolean value of the item.

nxLibGetString

const char *nxLibGetString(int32_t *result, const char *itemPath)

Retrieves the value of a String item.

Parameters
  • result – A pointer to a variable for the error code of the operation.

  • itemPath – The path of the item to access.

Returns

The string value of the item. Please refer to the string type description for information about usage restrictions applying to the returned pointer.

nxLibGetBinary

void nxLibGetBinary(int32_t *result, const char *itemPath, void *destinationBuffer, int32_t bufferSize, int32_t *bytesCopied, double *timestamp)

Retrieves data of a Binary item.

Parameters
  • result – A pointer to a variable for the error code of the operation.

  • itemPath – The path of the item to access.

  • destinationBuffer – A pointer to the memory, where the item content should be copied.

  • bufferSize – The size of the destination buffer in bytes.

  • bytesCopied – A pointer to an integer. The variable will be filled with the actual number of bytes written to the buffer

  • timestamp – The current timestamp of the binary blob queried.