client_highlevel_async.h 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723
  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 2018 (c) Thomas Stalder, Blue Time Concept SA
  6. * Copyright 2018 (c) Fraunhofer IOSB (Author: Julius Pfrommer)
  7. */
  8. #ifndef UA_CLIENT_HIGHLEVEL_ASYNC_H_
  9. #define UA_CLIENT_HIGHLEVEL_ASYNC_H_
  10. #include <open62541/client.h>
  11. _UA_BEGIN_DECLS
  12. /**
  13. * Raw Services
  14. * ^^^^^^^^^^^^ */
  15. typedef void (*UA_ClientAsyncReadCallback)(UA_Client *client, void *userdata,
  16. UA_UInt32 requestId, UA_ReadResponse *rr);
  17. static UA_INLINE UA_StatusCode
  18. UA_Client_sendAsyncReadRequest(UA_Client *client, UA_ReadRequest *request,
  19. UA_ClientAsyncReadCallback readCallback, void *userdata,
  20. UA_UInt32 *reqId) {
  21. return UA_Client_sendAsyncRequest(client, request, &UA_TYPES[UA_TYPES_READREQUEST],
  22. (UA_ClientAsyncServiceCallback)readCallback,
  23. &UA_TYPES[UA_TYPES_READRESPONSE], userdata, reqId);
  24. }
  25. typedef void (*UA_ClientAsyncWriteCallback)(UA_Client *client, void *userdata,
  26. UA_UInt32 requestId, UA_WriteResponse *wr);
  27. static UA_INLINE UA_StatusCode
  28. UA_Client_sendAsyncWriteRequest(UA_Client *client, UA_WriteRequest *request,
  29. UA_ClientAsyncWriteCallback writeCallback, void *userdata,
  30. UA_UInt32 *reqId) {
  31. return UA_Client_sendAsyncRequest(client, request, &UA_TYPES[UA_TYPES_WRITEREQUEST],
  32. (UA_ClientAsyncServiceCallback)writeCallback,
  33. &UA_TYPES[UA_TYPES_WRITERESPONSE], userdata, reqId);
  34. }
  35. typedef void (*UA_ClientAsyncBrowseCallback)(UA_Client *client, void *userdata,
  36. UA_UInt32 requestId, UA_BrowseResponse *wr);
  37. static UA_INLINE UA_StatusCode
  38. UA_Client_sendAsyncBrowseRequest(UA_Client *client, UA_BrowseRequest *request,
  39. UA_ClientAsyncBrowseCallback browseCallback,
  40. void *userdata, UA_UInt32 *reqId) {
  41. return UA_Client_sendAsyncRequest(client, request, &UA_TYPES[UA_TYPES_BROWSEREQUEST],
  42. (UA_ClientAsyncServiceCallback)browseCallback,
  43. &UA_TYPES[UA_TYPES_BROWSERESPONSE], userdata,
  44. reqId);
  45. }
  46. /**
  47. * Read Attribute
  48. * ^^^^^^^^^^^^^^ */
  49. UA_StatusCode UA_EXPORT
  50. __UA_Client_readAttribute_async(UA_Client *client, const UA_NodeId *nodeId,
  51. UA_AttributeId attributeId,
  52. const UA_DataType *outDataType,
  53. UA_ClientAsyncServiceCallback callback, void *userdata,
  54. UA_UInt32 *reqId);
  55. typedef void (*UA_ClientAsyncReadDataTypeAttributeCallback)(UA_Client *client,
  56. void *userdata,
  57. UA_UInt32 requestId,
  58. UA_NodeId *var);
  59. static UA_INLINE UA_StatusCode
  60. UA_Client_readDataTypeAttribute_async(
  61. UA_Client *client, const UA_NodeId nodeId,
  62. UA_ClientAsyncReadDataTypeAttributeCallback callback, void *userdata,
  63. UA_UInt32 *reqId) {
  64. return __UA_Client_readAttribute_async(
  65. client, &nodeId, UA_ATTRIBUTEID_DATATYPE, &UA_TYPES[UA_TYPES_NODEID],
  66. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  67. }
  68. typedef void (*UA_ClientAsyncReadValueAttributeCallback)(UA_Client *client,
  69. void *userdata,
  70. UA_UInt32 requestId,
  71. UA_Variant *var);
  72. static UA_INLINE UA_StatusCode
  73. UA_Client_readValueAttribute_async(UA_Client *client, const UA_NodeId nodeId,
  74. UA_ClientAsyncReadValueAttributeCallback callback,
  75. void *userdata, UA_UInt32 *reqId) {
  76. return __UA_Client_readAttribute_async(
  77. client, &nodeId, UA_ATTRIBUTEID_VALUE, &UA_TYPES[UA_TYPES_VARIANT],
  78. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  79. }
  80. typedef void (*UA_ClientAsyncReadNodeIdAttributeCallback)(UA_Client *client,
  81. void *userdata,
  82. UA_UInt32 requestId,
  83. UA_NodeId *out);
  84. static UA_INLINE UA_StatusCode
  85. UA_Client_readNodeIdAttribute_async(UA_Client *client, const UA_NodeId nodeId,
  86. UA_ClientAsyncReadNodeIdAttributeCallback callback,
  87. void *userdata, UA_UInt32 *reqId) {
  88. return __UA_Client_readAttribute_async(
  89. client, &nodeId, UA_ATTRIBUTEID_NODEID, &UA_TYPES[UA_TYPES_NODEID],
  90. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  91. }
  92. typedef void (*UA_ClientAsyncReadNodeClassAttributeCallback)(UA_Client *client,
  93. void *userdata,
  94. UA_UInt32 requestId,
  95. UA_NodeClass *out);
  96. static UA_INLINE UA_StatusCode
  97. UA_Client_readNodeClassAttribute_async(
  98. UA_Client *client, const UA_NodeId nodeId,
  99. UA_ClientAsyncReadNodeClassAttributeCallback callback, void *userdata,
  100. UA_UInt32 *reqId) {
  101. return __UA_Client_readAttribute_async(
  102. client, &nodeId, UA_ATTRIBUTEID_NODECLASS, &UA_TYPES[UA_TYPES_NODECLASS],
  103. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  104. }
  105. typedef void (*UA_ClientAsyncReadBrowseNameAttributeCallback)(UA_Client *client,
  106. void *userdata,
  107. UA_UInt32 requestId,
  108. UA_QualifiedName *out);
  109. static UA_INLINE UA_StatusCode
  110. UA_Client_readBrowseNameAttribute_async(
  111. UA_Client *client, const UA_NodeId nodeId,
  112. UA_ClientAsyncReadBrowseNameAttributeCallback callback, void *userdata,
  113. UA_UInt32 *reqId) {
  114. return __UA_Client_readAttribute_async(
  115. client, &nodeId, UA_ATTRIBUTEID_BROWSENAME, &UA_TYPES[UA_TYPES_QUALIFIEDNAME],
  116. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  117. }
  118. typedef void (*UA_ClientAsyncReadDisplayNameAttributeCallback)(UA_Client *client,
  119. void *userdata,
  120. UA_UInt32 requestId,
  121. UA_LocalizedText *out);
  122. static UA_INLINE UA_StatusCode
  123. UA_Client_readDisplayNameAttribute_async(
  124. UA_Client *client, const UA_NodeId nodeId,
  125. UA_ClientAsyncReadDisplayNameAttributeCallback callback, void *userdata,
  126. UA_UInt32 *reqId) {
  127. return __UA_Client_readAttribute_async(
  128. client, &nodeId, UA_ATTRIBUTEID_DISPLAYNAME, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT],
  129. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  130. }
  131. typedef void (*UA_ClientAsyncReadDescriptionAttributeCallback)(UA_Client *client,
  132. void *userdata,
  133. UA_UInt32 requestId,
  134. UA_LocalizedText *out);
  135. static UA_INLINE UA_StatusCode
  136. UA_Client_readDescriptionAttribute_async(
  137. UA_Client *client, const UA_NodeId nodeId,
  138. UA_ClientAsyncReadDescriptionAttributeCallback callback, void *userdata,
  139. UA_UInt32 *reqId) {
  140. return __UA_Client_readAttribute_async(
  141. client, &nodeId, UA_ATTRIBUTEID_DESCRIPTION, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT],
  142. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  143. }
  144. typedef void (*UA_ClientAsyncReadWriteMaskAttributeCallback)(UA_Client *client,
  145. void *userdata,
  146. UA_UInt32 requestId,
  147. UA_UInt32 *out);
  148. static UA_INLINE UA_StatusCode
  149. UA_Client_readWriteMaskAttribute_async(
  150. UA_Client *client, const UA_NodeId nodeId,
  151. UA_ClientAsyncReadWriteMaskAttributeCallback callback, void *userdata,
  152. UA_UInt32 *reqId) {
  153. return __UA_Client_readAttribute_async(
  154. client, &nodeId, UA_ATTRIBUTEID_WRITEMASK, &UA_TYPES[UA_TYPES_UINT32],
  155. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  156. }
  157. typedef void (*UA_ClientAsyncReadUserWriteMaskAttributeCallback)(UA_Client *client,
  158. void *userdata,
  159. UA_UInt32 requestId,
  160. UA_UInt32 *out);
  161. static UA_INLINE UA_StatusCode
  162. UA_Client_readUserWriteMaskAttribute_async(
  163. UA_Client *client, const UA_NodeId nodeId,
  164. UA_ClientAsyncReadUserWriteMaskAttributeCallback callback, void *userdata,
  165. UA_UInt32 *reqId) {
  166. return __UA_Client_readAttribute_async(
  167. client, &nodeId, UA_ATTRIBUTEID_USERWRITEMASK, &UA_TYPES[UA_TYPES_UINT32],
  168. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  169. }
  170. typedef void (*UA_ClientAsyncReadIsAbstractAttributeCallback)(UA_Client *client,
  171. void *userdata,
  172. UA_UInt32 requestId,
  173. UA_Boolean *out);
  174. static UA_INLINE UA_StatusCode
  175. UA_Client_readIsAbstractAttribute_async(
  176. UA_Client *client, const UA_NodeId nodeId,
  177. UA_ClientAsyncReadIsAbstractAttributeCallback callback, void *userdata,
  178. UA_UInt32 *reqId) {
  179. return __UA_Client_readAttribute_async(
  180. client, &nodeId, UA_ATTRIBUTEID_ISABSTRACT, &UA_TYPES[UA_TYPES_BOOLEAN],
  181. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  182. }
  183. typedef void (*UA_ClientAsyncReadSymmetricAttributeCallback)(UA_Client *client,
  184. void *userdata,
  185. UA_UInt32 requestId,
  186. UA_Boolean *out);
  187. static UA_INLINE UA_StatusCode
  188. UA_Client_readSymmetricAttribute_async(
  189. UA_Client *client, const UA_NodeId nodeId,
  190. UA_ClientAsyncReadSymmetricAttributeCallback callback, void *userdata,
  191. UA_UInt32 *reqId) {
  192. return __UA_Client_readAttribute_async(
  193. client, &nodeId, UA_ATTRIBUTEID_SYMMETRIC, &UA_TYPES[UA_TYPES_BOOLEAN],
  194. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  195. }
  196. typedef void (*UA_ClientAsyncReadInverseNameAttributeCallback)(UA_Client *client,
  197. void *userdata,
  198. UA_UInt32 requestId,
  199. UA_LocalizedText *out);
  200. static UA_INLINE UA_StatusCode
  201. UA_Client_readInverseNameAttribute_async(
  202. UA_Client *client, const UA_NodeId nodeId,
  203. UA_ClientAsyncReadInverseNameAttributeCallback callback, void *userdata,
  204. UA_UInt32 *reqId) {
  205. return __UA_Client_readAttribute_async(
  206. client, &nodeId, UA_ATTRIBUTEID_INVERSENAME, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT],
  207. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  208. }
  209. typedef void (*UA_ClientAsyncReadContainsNoLoopsAttributeCallback)(UA_Client *client,
  210. void *userdata,
  211. UA_UInt32 requestId,
  212. UA_Boolean *out);
  213. static UA_INLINE UA_StatusCode
  214. UA_Client_readContainsNoLoopsAttribute_async(
  215. UA_Client *client, const UA_NodeId nodeId,
  216. UA_ClientAsyncReadContainsNoLoopsAttributeCallback callback, void *userdata,
  217. UA_UInt32 *reqId) {
  218. return __UA_Client_readAttribute_async(
  219. client, &nodeId, UA_ATTRIBUTEID_CONTAINSNOLOOPS, &UA_TYPES[UA_TYPES_BOOLEAN],
  220. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  221. }
  222. typedef void (*UA_ClientAsyncReadEventNotifierAttributeCallback)(UA_Client *client,
  223. void *userdata,
  224. UA_UInt32 requestId,
  225. UA_Byte *out);
  226. static UA_INLINE UA_StatusCode
  227. UA_Client_readEventNotifierAttribute_async(
  228. UA_Client *client, const UA_NodeId nodeId,
  229. UA_ClientAsyncReadEventNotifierAttributeCallback callback, void *userdata,
  230. UA_UInt32 *reqId) {
  231. return __UA_Client_readAttribute_async(
  232. client, &nodeId, UA_ATTRIBUTEID_EVENTNOTIFIER, &UA_TYPES[UA_TYPES_BYTE],
  233. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  234. }
  235. typedef void (*UA_ClientAsyncReadValueRankAttributeCallback)(UA_Client *client,
  236. void *userdata,
  237. UA_UInt32 requestId,
  238. UA_Int32 *out);
  239. static UA_INLINE UA_StatusCode
  240. UA_Client_readValueRankAttribute_async(
  241. UA_Client *client, const UA_NodeId nodeId,
  242. UA_ClientAsyncReadValueRankAttributeCallback callback, void *userdata,
  243. UA_UInt32 *reqId) {
  244. return __UA_Client_readAttribute_async(
  245. client, &nodeId, UA_ATTRIBUTEID_VALUERANK, &UA_TYPES[UA_TYPES_INT32],
  246. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  247. }
  248. typedef void (*UA_ClientAsyncReadAccessLevelAttributeCallback)(UA_Client *client,
  249. void *userdata,
  250. UA_UInt32 requestId,
  251. UA_Byte *out);
  252. static UA_INLINE UA_StatusCode
  253. UA_Client_readAccessLevelAttribute_async(
  254. UA_Client *client, const UA_NodeId nodeId,
  255. UA_ClientAsyncReadAccessLevelAttributeCallback callback, void *userdata,
  256. UA_UInt32 *reqId) {
  257. return __UA_Client_readAttribute_async(
  258. client, &nodeId, UA_ATTRIBUTEID_ACCESSLEVEL, &UA_TYPES[UA_TYPES_BYTE],
  259. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  260. }
  261. typedef void (*UA_ClientAsyncReadUserAccessLevelAttributeCallback)(UA_Client *client,
  262. void *userdata,
  263. UA_UInt32 requestId,
  264. UA_Byte *out);
  265. static UA_INLINE UA_StatusCode
  266. UA_Client_readUserAccessLevelAttribute_async(
  267. UA_Client *client, const UA_NodeId nodeId,
  268. UA_ClientAsyncReadUserAccessLevelAttributeCallback callback, void *userdata,
  269. UA_UInt32 *reqId) {
  270. return __UA_Client_readAttribute_async(
  271. client, &nodeId, UA_ATTRIBUTEID_USERACCESSLEVEL, &UA_TYPES[UA_TYPES_BYTE],
  272. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  273. }
  274. typedef void (*UA_ClientAsyncReadMinimumSamplingIntervalAttributeCallback)(
  275. UA_Client *client, void *userdata, UA_UInt32 requestId, UA_Double *out);
  276. static UA_INLINE UA_StatusCode
  277. UA_Client_readMinimumSamplingIntervalAttribute_async(
  278. UA_Client *client, const UA_NodeId nodeId,
  279. UA_ClientAsyncReadMinimumSamplingIntervalAttributeCallback callback, void *userdata,
  280. UA_UInt32 *reqId) {
  281. return __UA_Client_readAttribute_async(
  282. client, &nodeId, UA_ATTRIBUTEID_MINIMUMSAMPLINGINTERVAL,
  283. &UA_TYPES[UA_TYPES_DOUBLE], (UA_ClientAsyncServiceCallback)callback, userdata,
  284. reqId);
  285. }
  286. typedef void (*UA_ClientAsyncReadHistorizingAttributeCallback)(UA_Client *client,
  287. void *userdata,
  288. UA_UInt32 requestId,
  289. UA_Boolean *out);
  290. static UA_INLINE UA_StatusCode
  291. UA_Client_readHistorizingAttribute_async(
  292. UA_Client *client, const UA_NodeId nodeId,
  293. UA_ClientAsyncReadHistorizingAttributeCallback callback, void *userdata,
  294. UA_UInt32 *reqId) {
  295. return __UA_Client_readAttribute_async(
  296. client, &nodeId, UA_ATTRIBUTEID_HISTORIZING, &UA_TYPES[UA_TYPES_BOOLEAN],
  297. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  298. }
  299. typedef void (*UA_ClientAsyncReadExecutableAttributeCallback)(UA_Client *client,
  300. void *userdata,
  301. UA_UInt32 requestId,
  302. UA_Boolean *out);
  303. static UA_INLINE UA_StatusCode
  304. UA_Client_readExecutableAttribute_async(
  305. UA_Client *client, const UA_NodeId nodeId,
  306. UA_ClientAsyncReadExecutableAttributeCallback callback, void *userdata,
  307. UA_UInt32 *reqId) {
  308. return __UA_Client_readAttribute_async(
  309. client, &nodeId, UA_ATTRIBUTEID_EXECUTABLE, &UA_TYPES[UA_TYPES_BOOLEAN],
  310. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  311. }
  312. typedef void (*UA_ClientAsyncReadUserExecutableAttributeCallback)(UA_Client *client,
  313. void *userdata,
  314. UA_UInt32 requestId,
  315. UA_Boolean *out);
  316. static UA_INLINE UA_StatusCode
  317. UA_Client_readUserExecutableAttribute_async(
  318. UA_Client *client, const UA_NodeId nodeId,
  319. UA_ClientAsyncReadUserExecutableAttributeCallback callback, void *userdata,
  320. UA_UInt32 *reqId) {
  321. return __UA_Client_readAttribute_async(
  322. client, &nodeId, UA_ATTRIBUTEID_USEREXECUTABLE, &UA_TYPES[UA_TYPES_BOOLEAN],
  323. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  324. }
  325. /**
  326. * Write Attribute
  327. * ^^^^^^^^^^^^^^ */
  328. UA_StatusCode UA_EXPORT
  329. __UA_Client_writeAttribute_async(UA_Client *client, const UA_NodeId *nodeId,
  330. UA_AttributeId attributeId, const void *in,
  331. const UA_DataType *inDataType,
  332. UA_ClientAsyncServiceCallback callback, void *userdata,
  333. UA_UInt32 *reqId);
  334. static UA_INLINE UA_StatusCode
  335. UA_Client_writeValueAttribute_async(UA_Client *client, const UA_NodeId nodeId,
  336. const UA_Variant *newValue,
  337. UA_ClientAsyncWriteCallback callback, void *userdata,
  338. UA_UInt32 *reqId) {
  339. return __UA_Client_writeAttribute_async(
  340. client, &nodeId, UA_ATTRIBUTEID_VALUE, newValue, &UA_TYPES[UA_TYPES_VARIANT],
  341. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  342. }
  343. static UA_INLINE UA_StatusCode
  344. UA_Client_writeNodeIdAttribute_async(UA_Client *client, const UA_NodeId nodeId,
  345. const UA_NodeId *outNodeId,
  346. UA_ClientAsyncServiceCallback callback,
  347. void *userdata, UA_UInt32 *reqId) {
  348. return __UA_Client_writeAttribute_async(client, &nodeId, UA_ATTRIBUTEID_NODEID,
  349. outNodeId, &UA_TYPES[UA_TYPES_NODEID],
  350. callback, userdata, reqId);
  351. }
  352. static UA_INLINE UA_StatusCode
  353. UA_Client_writeNodeClassAttribute_async(UA_Client *client, const UA_NodeId nodeId,
  354. const UA_NodeClass *outNodeClass,
  355. UA_ClientAsyncServiceCallback callback,
  356. void *userdata, UA_UInt32 *reqId) {
  357. return __UA_Client_writeAttribute_async(client, &nodeId, UA_ATTRIBUTEID_NODECLASS,
  358. outNodeClass, &UA_TYPES[UA_TYPES_NODECLASS],
  359. callback, userdata, reqId);
  360. }
  361. static UA_INLINE UA_StatusCode
  362. UA_Client_writeBrowseNameAttribute_async(UA_Client *client, const UA_NodeId nodeId,
  363. const UA_QualifiedName *outBrowseName,
  364. UA_ClientAsyncServiceCallback callback,
  365. void *userdata, UA_UInt32 *reqId) {
  366. return __UA_Client_writeAttribute_async(
  367. client, &nodeId, UA_ATTRIBUTEID_BROWSENAME, outBrowseName,
  368. &UA_TYPES[UA_TYPES_QUALIFIEDNAME], callback, userdata, reqId);
  369. }
  370. static UA_INLINE UA_StatusCode
  371. UA_Client_writeDisplayNameAttribute_async(UA_Client *client, const UA_NodeId nodeId,
  372. const UA_LocalizedText *outDisplayName,
  373. UA_ClientAsyncServiceCallback callback,
  374. void *userdata, UA_UInt32 *reqId) {
  375. return __UA_Client_writeAttribute_async(
  376. client, &nodeId, UA_ATTRIBUTEID_DISPLAYNAME, outDisplayName,
  377. &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], callback, userdata, reqId);
  378. }
  379. static UA_INLINE UA_StatusCode
  380. UA_Client_writeDescriptionAttribute_async(UA_Client *client, const UA_NodeId nodeId,
  381. const UA_LocalizedText *outDescription,
  382. UA_ClientAsyncServiceCallback callback,
  383. void *userdata, UA_UInt32 *reqId) {
  384. return __UA_Client_writeAttribute_async(
  385. client, &nodeId, UA_ATTRIBUTEID_DESCRIPTION, outDescription,
  386. &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], callback, userdata, reqId);
  387. }
  388. static UA_INLINE UA_StatusCode
  389. UA_Client_writeWriteMaskAttribute_async(UA_Client *client, const UA_NodeId nodeId,
  390. const UA_UInt32 *outWriteMask,
  391. UA_ClientAsyncServiceCallback callback,
  392. void *userdata, UA_UInt32 *reqId) {
  393. return __UA_Client_writeAttribute_async(client, &nodeId, UA_ATTRIBUTEID_WRITEMASK,
  394. outWriteMask, &UA_TYPES[UA_TYPES_UINT32],
  395. callback, userdata, reqId);
  396. }
  397. static UA_INLINE UA_StatusCode
  398. UA_Client_writeUserWriteMaskAttribute_async(UA_Client *client, const UA_NodeId nodeId,
  399. const UA_UInt32 *outUserWriteMask,
  400. UA_ClientAsyncServiceCallback callback,
  401. void *userdata, UA_UInt32 *reqId) {
  402. return __UA_Client_writeAttribute_async(client, &nodeId, UA_ATTRIBUTEID_USERWRITEMASK,
  403. outUserWriteMask, &UA_TYPES[UA_TYPES_UINT32],
  404. callback, userdata, reqId);
  405. }
  406. static UA_INLINE UA_StatusCode
  407. UA_Client_writeIsAbstractAttribute_async(UA_Client *client, const UA_NodeId nodeId,
  408. const UA_Boolean *outIsAbstract,
  409. UA_ClientAsyncServiceCallback callback,
  410. void *userdata, UA_UInt32 *reqId) {
  411. return __UA_Client_writeAttribute_async(client, &nodeId, UA_ATTRIBUTEID_ISABSTRACT,
  412. outIsAbstract, &UA_TYPES[UA_TYPES_BOOLEAN],
  413. callback, userdata, reqId);
  414. }
  415. static UA_INLINE UA_StatusCode
  416. UA_Client_writeSymmetricAttribute_async(UA_Client *client, const UA_NodeId nodeId,
  417. const UA_Boolean *outSymmetric,
  418. UA_ClientAsyncServiceCallback callback,
  419. void *userdata, UA_UInt32 *reqId) {
  420. return __UA_Client_writeAttribute_async(client, &nodeId, UA_ATTRIBUTEID_SYMMETRIC,
  421. outSymmetric, &UA_TYPES[UA_TYPES_BOOLEAN],
  422. callback, userdata, reqId);
  423. }
  424. static UA_INLINE UA_StatusCode
  425. UA_Client_writeInverseNameAttribute_async(UA_Client *client, const UA_NodeId nodeId,
  426. const UA_LocalizedText *outInverseName,
  427. UA_ClientAsyncServiceCallback callback,
  428. void *userdata, UA_UInt32 *reqId) {
  429. return __UA_Client_writeAttribute_async(
  430. client, &nodeId, UA_ATTRIBUTEID_INVERSENAME, outInverseName,
  431. &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], callback, userdata, reqId);
  432. }
  433. static UA_INLINE UA_StatusCode
  434. UA_Client_writeContainsNoLoopsAttribute_async(UA_Client *client, const UA_NodeId nodeId,
  435. const UA_Boolean *outContainsNoLoops,
  436. UA_ClientAsyncServiceCallback callback,
  437. void *userdata, UA_UInt32 *reqId) {
  438. return __UA_Client_writeAttribute_async(
  439. client, &nodeId, UA_ATTRIBUTEID_CONTAINSNOLOOPS, outContainsNoLoops,
  440. &UA_TYPES[UA_TYPES_BOOLEAN], callback, userdata, reqId);
  441. }
  442. static UA_INLINE UA_StatusCode
  443. UA_Client_writeEventNotifierAttribute_async(UA_Client *client, const UA_NodeId nodeId,
  444. const UA_Byte *outEventNotifier,
  445. UA_ClientAsyncServiceCallback callback,
  446. void *userdata, UA_UInt32 *reqId) {
  447. return __UA_Client_writeAttribute_async(client, &nodeId, UA_ATTRIBUTEID_EVENTNOTIFIER,
  448. outEventNotifier, &UA_TYPES[UA_TYPES_BYTE],
  449. callback, userdata, reqId);
  450. }
  451. static UA_INLINE UA_StatusCode
  452. UA_Client_writeDataTypeAttribute_async(UA_Client *client, const UA_NodeId nodeId,
  453. const UA_NodeId *outDataType,
  454. UA_ClientAsyncServiceCallback callback,
  455. void *userdata, UA_UInt32 *reqId) {
  456. return __UA_Client_writeAttribute_async(client, &nodeId, UA_ATTRIBUTEID_DATATYPE,
  457. outDataType, &UA_TYPES[UA_TYPES_NODEID],
  458. callback, userdata, reqId);
  459. }
  460. static UA_INLINE UA_StatusCode
  461. UA_Client_writeValueRankAttribute_async(UA_Client *client, const UA_NodeId nodeId,
  462. const UA_Int32 *outValueRank,
  463. UA_ClientAsyncServiceCallback callback,
  464. void *userdata, UA_UInt32 *reqId) {
  465. return __UA_Client_writeAttribute_async(client, &nodeId, UA_ATTRIBUTEID_VALUERANK,
  466. outValueRank, &UA_TYPES[UA_TYPES_INT32],
  467. callback, userdata, reqId);
  468. }
  469. static UA_INLINE UA_StatusCode
  470. UA_Client_writeAccessLevelAttribute_async(UA_Client *client, const UA_NodeId nodeId,
  471. const UA_Byte *outAccessLevel,
  472. UA_ClientAsyncServiceCallback callback,
  473. void *userdata, UA_UInt32 *reqId) {
  474. return __UA_Client_writeAttribute_async(client, &nodeId, UA_ATTRIBUTEID_ACCESSLEVEL,
  475. outAccessLevel, &UA_TYPES[UA_TYPES_BYTE],
  476. callback, userdata, reqId);
  477. }
  478. static UA_INLINE UA_StatusCode
  479. UA_Client_writeUserAccessLevelAttribute_async(UA_Client *client, const UA_NodeId nodeId,
  480. const UA_Byte *outUserAccessLevel,
  481. UA_ClientAsyncServiceCallback callback,
  482. void *userdata, UA_UInt32 *reqId) {
  483. return __UA_Client_writeAttribute_async(
  484. client, &nodeId, UA_ATTRIBUTEID_USERACCESSLEVEL, outUserAccessLevel,
  485. &UA_TYPES[UA_TYPES_BYTE], callback, userdata, reqId);
  486. }
  487. static UA_INLINE UA_StatusCode
  488. UA_Client_writeMinimumSamplingIntervalAttribute_async(
  489. UA_Client *client, const UA_NodeId nodeId,
  490. const UA_Double *outMinimumSamplingInterval, UA_ClientAsyncServiceCallback callback,
  491. void *userdata, UA_UInt32 *reqId) {
  492. return __UA_Client_writeAttribute_async(
  493. client, &nodeId, UA_ATTRIBUTEID_MINIMUMSAMPLINGINTERVAL,
  494. outMinimumSamplingInterval, &UA_TYPES[UA_TYPES_DOUBLE], callback, userdata,
  495. reqId);
  496. }
  497. static UA_INLINE UA_StatusCode
  498. UA_Client_writeHistorizingAttribute_async(UA_Client *client, const UA_NodeId nodeId,
  499. const UA_Boolean *outHistorizing,
  500. UA_ClientAsyncServiceCallback callback,
  501. void *userdata, UA_UInt32 *reqId) {
  502. return __UA_Client_writeAttribute_async(client, &nodeId, UA_ATTRIBUTEID_HISTORIZING,
  503. outHistorizing, &UA_TYPES[UA_TYPES_BOOLEAN],
  504. callback, userdata, reqId);
  505. }
  506. static UA_INLINE UA_StatusCode
  507. UA_Client_writeExecutableAttribute_async(UA_Client *client, const UA_NodeId nodeId,
  508. const UA_Boolean *outExecutable,
  509. UA_ClientAsyncServiceCallback callback,
  510. void *userdata, UA_UInt32 *reqId) {
  511. return __UA_Client_writeAttribute_async(client, &nodeId, UA_ATTRIBUTEID_EXECUTABLE,
  512. outExecutable, &UA_TYPES[UA_TYPES_BOOLEAN],
  513. callback, userdata, reqId);
  514. }
  515. static UA_INLINE UA_StatusCode
  516. UA_Client_writeUserExecutableAttribute_async(UA_Client *client, const UA_NodeId nodeId,
  517. const UA_Boolean *outUserExecutable,
  518. UA_ClientAsyncServiceCallback callback,
  519. void *userdata, UA_UInt32 *reqId) {
  520. return __UA_Client_writeAttribute_async(
  521. client, &nodeId, UA_ATTRIBUTEID_USEREXECUTABLE, outUserExecutable,
  522. &UA_TYPES[UA_TYPES_BOOLEAN], callback, userdata, reqId);
  523. }
  524. /**
  525. * Method Calling
  526. * ^^^^^^^^^^^^^^ */
  527. #ifdef UA_ENABLE_METHODCALLS
  528. UA_StatusCode UA_EXPORT
  529. __UA_Client_call_async(UA_Client *client, const UA_NodeId objectId,
  530. const UA_NodeId methodId, size_t inputSize,
  531. const UA_Variant *input, UA_ClientAsyncServiceCallback callback,
  532. void *userdata, UA_UInt32 *reqId);
  533. typedef void (*UA_ClientAsyncCallCallback)(UA_Client *client, void *userdata,
  534. UA_UInt32 requestId, UA_CallResponse *cr);
  535. static UA_INLINE UA_StatusCode
  536. UA_Client_call_async(UA_Client *client, const UA_NodeId objectId,
  537. const UA_NodeId methodId, size_t inputSize, const UA_Variant *input,
  538. UA_ClientAsyncCallCallback callback, void *userdata,
  539. UA_UInt32 *reqId) {
  540. return __UA_Client_call_async(client, objectId, methodId, inputSize, input,
  541. (UA_ClientAsyncServiceCallback)callback, userdata,
  542. reqId);
  543. }
  544. #endif
  545. /**
  546. * Node Management
  547. * ^^^^^^^^^^^^^^^ */
  548. typedef void (*UA_ClientAsyncAddNodesCallback)(UA_Client *client, void *userdata,
  549. UA_UInt32 requestId,
  550. UA_AddNodesResponse *ar);
  551. UA_StatusCode UA_EXPORT
  552. __UA_Client_addNode_async(UA_Client *client, const UA_NodeClass nodeClass,
  553. const UA_NodeId requestedNewNodeId,
  554. const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
  555. const UA_QualifiedName browseName,
  556. const UA_NodeId typeDefinition, const UA_NodeAttributes *attr,
  557. const UA_DataType *attributeType, UA_NodeId *outNewNodeId,
  558. UA_ClientAsyncServiceCallback callback, void *userdata,
  559. UA_UInt32 *reqId);
  560. static UA_INLINE UA_StatusCode
  561. UA_Client_addVariableNode_async(UA_Client *client, const UA_NodeId requestedNewNodeId,
  562. const UA_NodeId parentNodeId,
  563. const UA_NodeId referenceTypeId,
  564. const UA_QualifiedName browseName,
  565. const UA_NodeId typeDefinition,
  566. const UA_VariableAttributes attr, UA_NodeId *outNewNodeId,
  567. UA_ClientAsyncAddNodesCallback callback, void *userdata,
  568. UA_UInt32 *reqId) {
  569. return __UA_Client_addNode_async(
  570. client, UA_NODECLASS_VARIABLE, requestedNewNodeId, parentNodeId, referenceTypeId,
  571. browseName, typeDefinition, (const UA_NodeAttributes *)&attr,
  572. &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES], outNewNodeId,
  573. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  574. }
  575. static UA_INLINE UA_StatusCode
  576. UA_Client_addVariableTypeNode_async(
  577. UA_Client *client, const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId,
  578. const UA_NodeId referenceTypeId, const UA_QualifiedName browseName,
  579. const UA_VariableTypeAttributes attr, UA_NodeId *outNewNodeId,
  580. UA_ClientAsyncAddNodesCallback callback, void *userdata, UA_UInt32 *reqId) {
  581. return __UA_Client_addNode_async(
  582. client, UA_NODECLASS_VARIABLETYPE, requestedNewNodeId, parentNodeId,
  583. referenceTypeId, browseName, UA_NODEID_NULL, (const UA_NodeAttributes *)&attr,
  584. &UA_TYPES[UA_TYPES_VARIABLETYPEATTRIBUTES], outNewNodeId,
  585. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  586. }
  587. static UA_INLINE UA_StatusCode
  588. UA_Client_addObjectNode_async(UA_Client *client, const UA_NodeId requestedNewNodeId,
  589. const UA_NodeId parentNodeId,
  590. const UA_NodeId referenceTypeId,
  591. const UA_QualifiedName browseName,
  592. const UA_NodeId typeDefinition,
  593. const UA_ObjectAttributes attr, UA_NodeId *outNewNodeId,
  594. UA_ClientAsyncAddNodesCallback callback, void *userdata,
  595. UA_UInt32 *reqId) {
  596. return __UA_Client_addNode_async(
  597. client, UA_NODECLASS_OBJECT, requestedNewNodeId, parentNodeId, referenceTypeId,
  598. browseName, typeDefinition, (const UA_NodeAttributes *)&attr,
  599. &UA_TYPES[UA_TYPES_OBJECTATTRIBUTES], outNewNodeId,
  600. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  601. }
  602. static UA_INLINE UA_StatusCode
  603. UA_Client_addObjectTypeNode_async(
  604. UA_Client *client, const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId,
  605. const UA_NodeId referenceTypeId, const UA_QualifiedName browseName,
  606. const UA_ObjectTypeAttributes attr, UA_NodeId *outNewNodeId,
  607. UA_ClientAsyncAddNodesCallback callback, void *userdata, UA_UInt32 *reqId) {
  608. return __UA_Client_addNode_async(
  609. client, UA_NODECLASS_OBJECTTYPE, requestedNewNodeId, parentNodeId,
  610. referenceTypeId, browseName, UA_NODEID_NULL, (const UA_NodeAttributes *)&attr,
  611. &UA_TYPES[UA_TYPES_OBJECTTYPEATTRIBUTES], outNewNodeId,
  612. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  613. }
  614. static UA_INLINE UA_StatusCode
  615. UA_Client_addViewNode_async(UA_Client *client, const UA_NodeId requestedNewNodeId,
  616. const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
  617. const UA_QualifiedName browseName,
  618. const UA_ViewAttributes attr, UA_NodeId *outNewNodeId,
  619. UA_ClientAsyncAddNodesCallback callback, void *userdata,
  620. UA_UInt32 *reqId) {
  621. return __UA_Client_addNode_async(
  622. client, UA_NODECLASS_VIEW, requestedNewNodeId, parentNodeId, referenceTypeId,
  623. browseName, UA_NODEID_NULL, (const UA_NodeAttributes *)&attr,
  624. &UA_TYPES[UA_TYPES_VIEWATTRIBUTES], outNewNodeId,
  625. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  626. }
  627. static UA_INLINE UA_StatusCode
  628. UA_Client_addReferenceTypeNode_async(
  629. UA_Client *client, const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId,
  630. const UA_NodeId referenceTypeId, const UA_QualifiedName browseName,
  631. const UA_ReferenceTypeAttributes attr, UA_NodeId *outNewNodeId,
  632. UA_ClientAsyncAddNodesCallback callback, void *userdata, UA_UInt32 *reqId) {
  633. return __UA_Client_addNode_async(
  634. client, UA_NODECLASS_REFERENCETYPE, requestedNewNodeId, parentNodeId,
  635. referenceTypeId, browseName, UA_NODEID_NULL, (const UA_NodeAttributes *)&attr,
  636. &UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES], outNewNodeId,
  637. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  638. }
  639. static UA_INLINE UA_StatusCode
  640. UA_Client_addDataTypeNode_async(UA_Client *client, const UA_NodeId requestedNewNodeId,
  641. const UA_NodeId parentNodeId,
  642. const UA_NodeId referenceTypeId,
  643. const UA_QualifiedName browseName,
  644. const UA_DataTypeAttributes attr, UA_NodeId *outNewNodeId,
  645. UA_ClientAsyncAddNodesCallback callback, void *userdata,
  646. UA_UInt32 *reqId) {
  647. return __UA_Client_addNode_async(
  648. client, UA_NODECLASS_DATATYPE, requestedNewNodeId, parentNodeId, referenceTypeId,
  649. browseName, UA_NODEID_NULL, (const UA_NodeAttributes *)&attr,
  650. &UA_TYPES[UA_TYPES_DATATYPEATTRIBUTES], outNewNodeId,
  651. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  652. }
  653. static UA_INLINE UA_StatusCode
  654. UA_Client_addMethodNode_async(UA_Client *client, const UA_NodeId requestedNewNodeId,
  655. const UA_NodeId parentNodeId,
  656. const UA_NodeId referenceTypeId,
  657. const UA_QualifiedName browseName,
  658. const UA_MethodAttributes attr, UA_NodeId *outNewNodeId,
  659. UA_ClientAsyncAddNodesCallback callback, void *userdata,
  660. UA_UInt32 *reqId) {
  661. return __UA_Client_addNode_async(
  662. client, UA_NODECLASS_METHOD, requestedNewNodeId, parentNodeId, referenceTypeId,
  663. browseName, UA_NODEID_NULL, (const UA_NodeAttributes *)&attr,
  664. &UA_TYPES[UA_TYPES_METHODATTRIBUTES], outNewNodeId,
  665. (UA_ClientAsyncServiceCallback)callback, userdata, reqId);
  666. }
  667. /**
  668. * Misc Functionalities
  669. * ^^^^^^^^^^^^^^^^^^^^ */
  670. UA_StatusCode UA_EXPORT
  671. __UA_Client_translateBrowsePathsToNodeIds_async(UA_Client *client, char *paths[],
  672. UA_UInt32 ids[], size_t pathSize,
  673. UA_ClientAsyncServiceCallback callback,
  674. void *userdata, UA_UInt32 *reqId);
  675. typedef void (*UA_ClientAsyncTranslateCallback)(
  676. UA_Client *client, void *userdata, UA_UInt32 requestId,
  677. UA_TranslateBrowsePathsToNodeIdsResponse *tr);
  678. static UA_INLINE UA_StatusCode
  679. UA_Cient_translateBrowsePathsToNodeIds_async(UA_Client *client, char **paths,
  680. UA_UInt32 *ids, size_t pathSize,
  681. UA_ClientAsyncTranslateCallback callback,
  682. void *userdata, UA_UInt32 *reqId) {
  683. return __UA_Client_translateBrowsePathsToNodeIds_async(
  684. client, paths, ids, pathSize, (UA_ClientAsyncServiceCallback)callback, userdata,
  685. reqId);
  686. }
  687. _UA_END_DECLS
  688. #endif /* UA_CLIENT_HIGHLEVEL_ASYNC_H_ */