ua_client_highlevel.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. /*
  2. * Copyright (C) 2014-2016 the contributors as stated in the AUTHORS file
  3. *
  4. * This file is part of open62541. open62541 is free software: you can
  5. * redistribute it and/or modify it under the terms of the GNU Lesser General
  6. * Public License, version 3 (as published by the Free Software Foundation) with
  7. * a static linking exception as stated in the LICENSE file provided with
  8. * open62541.
  9. *
  10. * open62541 is distributed in the hope that it will be useful, but WITHOUT ANY
  11. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  13. * details.
  14. */
  15. #ifndef UA_CLIENT_HIGHLEVEL_H_
  16. #define UA_CLIENT_HIGHLEVEL_H_
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. #include "ua_client.h"
  21. /**
  22. * Highlevel Client Functionality
  23. * ------------------------------
  24. * The following definitions are convenience functions making use of the
  25. * standard OPC UA services in the background.
  26. *
  27. * Read Attributes
  28. * ===============
  29. * The following functions can be used to retrieve a single node attribute. Use
  30. * the regular service to read several attributes at once. */
  31. /* Don't call this function, use the typed versions */
  32. UA_StatusCode UA_EXPORT
  33. __UA_Client_readAttribute(UA_Client *client, const UA_NodeId *nodeId, UA_AttributeId attributeId,
  34. void *out, const UA_DataType *outDataType);
  35. static UA_INLINE UA_StatusCode
  36. UA_Client_readNodeIdAttribute(UA_Client *client, const UA_NodeId nodeId, UA_NodeId *outNodeId) {
  37. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_NODEID, outNodeId, &UA_TYPES[UA_TYPES_NODEID]); }
  38. static UA_INLINE UA_StatusCode
  39. UA_Client_readNodeClassAttribute(UA_Client *client, const UA_NodeId nodeId, UA_NodeClass *outNodeClass) {
  40. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_NODECLASS, outNodeClass, &UA_TYPES[UA_TYPES_NODECLASS]); }
  41. static UA_INLINE UA_StatusCode
  42. UA_Client_readBrowseNameAttribute(UA_Client *client, const UA_NodeId nodeId, UA_QualifiedName *outBrowseName) {
  43. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_BROWSENAME, outBrowseName, &UA_TYPES[UA_TYPES_QUALIFIEDNAME]); }
  44. static UA_INLINE UA_StatusCode
  45. UA_Client_readDisplayNameAttribute(UA_Client *client, const UA_NodeId nodeId, UA_LocalizedText *outDisplayName) {
  46. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_DISPLAYNAME, outDisplayName, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]); }
  47. static UA_INLINE UA_StatusCode
  48. UA_Client_readDescriptionAttribute(UA_Client *client, const UA_NodeId nodeId, UA_LocalizedText *outDescription) {
  49. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_DESCRIPTION, outDescription, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]); }
  50. static UA_INLINE UA_StatusCode
  51. UA_Client_readWriteMaskAttribute(UA_Client *client, const UA_NodeId nodeId, UA_UInt32 *outWriteMask) {
  52. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_WRITEMASK, outWriteMask, &UA_TYPES[UA_TYPES_UINT32]); }
  53. static UA_INLINE UA_StatusCode
  54. UA_Client_readUserWriteMaskAttribute(UA_Client *client, const UA_NodeId nodeId, UA_UInt32 *outUserWriteMask) {
  55. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_USERWRITEMASK, outUserWriteMask, &UA_TYPES[UA_TYPES_UINT32]); }
  56. static UA_INLINE UA_StatusCode
  57. UA_Client_readIsAbstractAttribute(UA_Client *client, const UA_NodeId nodeId, UA_Boolean *outIsAbstract) {
  58. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_ISABSTRACT, outIsAbstract, &UA_TYPES[UA_TYPES_BOOLEAN]); }
  59. static UA_INLINE UA_StatusCode
  60. UA_Client_readSymmetricAttribute(UA_Client *client, const UA_NodeId nodeId, UA_Boolean *outSymmetric) {
  61. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_SYMMETRIC, outSymmetric, &UA_TYPES[UA_TYPES_BOOLEAN]); }
  62. static UA_INLINE UA_StatusCode
  63. UA_Client_readInverseNameAttribute(UA_Client *client, const UA_NodeId nodeId, UA_LocalizedText *outInverseName) {
  64. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_INVERSENAME, outInverseName, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]); }
  65. static UA_INLINE UA_StatusCode
  66. UA_Client_readContainsNoLoopsAttribute(UA_Client *client, const UA_NodeId nodeId, UA_Boolean *outContainsNoLoops) {
  67. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_CONTAINSNOLOOPS, outContainsNoLoops, &UA_TYPES[UA_TYPES_BOOLEAN]); }
  68. static UA_INLINE UA_StatusCode
  69. UA_Client_readEventNotifierAttribute(UA_Client *client, const UA_NodeId nodeId, UA_Byte *outEventNotifier) {
  70. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_EVENTNOTIFIER, outEventNotifier, &UA_TYPES[UA_TYPES_BYTE]); }
  71. static UA_INLINE UA_StatusCode
  72. UA_Client_readValueAttribute(UA_Client *client, const UA_NodeId nodeId, UA_Variant *outValue) {
  73. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_VALUE, outValue, &UA_TYPES[UA_TYPES_VARIANT]); }
  74. static UA_INLINE UA_StatusCode
  75. UA_Client_readDataTypeAttribute(UA_Client *client, const UA_NodeId nodeId, UA_NodeId *outDataType) {
  76. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_DATATYPE, outDataType, &UA_TYPES[UA_TYPES_NODEID]); }
  77. static UA_INLINE UA_StatusCode
  78. UA_Client_readValueRankAttribute(UA_Client *client, const UA_NodeId nodeId, UA_Int32 *outValueRank) {
  79. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_VALUERANK, outValueRank, &UA_TYPES[UA_TYPES_INT32]); }
  80. UA_StatusCode UA_EXPORT
  81. UA_Client_readArrayDimensionsAttribute(UA_Client *client, const UA_NodeId nodeId,
  82. UA_Int32 **outArrayDimensions, size_t *outArrayDimensionsSize);
  83. static UA_INLINE UA_StatusCode
  84. UA_Client_readAccessLevelAttribute(UA_Client *client, const UA_NodeId nodeId, UA_UInt32 *outAccessLevel) {
  85. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_ACCESSLEVEL, outAccessLevel, &UA_TYPES[UA_TYPES_UINT32]); }
  86. static UA_INLINE UA_StatusCode
  87. UA_Client_readUserAccessLevelAttribute(UA_Client *client, const UA_NodeId nodeId, UA_UInt32 *outUserAccessLevel) {
  88. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_USERACCESSLEVEL, outUserAccessLevel, &UA_TYPES[UA_TYPES_UINT32]); }
  89. static UA_INLINE UA_StatusCode
  90. UA_Client_readMinimumSamplingIntervalAttribute(UA_Client *client, const UA_NodeId nodeId, UA_Double *outMinimumSamplingInterval) {
  91. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_MINIMUMSAMPLINGINTERVAL, outMinimumSamplingInterval, &UA_TYPES[UA_TYPES_DOUBLE]); }
  92. static UA_INLINE UA_StatusCode
  93. UA_Client_readHistorizingAttribute(UA_Client *client, const UA_NodeId nodeId, UA_Boolean *outHistorizing) {
  94. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_HISTORIZING, outHistorizing, &UA_TYPES[UA_TYPES_BOOLEAN]); }
  95. static UA_INLINE UA_StatusCode
  96. UA_Client_readExecutableAttribute(UA_Client *client, const UA_NodeId nodeId, UA_Boolean *outExecutable) {
  97. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_EXECUTABLE, outExecutable, &UA_TYPES[UA_TYPES_BOOLEAN]); }
  98. static UA_INLINE UA_StatusCode
  99. UA_Client_readUserExecutableAttribute(UA_Client *client, const UA_NodeId nodeId, UA_Boolean *outUserExecutable) {
  100. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_USEREXECUTABLE, outUserExecutable, &UA_TYPES[UA_TYPES_BOOLEAN]); }
  101. /**
  102. * Write Attributes
  103. * ================
  104. * The following functions can be use to write a single node attribute at a
  105. * time. Use the regular write service to write several attributes at once. */
  106. /* Don't call this function, use the typed versions */
  107. UA_StatusCode UA_EXPORT
  108. __UA_Client_writeAttribute(UA_Client *client, const UA_NodeId *nodeId,
  109. UA_AttributeId attributeId, const void *in,
  110. const UA_DataType *inDataType);
  111. static UA_INLINE UA_StatusCode
  112. UA_Client_writeNodeIdAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_NodeId *newNodeId) {
  113. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_NODEID, newNodeId, &UA_TYPES[UA_TYPES_NODEID]); }
  114. static UA_INLINE UA_StatusCode
  115. UA_Client_writeNodeClassAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_NodeClass *newNodeClass) {
  116. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_NODECLASS, newNodeClass, &UA_TYPES[UA_TYPES_NODECLASS]); }
  117. static UA_INLINE UA_StatusCode
  118. UA_Client_writeBrowseNameAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_QualifiedName *newBrowseName) {
  119. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_BROWSENAME, newBrowseName, &UA_TYPES[UA_TYPES_QUALIFIEDNAME]); }
  120. static UA_INLINE UA_StatusCode
  121. UA_Client_writeDisplayNameAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_LocalizedText *newDisplayName) {
  122. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_DISPLAYNAME, newDisplayName, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]); }
  123. static UA_INLINE UA_StatusCode
  124. UA_Client_writeDescriptionAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_LocalizedText *newDescription) {
  125. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_DESCRIPTION, newDescription, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]); }
  126. static UA_INLINE UA_StatusCode
  127. UA_Client_writeWriteMaskAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_UInt32 *newWriteMask) {
  128. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_WRITEMASK, newWriteMask, &UA_TYPES[UA_TYPES_UINT32]); }
  129. static UA_INLINE UA_StatusCode
  130. UA_Client_writeUserWriteMaskAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_UInt32 *newUserWriteMask) {
  131. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_USERWRITEMASK, newUserWriteMask, &UA_TYPES[UA_TYPES_UINT32]); }
  132. static UA_INLINE UA_StatusCode
  133. UA_Client_writeIsAbstractAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_Boolean *newIsAbstract) {
  134. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_ISABSTRACT, newIsAbstract, &UA_TYPES[UA_TYPES_BOOLEAN]); }
  135. static UA_INLINE UA_StatusCode
  136. UA_Client_writeSymmetricAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_Boolean *newSymmetric) {
  137. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_SYMMETRIC, newSymmetric, &UA_TYPES[UA_TYPES_BOOLEAN]); }
  138. static UA_INLINE UA_StatusCode
  139. UA_Client_writeInverseNameAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_LocalizedText *newInverseName) {
  140. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_INVERSENAME, newInverseName, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]); }
  141. static UA_INLINE UA_StatusCode
  142. UA_Client_writeContainsNoLoopsAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_Boolean *newContainsNoLoops) {
  143. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_CONTAINSNOLOOPS, newContainsNoLoops, &UA_TYPES[UA_TYPES_BOOLEAN]); }
  144. static UA_INLINE UA_StatusCode
  145. UA_Client_writeEventNotifierAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_Byte *newEventNotifier) {
  146. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_EVENTNOTIFIER, newEventNotifier, &UA_TYPES[UA_TYPES_BYTE]); }
  147. static UA_INLINE UA_StatusCode
  148. UA_Client_writeValueAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_Variant *newValue) {
  149. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_VALUE, newValue, &UA_TYPES[UA_TYPES_VARIANT]); }
  150. static UA_INLINE UA_StatusCode
  151. UA_Client_writeDataTypeAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_NodeId *newDataType) {
  152. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_DATATYPE, newDataType, &UA_TYPES[UA_TYPES_NODEID]); }
  153. static UA_INLINE UA_StatusCode
  154. UA_Client_writeValueRankAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_Int32 *newValueRank) {
  155. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_VALUERANK, newValueRank, &UA_TYPES[UA_TYPES_INT32]); }
  156. UA_StatusCode UA_EXPORT
  157. UA_Client_writeArrayDimensionsAttribute(UA_Client *client, const UA_NodeId nodeId,
  158. const UA_Int32 *newArrayDimensions, size_t newArrayDimensionsSize);
  159. static UA_INLINE UA_StatusCode
  160. UA_Client_writeAccessLevelAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_UInt32 *newAccessLevel) {
  161. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_ACCESSLEVEL, newAccessLevel, &UA_TYPES[UA_TYPES_UINT32]); }
  162. static UA_INLINE UA_StatusCode
  163. UA_Client_writeUserAccessLevelAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_UInt32 *newUserAccessLevel) {
  164. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_USERACCESSLEVEL, newUserAccessLevel, &UA_TYPES[UA_TYPES_UINT32]); }
  165. static UA_INLINE UA_StatusCode
  166. UA_Client_writeMinimumSamplingIntervalAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_Double *newMinimumSamplingInterval) {
  167. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_MINIMUMSAMPLINGINTERVAL, newMinimumSamplingInterval, &UA_TYPES[UA_TYPES_DOUBLE]); }
  168. static UA_INLINE UA_StatusCode
  169. UA_Client_writeHistorizingAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_Boolean *newHistorizing) {
  170. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_HISTORIZING, newHistorizing, &UA_TYPES[UA_TYPES_BOOLEAN]); }
  171. static UA_INLINE UA_StatusCode
  172. UA_Client_writeExecutableAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_Boolean *newExecutable) {
  173. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_EXECUTABLE, newExecutable, &UA_TYPES[UA_TYPES_BOOLEAN]); }
  174. static UA_INLINE UA_StatusCode
  175. UA_Client_writeUserExecutableAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_Boolean *newUserExecutable) {
  176. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_USEREXECUTABLE, newUserExecutable, &UA_TYPES[UA_TYPES_BOOLEAN]); }
  177. /**
  178. * Method Calling
  179. * ============== */
  180. UA_StatusCode UA_EXPORT
  181. UA_Client_call(UA_Client *client, const UA_NodeId objectId, const UA_NodeId methodId,
  182. size_t inputSize, const UA_Variant *input, size_t *outputSize, UA_Variant **output);
  183. /**
  184. * Node Management
  185. * =============== */
  186. UA_StatusCode UA_EXPORT
  187. UA_Client_addReference(UA_Client *client, const UA_NodeId sourceNodeId, const UA_NodeId referenceTypeId,
  188. UA_Boolean isForward, const UA_String targetServerUri,
  189. const UA_ExpandedNodeId targetNodeId, UA_NodeClass targetNodeClass);
  190. UA_StatusCode UA_EXPORT
  191. UA_Client_deleteReference(UA_Client *client, const UA_NodeId sourceNodeId, const UA_NodeId referenceTypeId,
  192. UA_Boolean isForward, const UA_ExpandedNodeId targetNodeId,
  193. UA_Boolean deleteBidirectional);
  194. UA_StatusCode UA_EXPORT
  195. UA_Client_deleteNode(UA_Client *client, const UA_NodeId nodeId, UA_Boolean deleteTargetReferences);
  196. /* Don't call this function, use the typed versions */
  197. UA_StatusCode UA_EXPORT
  198. __UA_Client_addNode(UA_Client *client, const UA_NodeClass nodeClass,
  199. const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId,
  200. const UA_NodeId referenceTypeId, const UA_QualifiedName browseName,
  201. const UA_NodeId typeDefinition, const UA_NodeAttributes *attr,
  202. const UA_DataType *attributeType, UA_NodeId *outNewNodeId);
  203. static UA_INLINE UA_StatusCode
  204. UA_Client_addVariableNode(UA_Client *client, const UA_NodeId requestedNewNodeId,
  205. const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
  206. const UA_QualifiedName browseName, const UA_NodeId typeDefinition,
  207. const UA_VariableAttributes attr, UA_NodeId *outNewNodeId) {
  208. return __UA_Client_addNode(client, UA_NODECLASS_VARIABLE, requestedNewNodeId,
  209. parentNodeId, referenceTypeId, browseName, typeDefinition,
  210. (const UA_NodeAttributes*)&attr, &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES],
  211. outNewNodeId); }
  212. static UA_INLINE UA_StatusCode
  213. UA_Client_addVariableTypeNode(UA_Client *client, const UA_NodeId requestedNewNodeId,
  214. const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
  215. const UA_QualifiedName browseName, const UA_VariableTypeAttributes attr,
  216. UA_NodeId *outNewNodeId) {
  217. return __UA_Client_addNode(client, UA_NODECLASS_VARIABLETYPE, requestedNewNodeId,
  218. parentNodeId, referenceTypeId, browseName, UA_NODEID_NULL,
  219. (const UA_NodeAttributes*)&attr, &UA_TYPES[UA_TYPES_VARIABLETYPEATTRIBUTES],
  220. outNewNodeId); }
  221. static UA_INLINE UA_StatusCode
  222. UA_Client_addObjectNode(UA_Client *client, const UA_NodeId requestedNewNodeId,
  223. const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
  224. const UA_QualifiedName browseName, const UA_NodeId typeDefinition,
  225. const UA_ObjectAttributes attr, UA_NodeId *outNewNodeId) {
  226. return __UA_Client_addNode(client, UA_NODECLASS_OBJECT, requestedNewNodeId,
  227. parentNodeId, referenceTypeId, browseName, typeDefinition,
  228. (const UA_NodeAttributes*)&attr, &UA_TYPES[UA_TYPES_OBJECTATTRIBUTES],
  229. outNewNodeId); }
  230. static UA_INLINE UA_StatusCode
  231. UA_Client_addObjectTypeNode(UA_Client *client, const UA_NodeId requestedNewNodeId,
  232. const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
  233. const UA_QualifiedName browseName, const UA_ObjectTypeAttributes attr,
  234. UA_NodeId *outNewNodeId) {
  235. return __UA_Client_addNode(client, UA_NODECLASS_OBJECTTYPE, requestedNewNodeId,
  236. parentNodeId, referenceTypeId, browseName, UA_NODEID_NULL,
  237. (const UA_NodeAttributes*)&attr, &UA_TYPES[UA_TYPES_OBJECTTYPEATTRIBUTES],
  238. outNewNodeId); }
  239. static UA_INLINE UA_StatusCode
  240. UA_Client_addViewNode(UA_Client *client, const UA_NodeId requestedNewNodeId,
  241. const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
  242. const UA_QualifiedName browseName, const UA_ViewAttributes attr,
  243. UA_NodeId *outNewNodeId) {
  244. return __UA_Client_addNode(client, UA_NODECLASS_VIEW, requestedNewNodeId,
  245. parentNodeId, referenceTypeId, browseName, UA_NODEID_NULL,
  246. (const UA_NodeAttributes*)&attr, &UA_TYPES[UA_TYPES_VIEWATTRIBUTES],
  247. outNewNodeId); }
  248. static UA_INLINE UA_StatusCode
  249. UA_Client_addReferenceTypeNode(UA_Client *client, const UA_NodeId requestedNewNodeId,
  250. const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
  251. const UA_QualifiedName browseName, const UA_ReferenceTypeAttributes attr,
  252. UA_NodeId *outNewNodeId) {
  253. return __UA_Client_addNode(client, UA_NODECLASS_REFERENCETYPE, requestedNewNodeId,
  254. parentNodeId, referenceTypeId, browseName, UA_NODEID_NULL,
  255. (const UA_NodeAttributes*)&attr, &UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES],
  256. outNewNodeId); }
  257. static UA_INLINE UA_StatusCode
  258. UA_Client_addDataTypeNode(UA_Client *client, const UA_NodeId requestedNewNodeId,
  259. const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
  260. const UA_QualifiedName browseName, const UA_DataTypeAttributes attr,
  261. UA_NodeId *outNewNodeId) {
  262. return __UA_Client_addNode(client, UA_NODECLASS_DATATYPE, requestedNewNodeId,
  263. parentNodeId, referenceTypeId, browseName, UA_NODEID_NULL,
  264. (const UA_NodeAttributes*)&attr, &UA_TYPES[UA_TYPES_DATATYPEATTRIBUTES],
  265. outNewNodeId); }
  266. static UA_INLINE UA_StatusCode
  267. UA_Client_addMethodNode(UA_Client *client, const UA_NodeId requestedNewNodeId,
  268. const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
  269. const UA_QualifiedName browseName, const UA_MethodAttributes attr,
  270. UA_NodeId *outNewNodeId) {
  271. return __UA_Client_addNode(client, UA_NODECLASS_METHOD, requestedNewNodeId,
  272. parentNodeId, referenceTypeId, browseName, UA_NODEID_NULL,
  273. (const UA_NodeAttributes*)&attr, &UA_TYPES[UA_TYPES_METHODATTRIBUTES],
  274. outNewNodeId); }
  275. /**
  276. * Subscriptions Handling
  277. * ====================== */
  278. #ifdef UA_ENABLE_SUBSCRIPTIONS
  279. typedef struct {
  280. UA_Double requestedPublishingInterval;
  281. UA_UInt32 requestedLifetimeCount;
  282. UA_UInt32 requestedMaxKeepAliveCount;
  283. UA_UInt32 maxNotificationsPerPublish;
  284. UA_Boolean publishingEnabled;
  285. UA_Byte priority;
  286. } UA_SubscriptionSettings;
  287. extern const UA_EXPORT UA_SubscriptionSettings UA_SubscriptionSettings_standard;
  288. UA_StatusCode UA_EXPORT
  289. UA_Client_Subscriptions_new(UA_Client *client, UA_SubscriptionSettings settings,
  290. UA_UInt32 *newSubscriptionId);
  291. UA_StatusCode UA_EXPORT
  292. UA_Client_Subscriptions_remove(UA_Client *client, UA_UInt32 subscriptionId);
  293. UA_StatusCode UA_EXPORT UA_Client_Subscriptions_manuallySendPublishRequest(UA_Client *client);
  294. typedef void (*UA_MonitoredItemHandlingFunction) (UA_UInt32 handle, UA_DataValue *value, void *context);
  295. UA_StatusCode UA_EXPORT
  296. UA_Client_Subscriptions_addMonitoredItem(UA_Client *client, UA_UInt32 subscriptionId,
  297. UA_NodeId nodeId, UA_UInt32 attributeID,
  298. UA_MonitoredItemHandlingFunction handlingFunction,
  299. void *handlingContext, UA_UInt32 *newMonitoredItemId);
  300. UA_StatusCode UA_EXPORT
  301. UA_Client_Subscriptions_removeMonitoredItem(UA_Client *client, UA_UInt32 subscriptionId,
  302. UA_UInt32 monitoredItemId);
  303. #endif
  304. /**
  305. * Misc Highlevel Functionality
  306. * ============================ */
  307. /* Get the namespace-index of a namespace-URI
  308. *
  309. * @param client The UA_Client struct for this connection
  310. * @param namespaceUri The interested namespace URI
  311. * @param namespaceIndex The namespace index of the URI. The value is unchanged
  312. * in case of an error
  313. * @return Indicates whether the operation succeeded or returns an error code */
  314. UA_StatusCode UA_EXPORT
  315. UA_Client_NamespaceGetIndex(UA_Client *client, UA_String *namespaceUri, UA_UInt16 *namespaceIndex);
  316. #ifndef HAVE_NODEITER_CALLBACK
  317. #define HAVE_NODEITER_CALLBACK
  318. /* Iterate over all nodes referenced by parentNodeId by calling the callback
  319. function for each child node */
  320. typedef UA_StatusCode (*UA_NodeIteratorCallback)(UA_NodeId childId, UA_Boolean isInverse,
  321. UA_NodeId referenceTypeId, void *handle);
  322. #endif
  323. UA_StatusCode UA_EXPORT
  324. UA_Client_forEachChildNodeCall(UA_Client *client, UA_NodeId parentNodeId,
  325. UA_NodeIteratorCallback callback, void *handle) ;
  326. #ifdef __cplusplus
  327. } // extern "C"
  328. #endif
  329. #endif /* UA_CLIENT_HIGHLEVEL_H_ */