ua_client_highlevel.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  4. *
  5. * Copyright 2015-2018 (c) Fraunhofer IOSB (Author: Julius Pfrommer)
  6. * Copyright 2015 (c) Oleksiy Vasylyev
  7. * Copyright 2017 (c) Florian Palm
  8. * Copyright 2016 (c) Chris Iatrou
  9. * Copyright 2017 (c) Stefan Profanter, fortiss GmbH
  10. * Copyright 2017 (c) Frank Meerkötter
  11. * Copyright 2018 (c) Fabian Arndt
  12. * Copyright 2018 (c) Peter Rustler, basyskom GmbH
  13. */
  14. #ifndef UA_CLIENT_HIGHLEVEL_H_
  15. #define UA_CLIENT_HIGHLEVEL_H_
  16. #include "ua_client.h"
  17. _UA_BEGIN_DECLS
  18. /**
  19. * .. _client-highlevel:
  20. *
  21. * Highlevel Client Functionality
  22. * ------------------------------
  23. *
  24. * The following definitions are convenience functions making use of the
  25. * standard OPC UA services in the background. This is a less flexible way of
  26. * handling the stack, because at many places sensible defaults are presumed; at
  27. * the same time using these functions is the easiest way of implementing an OPC
  28. * UA application, as you will not have to consider all the details that go into
  29. * the OPC UA services. If more flexibility is needed, you can always achieve
  30. * the same functionality using the raw :ref:`OPC UA services
  31. * <client-services>`.
  32. *
  33. * Read Attributes
  34. * ^^^^^^^^^^^^^^^
  35. * The following functions can be used to retrieve a single node attribute. Use
  36. * the regular service to read several attributes at once. */
  37. /* Don't call this function, use the typed versions */
  38. UA_StatusCode UA_EXPORT
  39. __UA_Client_readAttribute(UA_Client *client, const UA_NodeId *nodeId,
  40. UA_AttributeId attributeId, void *out,
  41. const UA_DataType *outDataType);
  42. static UA_INLINE UA_StatusCode
  43. UA_Client_readNodeIdAttribute(UA_Client *client, const UA_NodeId nodeId,
  44. UA_NodeId *outNodeId) {
  45. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_NODEID,
  46. outNodeId, &UA_TYPES[UA_TYPES_NODEID]);
  47. }
  48. static UA_INLINE UA_StatusCode
  49. UA_Client_readNodeClassAttribute(UA_Client *client, const UA_NodeId nodeId,
  50. UA_NodeClass *outNodeClass) {
  51. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_NODECLASS,
  52. outNodeClass, &UA_TYPES[UA_TYPES_NODECLASS]);
  53. }
  54. static UA_INLINE UA_StatusCode
  55. UA_Client_readBrowseNameAttribute(UA_Client *client, const UA_NodeId nodeId,
  56. UA_QualifiedName *outBrowseName) {
  57. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_BROWSENAME,
  58. outBrowseName,
  59. &UA_TYPES[UA_TYPES_QUALIFIEDNAME]);
  60. }
  61. static UA_INLINE UA_StatusCode
  62. UA_Client_readDisplayNameAttribute(UA_Client *client, const UA_NodeId nodeId,
  63. UA_LocalizedText *outDisplayName) {
  64. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_DISPLAYNAME,
  65. outDisplayName,
  66. &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
  67. }
  68. static UA_INLINE UA_StatusCode
  69. UA_Client_readDescriptionAttribute(UA_Client *client, const UA_NodeId nodeId,
  70. UA_LocalizedText *outDescription) {
  71. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_DESCRIPTION,
  72. outDescription,
  73. &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
  74. }
  75. static UA_INLINE UA_StatusCode
  76. UA_Client_readWriteMaskAttribute(UA_Client *client, const UA_NodeId nodeId,
  77. UA_UInt32 *outWriteMask) {
  78. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_WRITEMASK,
  79. outWriteMask, &UA_TYPES[UA_TYPES_UINT32]);
  80. }
  81. static UA_INLINE UA_StatusCode
  82. UA_Client_readUserWriteMaskAttribute(UA_Client *client, const UA_NodeId nodeId,
  83. UA_UInt32 *outUserWriteMask) {
  84. return __UA_Client_readAttribute(client, &nodeId,
  85. UA_ATTRIBUTEID_USERWRITEMASK,
  86. outUserWriteMask,
  87. &UA_TYPES[UA_TYPES_UINT32]);
  88. }
  89. static UA_INLINE UA_StatusCode
  90. UA_Client_readIsAbstractAttribute(UA_Client *client, const UA_NodeId nodeId,
  91. UA_Boolean *outIsAbstract) {
  92. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_ISABSTRACT,
  93. outIsAbstract, &UA_TYPES[UA_TYPES_BOOLEAN]);
  94. }
  95. static UA_INLINE UA_StatusCode
  96. UA_Client_readSymmetricAttribute(UA_Client *client, const UA_NodeId nodeId,
  97. UA_Boolean *outSymmetric) {
  98. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_SYMMETRIC,
  99. outSymmetric, &UA_TYPES[UA_TYPES_BOOLEAN]);
  100. }
  101. static UA_INLINE UA_StatusCode
  102. UA_Client_readInverseNameAttribute(UA_Client *client, const UA_NodeId nodeId,
  103. UA_LocalizedText *outInverseName) {
  104. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_INVERSENAME,
  105. outInverseName,
  106. &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
  107. }
  108. static UA_INLINE UA_StatusCode
  109. UA_Client_readContainsNoLoopsAttribute(UA_Client *client, const UA_NodeId nodeId,
  110. UA_Boolean *outContainsNoLoops) {
  111. return __UA_Client_readAttribute(client, &nodeId,
  112. UA_ATTRIBUTEID_CONTAINSNOLOOPS,
  113. outContainsNoLoops,
  114. &UA_TYPES[UA_TYPES_BOOLEAN]);
  115. }
  116. static UA_INLINE UA_StatusCode
  117. UA_Client_readEventNotifierAttribute(UA_Client *client, const UA_NodeId nodeId,
  118. UA_Byte *outEventNotifier) {
  119. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_EVENTNOTIFIER,
  120. outEventNotifier, &UA_TYPES[UA_TYPES_BYTE]);
  121. }
  122. static UA_INLINE UA_StatusCode
  123. UA_Client_readValueAttribute(UA_Client *client, const UA_NodeId nodeId,
  124. UA_Variant *outValue) {
  125. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_VALUE,
  126. outValue, &UA_TYPES[UA_TYPES_VARIANT]);
  127. }
  128. static UA_INLINE UA_StatusCode
  129. UA_Client_readDataTypeAttribute(UA_Client *client, const UA_NodeId nodeId,
  130. UA_NodeId *outDataType) {
  131. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_DATATYPE,
  132. outDataType, &UA_TYPES[UA_TYPES_NODEID]);
  133. }
  134. static UA_INLINE UA_StatusCode
  135. UA_Client_readValueRankAttribute(UA_Client *client, const UA_NodeId nodeId,
  136. UA_Int32 *outValueRank) {
  137. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_VALUERANK,
  138. outValueRank, &UA_TYPES[UA_TYPES_INT32]);
  139. }
  140. UA_StatusCode UA_EXPORT
  141. UA_Client_readArrayDimensionsAttribute(UA_Client *client, const UA_NodeId nodeId,
  142. size_t *outArrayDimensionsSize,
  143. UA_UInt32 **outArrayDimensions);
  144. static UA_INLINE UA_StatusCode
  145. UA_Client_readAccessLevelAttribute(UA_Client *client, const UA_NodeId nodeId,
  146. UA_Byte *outAccessLevel) {
  147. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_ACCESSLEVEL,
  148. outAccessLevel, &UA_TYPES[UA_TYPES_BYTE]);
  149. }
  150. static UA_INLINE UA_StatusCode
  151. UA_Client_readUserAccessLevelAttribute(UA_Client *client, const UA_NodeId nodeId,
  152. UA_Byte *outUserAccessLevel) {
  153. return __UA_Client_readAttribute(client, &nodeId,
  154. UA_ATTRIBUTEID_USERACCESSLEVEL,
  155. outUserAccessLevel,
  156. &UA_TYPES[UA_TYPES_BYTE]);
  157. }
  158. static UA_INLINE UA_StatusCode
  159. UA_Client_readMinimumSamplingIntervalAttribute(UA_Client *client,
  160. const UA_NodeId nodeId,
  161. UA_Double *outMinSamplingInterval) {
  162. return __UA_Client_readAttribute(client, &nodeId,
  163. UA_ATTRIBUTEID_MINIMUMSAMPLINGINTERVAL,
  164. outMinSamplingInterval,
  165. &UA_TYPES[UA_TYPES_DOUBLE]);
  166. }
  167. static UA_INLINE UA_StatusCode
  168. UA_Client_readHistorizingAttribute(UA_Client *client, const UA_NodeId nodeId,
  169. UA_Boolean *outHistorizing) {
  170. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_HISTORIZING,
  171. outHistorizing, &UA_TYPES[UA_TYPES_BOOLEAN]);
  172. }
  173. static UA_INLINE UA_StatusCode
  174. UA_Client_readExecutableAttribute(UA_Client *client, const UA_NodeId nodeId,
  175. UA_Boolean *outExecutable) {
  176. return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_EXECUTABLE,
  177. outExecutable, &UA_TYPES[UA_TYPES_BOOLEAN]);
  178. }
  179. static UA_INLINE UA_StatusCode
  180. UA_Client_readUserExecutableAttribute(UA_Client *client, const UA_NodeId nodeId,
  181. UA_Boolean *outUserExecutable) {
  182. return __UA_Client_readAttribute(client, &nodeId,
  183. UA_ATTRIBUTEID_USEREXECUTABLE,
  184. outUserExecutable,
  185. &UA_TYPES[UA_TYPES_BOOLEAN]);
  186. }
  187. /**
  188. * Historical Access
  189. * ^^^^^^^^^^^^^^^^^
  190. * The following functions can be used to read a single node historically.
  191. * Use the regular service to read several nodes at once.
  192. */
  193. #ifdef UA_ENABLE_HISTORIZING
  194. typedef UA_Boolean
  195. (*UA_HistoricalIteratorCallback)(UA_Client *client,
  196. const UA_NodeId *nodeId,
  197. UA_Boolean moreDataAvailable,
  198. const UA_ExtensionObject *data, void *callbackContext);
  199. #ifdef UA_ENABLE_EXPERIMENTAL_HISTORIZING
  200. UA_StatusCode UA_EXPORT
  201. UA_Client_HistoryRead_events(UA_Client *client, const UA_NodeId *nodeId,
  202. const UA_HistoricalIteratorCallback callback,
  203. UA_DateTime startTime, UA_DateTime endTime,
  204. UA_String indexRange, const UA_EventFilter filter, UA_UInt32 numValuesPerNode,
  205. UA_TimestampsToReturn timestampsToReturn, void *callbackContext);
  206. #endif // UA_ENABLE_EXPERIMENTAL_HISTORIZING
  207. UA_StatusCode UA_EXPORT
  208. UA_Client_HistoryRead_raw(UA_Client *client, const UA_NodeId *nodeId,
  209. const UA_HistoricalIteratorCallback callback,
  210. UA_DateTime startTime, UA_DateTime endTime,
  211. UA_String indexRange, UA_Boolean returnBounds, UA_UInt32 numValuesPerNode,
  212. UA_TimestampsToReturn timestampsToReturn, void *callbackContext);
  213. #ifdef UA_ENABLE_EXPERIMENTAL_HISTORIZING
  214. UA_StatusCode UA_EXPORT
  215. UA_Client_HistoryRead_modified(UA_Client *client, const UA_NodeId *nodeId,
  216. const UA_HistoricalIteratorCallback callback,
  217. UA_DateTime startTime, UA_DateTime endTime,
  218. UA_String indexRange, UA_Boolean returnBounds, UA_UInt32 numValuesPerNode,
  219. UA_TimestampsToReturn timestampsToReturn, void *callbackContext);
  220. #endif // UA_ENABLE_EXPERIMENTAL_HISTORIZING
  221. #endif // UA_ENABLE_HISTORIZING
  222. /**
  223. * Write Attributes
  224. * ^^^^^^^^^^^^^^^^
  225. *
  226. * The following functions can be use to write a single node attribute at a
  227. * time. Use the regular write service to write several attributes at once. */
  228. /* Don't call this function, use the typed versions */
  229. UA_StatusCode UA_EXPORT
  230. __UA_Client_writeAttribute(UA_Client *client, const UA_NodeId *nodeId,
  231. UA_AttributeId attributeId, const void *in,
  232. const UA_DataType *inDataType);
  233. static UA_INLINE UA_StatusCode
  234. UA_Client_writeNodeIdAttribute(UA_Client *client, const UA_NodeId nodeId,
  235. const UA_NodeId *newNodeId) {
  236. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_NODEID,
  237. newNodeId, &UA_TYPES[UA_TYPES_NODEID]);
  238. }
  239. static UA_INLINE UA_StatusCode
  240. UA_Client_writeNodeClassAttribute(UA_Client *client, const UA_NodeId nodeId,
  241. const UA_NodeClass *newNodeClass) {
  242. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_NODECLASS,
  243. newNodeClass, &UA_TYPES[UA_TYPES_NODECLASS]);
  244. }
  245. static UA_INLINE UA_StatusCode
  246. UA_Client_writeBrowseNameAttribute(UA_Client *client, const UA_NodeId nodeId,
  247. const UA_QualifiedName *newBrowseName) {
  248. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_BROWSENAME,
  249. newBrowseName,
  250. &UA_TYPES[UA_TYPES_QUALIFIEDNAME]);
  251. }
  252. static UA_INLINE UA_StatusCode
  253. UA_Client_writeDisplayNameAttribute(UA_Client *client, const UA_NodeId nodeId,
  254. const UA_LocalizedText *newDisplayName) {
  255. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_DISPLAYNAME,
  256. newDisplayName,
  257. &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
  258. }
  259. static UA_INLINE UA_StatusCode
  260. UA_Client_writeDescriptionAttribute(UA_Client *client, const UA_NodeId nodeId,
  261. const UA_LocalizedText *newDescription) {
  262. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_DESCRIPTION,
  263. newDescription,
  264. &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
  265. }
  266. static UA_INLINE UA_StatusCode
  267. UA_Client_writeWriteMaskAttribute(UA_Client *client, const UA_NodeId nodeId,
  268. const UA_UInt32 *newWriteMask) {
  269. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_WRITEMASK,
  270. newWriteMask, &UA_TYPES[UA_TYPES_UINT32]);
  271. }
  272. static UA_INLINE UA_StatusCode
  273. UA_Client_writeUserWriteMaskAttribute(UA_Client *client, const UA_NodeId nodeId,
  274. const UA_UInt32 *newUserWriteMask) {
  275. return __UA_Client_writeAttribute(client, &nodeId,
  276. UA_ATTRIBUTEID_USERWRITEMASK,
  277. newUserWriteMask,
  278. &UA_TYPES[UA_TYPES_UINT32]);
  279. }
  280. static UA_INLINE UA_StatusCode
  281. UA_Client_writeIsAbstractAttribute(UA_Client *client, const UA_NodeId nodeId,
  282. const UA_Boolean *newIsAbstract) {
  283. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_ISABSTRACT,
  284. newIsAbstract, &UA_TYPES[UA_TYPES_BOOLEAN]);
  285. }
  286. static UA_INLINE UA_StatusCode
  287. UA_Client_writeSymmetricAttribute(UA_Client *client, const UA_NodeId nodeId,
  288. const UA_Boolean *newSymmetric) {
  289. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_SYMMETRIC,
  290. newSymmetric, &UA_TYPES[UA_TYPES_BOOLEAN]);
  291. }
  292. static UA_INLINE UA_StatusCode
  293. UA_Client_writeInverseNameAttribute(UA_Client *client, const UA_NodeId nodeId,
  294. const UA_LocalizedText *newInverseName) {
  295. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_INVERSENAME,
  296. newInverseName,
  297. &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
  298. }
  299. static UA_INLINE UA_StatusCode
  300. UA_Client_writeContainsNoLoopsAttribute(UA_Client *client, const UA_NodeId nodeId,
  301. const UA_Boolean *newContainsNoLoops) {
  302. return __UA_Client_writeAttribute(client, &nodeId,
  303. UA_ATTRIBUTEID_CONTAINSNOLOOPS,
  304. newContainsNoLoops,
  305. &UA_TYPES[UA_TYPES_BOOLEAN]);
  306. }
  307. static UA_INLINE UA_StatusCode
  308. UA_Client_writeEventNotifierAttribute(UA_Client *client, const UA_NodeId nodeId,
  309. const UA_Byte *newEventNotifier) {
  310. return __UA_Client_writeAttribute(client, &nodeId,
  311. UA_ATTRIBUTEID_EVENTNOTIFIER,
  312. newEventNotifier,
  313. &UA_TYPES[UA_TYPES_BYTE]);
  314. }
  315. static UA_INLINE UA_StatusCode
  316. UA_Client_writeValueAttribute(UA_Client *client, const UA_NodeId nodeId,
  317. const UA_Variant *newValue) {
  318. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_VALUE,
  319. newValue, &UA_TYPES[UA_TYPES_VARIANT]);
  320. }
  321. static UA_INLINE UA_StatusCode
  322. UA_Client_writeDataTypeAttribute(UA_Client *client, const UA_NodeId nodeId,
  323. const UA_NodeId *newDataType) {
  324. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_DATATYPE,
  325. newDataType, &UA_TYPES[UA_TYPES_NODEID]);
  326. }
  327. static UA_INLINE UA_StatusCode
  328. UA_Client_writeValueRankAttribute(UA_Client *client, const UA_NodeId nodeId,
  329. const UA_Int32 *newValueRank) {
  330. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_VALUERANK,
  331. newValueRank, &UA_TYPES[UA_TYPES_INT32]);
  332. }
  333. UA_StatusCode UA_EXPORT
  334. UA_Client_writeArrayDimensionsAttribute(UA_Client *client, const UA_NodeId nodeId,
  335. size_t newArrayDimensionsSize,
  336. const UA_UInt32 *newArrayDimensions);
  337. static UA_INLINE UA_StatusCode
  338. UA_Client_writeAccessLevelAttribute(UA_Client *client, const UA_NodeId nodeId,
  339. const UA_Byte *newAccessLevel) {
  340. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_ACCESSLEVEL,
  341. newAccessLevel, &UA_TYPES[UA_TYPES_BYTE]);
  342. }
  343. static UA_INLINE UA_StatusCode
  344. UA_Client_writeUserAccessLevelAttribute(UA_Client *client, const UA_NodeId nodeId,
  345. const UA_Byte *newUserAccessLevel) {
  346. return __UA_Client_writeAttribute(client, &nodeId,
  347. UA_ATTRIBUTEID_USERACCESSLEVEL,
  348. newUserAccessLevel,
  349. &UA_TYPES[UA_TYPES_BYTE]);
  350. }
  351. static UA_INLINE UA_StatusCode
  352. UA_Client_writeMinimumSamplingIntervalAttribute(UA_Client *client,
  353. const UA_NodeId nodeId,
  354. const UA_Double *newMinInterval) {
  355. return __UA_Client_writeAttribute(client, &nodeId,
  356. UA_ATTRIBUTEID_MINIMUMSAMPLINGINTERVAL,
  357. newMinInterval, &UA_TYPES[UA_TYPES_DOUBLE]);
  358. }
  359. static UA_INLINE UA_StatusCode
  360. UA_Client_writeHistorizingAttribute(UA_Client *client, const UA_NodeId nodeId,
  361. const UA_Boolean *newHistorizing) {
  362. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_HISTORIZING,
  363. newHistorizing, &UA_TYPES[UA_TYPES_BOOLEAN]);
  364. }
  365. static UA_INLINE UA_StatusCode
  366. UA_Client_writeExecutableAttribute(UA_Client *client, const UA_NodeId nodeId,
  367. const UA_Boolean *newExecutable) {
  368. return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_EXECUTABLE,
  369. newExecutable, &UA_TYPES[UA_TYPES_BOOLEAN]);
  370. }
  371. static UA_INLINE UA_StatusCode
  372. UA_Client_writeUserExecutableAttribute(UA_Client *client, const UA_NodeId nodeId,
  373. const UA_Boolean *newUserExecutable) {
  374. return __UA_Client_writeAttribute(client, &nodeId,
  375. UA_ATTRIBUTEID_USEREXECUTABLE,
  376. newUserExecutable,
  377. &UA_TYPES[UA_TYPES_BOOLEAN]);
  378. }
  379. /**
  380. * Method Calling
  381. * ^^^^^^^^^^^^^^ */
  382. #ifdef UA_ENABLE_METHODCALLS
  383. UA_StatusCode UA_EXPORT
  384. UA_Client_call(UA_Client *client, const UA_NodeId objectId,
  385. const UA_NodeId methodId, size_t inputSize, const UA_Variant *input,
  386. size_t *outputSize, UA_Variant **output);
  387. #endif
  388. /**
  389. * Node Management
  390. * ^^^^^^^^^^^^^^^
  391. * See the section on :ref:`server-side node management <addnodes>`. */
  392. UA_StatusCode UA_EXPORT
  393. UA_Client_addReference(UA_Client *client, const UA_NodeId sourceNodeId,
  394. const UA_NodeId referenceTypeId, UA_Boolean isForward,
  395. const UA_String targetServerUri,
  396. const UA_ExpandedNodeId targetNodeId,
  397. UA_NodeClass targetNodeClass);
  398. UA_StatusCode UA_EXPORT
  399. UA_Client_deleteReference(UA_Client *client, const UA_NodeId sourceNodeId,
  400. const UA_NodeId referenceTypeId, UA_Boolean isForward,
  401. const UA_ExpandedNodeId targetNodeId,
  402. UA_Boolean deleteBidirectional);
  403. UA_StatusCode UA_EXPORT
  404. UA_Client_deleteNode(UA_Client *client, const UA_NodeId nodeId,
  405. UA_Boolean deleteTargetReferences);
  406. /* Protect against redundant definitions for server/client */
  407. #ifndef UA_DEFAULT_ATTRIBUTES_DEFINED
  408. #define UA_DEFAULT_ATTRIBUTES_DEFINED
  409. /* The default for variables is "BaseDataType" for the datatype, -2 for the
  410. * valuerank and a read-accesslevel. */
  411. UA_EXPORT extern const UA_VariableAttributes UA_VariableAttributes_default;
  412. UA_EXPORT extern const UA_VariableTypeAttributes UA_VariableTypeAttributes_default;
  413. /* Methods are executable by default */
  414. UA_EXPORT extern const UA_MethodAttributes UA_MethodAttributes_default;
  415. /* The remaining attribute definitions are currently all zeroed out */
  416. UA_EXPORT extern const UA_ObjectAttributes UA_ObjectAttributes_default;
  417. UA_EXPORT extern const UA_ObjectTypeAttributes UA_ObjectTypeAttributes_default;
  418. UA_EXPORT extern const UA_ReferenceTypeAttributes UA_ReferenceTypeAttributes_default;
  419. UA_EXPORT extern const UA_DataTypeAttributes UA_DataTypeAttributes_default;
  420. UA_EXPORT extern const UA_ViewAttributes UA_ViewAttributes_default;
  421. #endif
  422. /* Don't call this function, use the typed versions */
  423. UA_StatusCode UA_EXPORT
  424. __UA_Client_addNode(UA_Client *client, const UA_NodeClass nodeClass,
  425. const UA_NodeId requestedNewNodeId,
  426. const UA_NodeId parentNodeId,
  427. const UA_NodeId referenceTypeId,
  428. const UA_QualifiedName browseName,
  429. const UA_NodeId typeDefinition, const UA_NodeAttributes *attr,
  430. const UA_DataType *attributeType, UA_NodeId *outNewNodeId);
  431. static UA_INLINE UA_StatusCode
  432. UA_Client_addVariableNode(UA_Client *client, const UA_NodeId requestedNewNodeId,
  433. const UA_NodeId parentNodeId,
  434. const UA_NodeId referenceTypeId,
  435. const UA_QualifiedName browseName,
  436. const UA_NodeId typeDefinition,
  437. const UA_VariableAttributes attr,
  438. UA_NodeId *outNewNodeId) {
  439. return __UA_Client_addNode(client, UA_NODECLASS_VARIABLE, requestedNewNodeId,
  440. parentNodeId, referenceTypeId, browseName,
  441. typeDefinition, (const UA_NodeAttributes*)&attr,
  442. &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES],
  443. outNewNodeId);
  444. }
  445. static UA_INLINE UA_StatusCode
  446. UA_Client_addVariableTypeNode(UA_Client *client,
  447. const UA_NodeId requestedNewNodeId,
  448. const UA_NodeId parentNodeId,
  449. const UA_NodeId referenceTypeId,
  450. const UA_QualifiedName browseName,
  451. const UA_VariableTypeAttributes attr,
  452. UA_NodeId *outNewNodeId) {
  453. return __UA_Client_addNode(client, UA_NODECLASS_VARIABLETYPE,
  454. requestedNewNodeId,
  455. parentNodeId, referenceTypeId, browseName,
  456. UA_NODEID_NULL, (const UA_NodeAttributes*)&attr,
  457. &UA_TYPES[UA_TYPES_VARIABLETYPEATTRIBUTES],
  458. outNewNodeId);
  459. }
  460. static UA_INLINE UA_StatusCode
  461. UA_Client_addObjectNode(UA_Client *client, const UA_NodeId requestedNewNodeId,
  462. const UA_NodeId parentNodeId,
  463. const UA_NodeId referenceTypeId,
  464. const UA_QualifiedName browseName,
  465. const UA_NodeId typeDefinition,
  466. const UA_ObjectAttributes attr, UA_NodeId *outNewNodeId) {
  467. return __UA_Client_addNode(client, UA_NODECLASS_OBJECT, requestedNewNodeId,
  468. parentNodeId, referenceTypeId, browseName,
  469. typeDefinition, (const UA_NodeAttributes*)&attr,
  470. &UA_TYPES[UA_TYPES_OBJECTATTRIBUTES], outNewNodeId);
  471. }
  472. static UA_INLINE UA_StatusCode
  473. UA_Client_addObjectTypeNode(UA_Client *client, const UA_NodeId requestedNewNodeId,
  474. const UA_NodeId parentNodeId,
  475. const UA_NodeId referenceTypeId,
  476. const UA_QualifiedName browseName,
  477. const UA_ObjectTypeAttributes attr,
  478. UA_NodeId *outNewNodeId) {
  479. return __UA_Client_addNode(client, UA_NODECLASS_OBJECTTYPE, requestedNewNodeId,
  480. parentNodeId, referenceTypeId, browseName,
  481. UA_NODEID_NULL, (const UA_NodeAttributes*)&attr,
  482. &UA_TYPES[UA_TYPES_OBJECTTYPEATTRIBUTES],
  483. outNewNodeId);
  484. }
  485. static UA_INLINE UA_StatusCode
  486. UA_Client_addViewNode(UA_Client *client, const UA_NodeId requestedNewNodeId,
  487. const UA_NodeId parentNodeId,
  488. const UA_NodeId referenceTypeId,
  489. const UA_QualifiedName browseName,
  490. const UA_ViewAttributes attr,
  491. UA_NodeId *outNewNodeId) {
  492. return __UA_Client_addNode(client, UA_NODECLASS_VIEW, requestedNewNodeId,
  493. parentNodeId, referenceTypeId, browseName,
  494. UA_NODEID_NULL, (const UA_NodeAttributes*)&attr,
  495. &UA_TYPES[UA_TYPES_VIEWATTRIBUTES], outNewNodeId);
  496. }
  497. static UA_INLINE UA_StatusCode
  498. UA_Client_addReferenceTypeNode(UA_Client *client,
  499. const UA_NodeId requestedNewNodeId,
  500. const UA_NodeId parentNodeId,
  501. const UA_NodeId referenceTypeId,
  502. const UA_QualifiedName browseName,
  503. const UA_ReferenceTypeAttributes attr,
  504. UA_NodeId *outNewNodeId) {
  505. return __UA_Client_addNode(client, UA_NODECLASS_REFERENCETYPE,
  506. requestedNewNodeId,
  507. parentNodeId, referenceTypeId, browseName,
  508. UA_NODEID_NULL, (const UA_NodeAttributes*)&attr,
  509. &UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES],
  510. outNewNodeId);
  511. }
  512. static UA_INLINE UA_StatusCode
  513. UA_Client_addDataTypeNode(UA_Client *client, const UA_NodeId requestedNewNodeId,
  514. const UA_NodeId parentNodeId,
  515. const UA_NodeId referenceTypeId,
  516. const UA_QualifiedName browseName,
  517. const UA_DataTypeAttributes attr,
  518. UA_NodeId *outNewNodeId) {
  519. return __UA_Client_addNode(client, UA_NODECLASS_DATATYPE, requestedNewNodeId,
  520. parentNodeId, referenceTypeId, browseName,
  521. UA_NODEID_NULL, (const UA_NodeAttributes*)&attr,
  522. &UA_TYPES[UA_TYPES_DATATYPEATTRIBUTES],
  523. outNewNodeId);
  524. }
  525. static UA_INLINE UA_StatusCode
  526. UA_Client_addMethodNode(UA_Client *client, const UA_NodeId requestedNewNodeId,
  527. const UA_NodeId parentNodeId,
  528. const UA_NodeId referenceTypeId,
  529. const UA_QualifiedName browseName,
  530. const UA_MethodAttributes attr,
  531. UA_NodeId *outNewNodeId) {
  532. return __UA_Client_addNode(client, UA_NODECLASS_METHOD, requestedNewNodeId,
  533. parentNodeId, referenceTypeId, browseName,
  534. UA_NODEID_NULL, (const UA_NodeAttributes*)&attr,
  535. &UA_TYPES[UA_TYPES_METHODATTRIBUTES], outNewNodeId);
  536. }
  537. /**
  538. * Misc Highlevel Functionality
  539. * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */
  540. /* Get the namespace-index of a namespace-URI
  541. *
  542. * @param client The UA_Client struct for this connection
  543. * @param namespaceUri The interested namespace URI
  544. * @param namespaceIndex The namespace index of the URI. The value is unchanged
  545. * in case of an error
  546. * @return Indicates whether the operation succeeded or returns an error code */
  547. UA_StatusCode UA_EXPORT
  548. UA_Client_NamespaceGetIndex(UA_Client *client, UA_String *namespaceUri,
  549. UA_UInt16 *namespaceIndex);
  550. #ifndef HAVE_NODEITER_CALLBACK
  551. #define HAVE_NODEITER_CALLBACK
  552. /* Iterate over all nodes referenced by parentNodeId by calling the callback
  553. function for each child node */
  554. typedef UA_StatusCode (*UA_NodeIteratorCallback)(UA_NodeId childId, UA_Boolean isInverse,
  555. UA_NodeId referenceTypeId, void *handle);
  556. #endif
  557. UA_StatusCode UA_EXPORT
  558. UA_Client_forEachChildNodeCall(UA_Client *client, UA_NodeId parentNodeId,
  559. UA_NodeIteratorCallback callback, void *handle) ;
  560. _UA_END_DECLS
  561. #endif /* UA_CLIENT_HIGHLEVEL_H_ */