ua_client.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #ifndef UA_CLIENT_H_
  2. #define UA_CLIENT_H_
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include "ua_config.h"
  7. #include "ua_types.h"
  8. #include "ua_connection.h"
  9. #include "ua_log.h"
  10. #include "ua_types_generated.h"
  11. struct UA_Client;
  12. typedef struct UA_Client UA_Client;
  13. /**
  14. * The client networklayer is defined by a single function that fills a UA_Connection struct after
  15. * successfully connecting.
  16. */
  17. typedef UA_Connection (*UA_ConnectClientConnection)(UA_ConnectionConfig localConf, char *endpointUrl,
  18. UA_Logger logger);
  19. typedef struct UA_ClientConfig {
  20. UA_Int32 timeout; //sync response timeout
  21. UA_Int32 secureChannelLifeTime; // lifetime in ms (then the channel needs to be renewed)
  22. UA_Int32 timeToRenewSecureChannel; //time in ms before expiration to renew the secure channel
  23. UA_ConnectionConfig localConnectionConfig;
  24. } UA_ClientConfig;
  25. extern UA_EXPORT const UA_ClientConfig UA_ClientConfig_standard;
  26. UA_Client UA_EXPORT * UA_Client_new(UA_ClientConfig config, UA_Logger logger);
  27. UA_EXPORT void UA_Client_reset(UA_Client* client);
  28. UA_EXPORT void UA_Client_init(UA_Client* client, UA_ClientConfig config, UA_Logger logger);
  29. UA_EXPORT void UA_Client_deleteMembers(UA_Client* client);
  30. UA_EXPORT void UA_Client_delete(UA_Client* client);
  31. UA_StatusCode UA_EXPORT UA_Client_connect(UA_Client *client, UA_ConnectClientConnection connFunc, char *endpointUrl);
  32. UA_StatusCode UA_EXPORT UA_Client_disconnect(UA_Client *client);
  33. UA_StatusCode UA_EXPORT UA_Client_renewSecureChannel(UA_Client *client);
  34. /* Attribute Service Set */
  35. UA_ReadResponse UA_EXPORT UA_Client_read(UA_Client *client, UA_ReadRequest *request);
  36. UA_WriteResponse UA_EXPORT UA_Client_write(UA_Client *client, UA_WriteRequest *request);
  37. /* View Service Set */
  38. UA_BrowseResponse UA_EXPORT UA_Client_browse(UA_Client *client, UA_BrowseRequest *request);
  39. UA_BrowseNextResponse UA_EXPORT UA_Client_browseNext(UA_Client *client, UA_BrowseNextRequest *request);
  40. UA_TranslateBrowsePathsToNodeIdsResponse UA_EXPORT
  41. UA_Client_translateTranslateBrowsePathsToNodeIds(UA_Client *client,
  42. UA_TranslateBrowsePathsToNodeIdsRequest *request);
  43. /**
  44. * Get the namespace-index of a namespace-URI
  45. *
  46. * @param client The UA_Client struct for this connection
  47. * @param namespaceUri The interested namespace URI
  48. * @param namespaceIndex The namespace index of the URI. The value is unchanged in case of an error
  49. * @return Indicates whether the operation succeeded or returns an error code
  50. */
  51. UA_StatusCode UA_EXPORT UA_Client_NamespaceGetIndex(UA_Client *client, UA_String *namespaceUri, UA_UInt16 *namespaceIndex);
  52. /* NodeManagement Service Set */
  53. UA_AddNodesResponse UA_EXPORT UA_Client_addNodes(UA_Client *client, UA_AddNodesRequest *request);
  54. UA_AddReferencesResponse UA_EXPORT
  55. UA_Client_addReferences(UA_Client *client, UA_AddReferencesRequest *request);
  56. UA_DeleteNodesResponse UA_EXPORT UA_Client_deleteNodes(UA_Client *client, UA_DeleteNodesRequest *request);
  57. UA_DeleteReferencesResponse UA_EXPORT
  58. UA_Client_deleteReferences(UA_Client *client, UA_DeleteReferencesRequest *request);
  59. /* Client-Side Macro/Procy functions */
  60. #ifdef ENABLE_METHODCALLS
  61. UA_CallResponse UA_EXPORT UA_Client_call(UA_Client *client, UA_CallRequest *request);
  62. UA_StatusCode UA_EXPORT UA_Client_CallServerMethod(UA_Client *client, UA_NodeId objectNodeId, UA_NodeId methodNodeId,
  63. UA_Int32 inputSize, const UA_Variant *input,
  64. UA_Int32 *outputSize, UA_Variant **output);
  65. #endif
  66. UA_AddNodesResponse UA_EXPORT *UA_Client_createObjectNode( UA_Client *client, UA_ExpandedNodeId reqId, UA_QualifiedName browseName, UA_LocalizedText displayName,
  67. UA_LocalizedText description, UA_ExpandedNodeId parentNodeId, UA_NodeId referenceTypeId,
  68. UA_UInt32 userWriteMask, UA_UInt32 writeMask, UA_ExpandedNodeId typeDefinition);
  69. UA_AddNodesResponse UA_EXPORT *UA_Client_createVariableNode(UA_Client *client, UA_ExpandedNodeId reqId, UA_QualifiedName browseName, UA_LocalizedText displayName,
  70. UA_LocalizedText description, UA_ExpandedNodeId parentNodeId, UA_NodeId referenceTypeId,
  71. UA_UInt32 userWriteMask, UA_UInt32 writeMask, UA_ExpandedNodeId typeDefinition,
  72. UA_NodeId dataType, UA_Variant *value );
  73. UA_AddNodesResponse UA_EXPORT *UA_Client_createReferenceTypeNode(UA_Client *client, UA_ExpandedNodeId reqId, UA_QualifiedName browseName, UA_LocalizedText displayName,
  74. UA_LocalizedText description, UA_ExpandedNodeId parentNodeId, UA_NodeId referenceTypeId,
  75. UA_UInt32 userWriteMask, UA_UInt32 writeMask, UA_ExpandedNodeId typeDefinition,
  76. UA_LocalizedText inverseName );
  77. UA_AddNodesResponse UA_EXPORT *UA_Client_createObjectTypeNode(UA_Client *client, UA_ExpandedNodeId reqId, UA_QualifiedName browseName, UA_LocalizedText displayName,
  78. UA_LocalizedText description, UA_ExpandedNodeId parentNodeId, UA_NodeId referenceTypeId,
  79. UA_UInt32 userWriteMask, UA_UInt32 writeMask, UA_ExpandedNodeId typeDefinition);
  80. #ifdef ENABLE_SUBSCRIPTIONS
  81. UA_Int32 UA_EXPORT UA_Client_newSubscription(UA_Client *client, UA_Int32 publishInterval);
  82. UA_StatusCode UA_EXPORT UA_Client_removeSubscription(UA_Client *client, UA_UInt32 subscriptionId);
  83. //void UA_EXPORT UA_Client_modifySubscription(UA_Client *client);
  84. void UA_EXPORT UA_Client_doPublish(UA_Client *client);
  85. UA_UInt32 UA_EXPORT UA_Client_monitorItemChanges(UA_Client *client, UA_UInt32 subscriptionId,
  86. UA_NodeId nodeId, UA_UInt32 attributeID,
  87. void *handlingFunction);
  88. UA_StatusCode UA_EXPORT UA_Client_unMonitorItemChanges(UA_Client *client, UA_UInt32 subscriptionId,
  89. UA_UInt32 monitoredItemId );
  90. #endif
  91. #ifdef __cplusplus
  92. } // extern "C"
  93. #endif
  94. #endif /* UA_CLIENT_H_ */