Write Access¶
The following functions allow to modify items in the tree:
nxLibSetNull¶
-
void nxLibSetNull(int32_t *result, const char *itemPath)¶
Sets an item to the value Null.
- Parameters
result – A pointer to a variable for the return code of the operation. The following function specific return codes can occur:
NxLibInvalidParameters
- One, multiple, or a combination of parameters are invalid.NxLibItemProtected
- The item at the given path is protected.NxLibItemPathInvalid
- The given path contains forbidden characters.NxLibItemTypeNotCompatible
- The item type you tried to read is of another type than you specified or the item you tried to write cannot be overwritten with the type you specified because its structure is locked.
itemPath – The path of the item or subtree to erase.
nxLibSetJson¶
-
void nxLibSetJson(int32_t *result, const char *itemPath, const char *value, int32_t onlyWriteableNodes)¶
Sets an item to the given JSON value. The value might itself be an entire tree structure which will be placed under the specified node.
- Parameters
result – A pointer to a variable for the return code of the operation. The following function specific return codes can occur:
NxLibInvalidParameters
- One, multiple, or a combination of parameters are invalid.NxLibItemProtected
- The item at the given path is protected.NxLibItemPathInvalid
- The given path contains forbidden characters.NxLibItemTypeNotCompatible
- The item type you tried to read is of another type than you specified or the item you tried to write cannot be overwritten with the type you specified because its structure is locked.
itemPath – The path of the item to set.
value – The JSON string representing the value or subtree to write.
onlyWriteableNodes – Specifies whether the function should try to write each single node into the existing tree structure instead of replacing the entire subtree.
When specifying
true
here, the function will not complain if a sub node is not existing or if it is protected. All matching nodes will be modified. If not a single matching node is found, the function returnsNxLibItemTypeNotCompatible
. In this case you probably tried to apply the JSON value to the wrong path. This mode can be used to restore the state of the library or the Parameters node of a camera if the tree state has previously been captured vianxLibGetJson()
.When specifying
false
here, the function only succeeds if the structure of the given JSON value matches the structure of the entire subtree such that no sub node with protection “Locked” would have its type or value modified and no sub node with protection “StructureLocked” would have its type modified.
nxLibSetInt¶
-
void nxLibSetInt(int32_t *result, const char *itemPath, int32_t value)¶
Sets an item to the specified integer value. The resulting item will be of type Number.
- Parameters
result – A pointer to a variable for the return code of the operation. The following function specific return codes can occur:
NxLibInvalidParameters
- One, multiple, or a combination of parameters are invalid.NxLibItemProtected
- The item at the given path is protected.NxLibItemPathInvalid
- The given path contains forbidden characters.NxLibItemTypeNotCompatible
- The item type you tried to read is of another type than you specified or the item you tried to write cannot be overwritten with the type you specified because its structure is locked.
itemPath – The path of the item to set. When specifying a subtree, the entire subtree will be replaced by the specified value.
value – The value to set.
nxLibSetDouble¶
-
void nxLibSetDouble(int32_t *result, const char *itemPath, double value)¶
Sets an item to the specified floating point value. The resulting item will be of type Number.
- Parameters
result – A pointer to a variable for the return code of the operation. The following function specific return codes can occur:
NxLibInvalidParameters
- One, multiple, or a combination of parameters are invalid.NxLibItemProtected
- The item at the given path is protected.NxLibItemPathInvalid
- The given path contains forbidden characters.NxLibItemTypeNotCompatible
- The item type you tried to read is of another type than you specified or the item you tried to write cannot be overwritten with the type you specified because its structure is locked.
itemPath – The path of the item to set. When specifying a subtree, the entire subtree will be replaced by the specified value.
value – The value to set.
nxLibSetBool¶
-
void nxLibSetBool(int32_t *result, const char *itemPath, int32_t value)¶
Sets an item to the specified boolean value. The resulting item will be of type Boolean.
- Parameters
result – A pointer to a variable for the return code of the operation. The following function specific return codes can occur:
NxLibInvalidParameters
- One, multiple, or a combination of parameters are invalid.NxLibItemProtected
- The item at the given path is protected.NxLibItemPathInvalid
- The given path contains forbidden characters.NxLibItemTypeNotCompatible
- The item type you tried to read is of another type than you specified or the item you tried to write cannot be overwritten with the type you specified because its structure is locked.
itemPath – The path of the item to set. When specifying a subtree, the entire subtree will be replaced by the specified value.
value – The value to set.
nxLibSetString¶
-
void nxLibSetString(int32_t *result, const char *itemPath, const char *value)¶
Sets an item to the specified string. The resulting item will be of type String.
- Parameters
result – A pointer to a variable for the return code of the operation. The following function specific return codes can occur:
NxLibInvalidParameters
- One, multiple, or a combination of parameters are invalid.NxLibItemProtected
- The item at the given path is protected.NxLibItemPathInvalid
- The given path contains forbidden characters.NxLibItemTypeNotCompatible
- The item type you tried to read is of another type than you specified or the item you tried to write cannot be overwritten with the type you specified because its structure is locked.
itemPath – The path of the item to set. When specifying a subtree, the entire subtree will be replaced by the specified value.
value – The value to set.
nxLibMakeUniqueItem¶
-
const char *nxLibMakeUniqueItem(int32_t *result, const char *itemPath, const char *itemName)¶
Creates a new item with a unique name.
- Parameters
result – A pointer to a variable for the return code of the operation. The following function specific return codes can occur:
NxLibInvalidParameters
- One, multiple, or a combination of parameters are invalid.NxLibItemProtected
- The item at the given path is protected.NxLibItemPathInvalid
- The given path contains forbidden characters.NxLibItemMaximumUniqueCountReached
- The maximum number of unique sub items has been reached.
itemPath – The parent path of the new item to create.
itemName – The base name of the item. If the base name does already exist, the base name will be append with a number to make the item unique again.
- Returns
The name of the generated item. Please refer to the string type description for information about usage restrictions applying to the returned pointer.
nxLibErase¶
-
void nxLibErase(int32_t *result, const char *itemPath)¶
Erase an item or subtree
- Parameters
result – A pointer to a variable for the return code of the operation. The following function specific return codes can occur:
NxLibInvalidParameters
- One, multiple, or a combination of parameters are invalid.NxLibItemProtected
- The item at the given path is protected.NxLibItemInexistent
- The item at the given path does not exist.NxLibItemPathInvalid
- The given path contains forbidden characters.
itemPath – The path of the item or subtree to erase.
nxLibSetBinary¶
-
void nxLibSetBinary(int32_t *result, const char *itemPath, void const *buffer, int32_t bufferSize)¶
Sets data of a Binary item and updates the timestamp of the node to the current UTC time.
The data format must be identical to the current format of the binary node. The current format can be queried using
nxLibGetBinaryInfo()
.- Parameters
result – A pointer to a variable for the return code of the operation. The following function specific return codes can occur:
NxLibInvalidParameters
- One, multiple, or a combination of parameters are invalid.NxLibItemProtected
- The item at the given path is protected.NxLibItemPathInvalid
- The given path contains forbidden characters.NxLibItemTypeNotCompatible
- The item type you tried to read is of another type than you specified or the item you tried to write cannot be overwritten with the type you specified because its structure is locked.NxLibInvalidBufferSize
- The buffer size is invalid, e.g. it does not match the current node data size.
itemPath – The path of the item to set.
buffer – Pointer to the buffer
bufferSize – Actual size of the buffer.
nxLibSetBinaryFormatted¶
-
void nxLibSetBinaryFormatted(int32_t *result, const char *itemPath, void const *buffer, int32_t width, int32_t height, int32_t channelCount, int32_t bytesPerElement, int32_t isFloat)¶
Sets data of a Binary item and updates the timestamp of the node to the current UTC time.
The current data format of the binary node can be changed with this function.
- Parameters
result – A pointer to a variable for the return code of the operation. The following function specific return codes can occur:
NxLibInvalidParameters
- One, multiple, or a combination of parameters are invalid.NxLibItemProtected
- The item at the given path is protected.NxLibItemPathInvalid
- The given path contains forbidden characters.NxLibItemTypeNotCompatible
- The item type you tried to read is of another type than you specified or the item you tried to write cannot be overwritten with the type you specified because its structure is locked.
itemPath – The path of the item to set. When specifying a subtree, the entire subtree will be replaced by the specified value.
buffer – Pointer to the buffer
width – The width of the array (consecutive elements in memory).
height – The height of the array (number of rows of
width
*channelCount
elements)channelCount – Number of channels for a single item.
bytesPerElement – Size in bytes of a single channel value of an item.
isFloat – Specifies whether the element data type is a floating point type.