ua_client.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef UA_CLIENT_H_
  2. #define UA_CLIENT_H_
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include "ua_util.h"
  7. #include "ua_types.h"
  8. #include "ua_connection.h"
  9. #include "ua_types_generated.h"
  10. /**
  11. * The client networklayer can handle only a single connection. The networklayer
  12. * is only concerned with getting messages to the client and receiving them.
  13. */
  14. typedef struct {
  15. void *nlHandle;
  16. UA_StatusCode (*connect)(const UA_String endpointUrl, void **resultHandle);
  17. void (*disconnect)(void *handle);
  18. void (*delete)(void *handle);
  19. UA_StatusCode (*send)(void *handle, UA_ByteStringArray gather_buf);
  20. // the response buffer exists on the heap. the size shall correspond the the connection settings
  21. UA_StatusCode (*awaitResponse)(void *handle, UA_ByteString *response, UA_UInt32 timeout);
  22. } UA_ClientNetworkLayer;
  23. struct UA_Client;
  24. typedef struct UA_Client UA_Client;
  25. UA_Client UA_EXPORT * UA_Client_new(void);
  26. void UA_Client_delete(UA_Client* client);
  27. UA_StatusCode UA_EXPORT UA_Client_connect(UA_Client *client, UA_ConnectionConfig conf,
  28. UA_ClientNetworkLayer networkLayer, char *endpointUrl);
  29. UA_StatusCode UA_EXPORT UA_Client_disconnect(UA_Client *client);
  30. /* Attribute Service Set */
  31. //TODO: had to remove const from the 2nd argument
  32. UA_StatusCode UA_EXPORT UA_Client_read(UA_Client *client, UA_ReadRequest *request, UA_ReadResponse *response);
  33. UA_StatusCode UA_EXPORT UA_Client_write(UA_Client *client, UA_WriteRequest *request, UA_WriteResponse *response);
  34. /* View Service Set */
  35. UA_StatusCode UA_EXPORT UA_Client_browse(UA_Client *client, UA_BrowseRequest *request, UA_BrowseResponse *response);
  36. UA_StatusCode UA_EXPORT UA_Client_translateBrowsePathsToNodeIds(UA_Client *client, UA_TranslateBrowsePathsToNodeIdsRequest *request, UA_TranslateBrowsePathsToNodeIdsResponse* response);
  37. /* NodeManagement Service Set */
  38. UA_StatusCode UA_EXPORT UA_Client_addNodes(UA_Client *client, UA_AddNodesRequest *request, UA_AddNodesResponse* response);
  39. UA_StatusCode UA_EXPORT UA_Client_addReferences(UA_Client *client, UA_AddReferencesRequest *request, UA_AddReferencesResponse* response);
  40. UA_StatusCode UA_EXPORT UA_Client_deleteNodes(UA_Client *client, UA_DeleteNodesRequest *request, UA_DeleteNodesResponse* response);
  41. UA_StatusCode UA_EXPORT UA_Client_deleteReferences(UA_Client *client, UA_DeleteReferencesRequest *request, UA_DeleteReferencesResponse* response);
  42. #ifdef __cplusplus
  43. } // extern "C"
  44. #endif
  45. #endif /* UA_CLIENT_H_ */