ua_client.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 (*destroy)(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. /*
  24. * The client struct contains the client config as the first parameter, so it can be successfully cast to UA_ClientConfig
  25. */
  26. struct UA_Client_private;
  27. typedef struct UA_Client_private UA_Client_private;
  28. typedef struct UA_ClientConfig {
  29. UA_Int32 timeout; //sync resonse timeout
  30. } UA_ClientConfig;
  31. typedef struct UA_Client {
  32. UA_ClientConfig config;
  33. } UA_Client;
  34. UA_Client UA_EXPORT * UA_Client_new(void);
  35. void UA_Client_delete(UA_Client* client);
  36. UA_StatusCode UA_EXPORT UA_Client_connect(UA_Client *client, UA_ConnectionConfig conf,
  37. UA_ClientNetworkLayer networkLayer, char *endpointUrl);
  38. UA_StatusCode UA_EXPORT UA_Client_disconnect(UA_Client *client);
  39. /* Attribute Service Set */
  40. UA_ReadResponse UA_EXPORT UA_Client_read(UA_Client *client, UA_ReadRequest *request);
  41. UA_WriteResponse UA_EXPORT UA_Client_write(UA_Client *client, UA_WriteRequest *request);
  42. /* View Service Set */
  43. UA_BrowseResponse UA_EXPORT UA_Client_browse(UA_Client *client, UA_BrowseRequest *request);
  44. UA_TranslateBrowsePathsToNodeIdsResponse UA_EXPORT
  45. UA_Client_translateTranslateBrowsePathsToNodeIds(UA_Client *client,
  46. UA_TranslateBrowsePathsToNodeIdsRequest *request);
  47. /* NodeManagement Service Set */
  48. UA_AddNodesResponse UA_EXPORT UA_Client_addNodes(UA_Client *client, UA_AddNodesRequest *request);
  49. UA_AddReferencesResponse UA_EXPORT
  50. UA_Client_addReferences(UA_Client *client, UA_AddReferencesRequest *request);
  51. UA_DeleteNodesResponse UA_EXPORT UA_Client_deleteNodes(UA_Client *client, UA_DeleteNodesRequest *request);
  52. UA_DeleteReferencesResponse UA_EXPORT
  53. UA_Client_deleteReferences(UA_Client *client, UA_DeleteReferencesRequest *request);
  54. #ifdef __cplusplus
  55. } // extern "C"
  56. #endif
  57. #endif /* UA_CLIENT_H_ */