ua_client.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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_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)(char *endpointUrl, UA_Logger *logger);
  18. typedef struct UA_ClientConfig {
  19. UA_Int32 timeout; //sync response timeout
  20. UA_Int32 secureChannelLifeTime; // lifetime in ms (then the channel needs to be renewed)
  21. UA_Int32 timeToRenewSecureChannel; //time in ms before expiration to renew the secure channel
  22. UA_ConnectionConfig localConnectionConfig;
  23. } UA_ClientConfig;
  24. extern UA_EXPORT const UA_ClientConfig UA_ClientConfig_standard;
  25. UA_Client UA_EXPORT * UA_Client_new(UA_ClientConfig config, UA_Logger logger);
  26. UA_EXPORT void UA_Client_delete(UA_Client* client);
  27. UA_StatusCode UA_EXPORT UA_Client_connect(UA_Client *client, UA_ConnectClientConnection connFunc, char *endpointUrl);
  28. UA_StatusCode UA_EXPORT UA_Client_disconnect(UA_Client *client);
  29. UA_StatusCode UA_EXPORT UA_Client_renewSecureChannel(UA_Client *client);
  30. /* Attribute Service Set */
  31. UA_ReadResponse UA_EXPORT UA_Client_read(UA_Client *client, UA_ReadRequest *request);
  32. UA_WriteResponse UA_EXPORT UA_Client_write(UA_Client *client, UA_WriteRequest *request);
  33. /* View Service Set */
  34. UA_BrowseResponse UA_EXPORT UA_Client_browse(UA_Client *client, UA_BrowseRequest *request);
  35. UA_BrowseNextResponse UA_EXPORT UA_Client_browseNext(UA_Client *client, UA_BrowseNextRequest *request);
  36. UA_TranslateBrowsePathsToNodeIdsResponse UA_EXPORT
  37. UA_Client_translateTranslateBrowsePathsToNodeIds(UA_Client *client,
  38. UA_TranslateBrowsePathsToNodeIdsRequest *request);
  39. /* NodeManagement Service Set */
  40. UA_AddNodesResponse UA_EXPORT UA_Client_addNodes(UA_Client *client, UA_AddNodesRequest *request);
  41. UA_AddReferencesResponse UA_EXPORT
  42. UA_Client_addReferences(UA_Client *client, UA_AddReferencesRequest *request);
  43. UA_DeleteNodesResponse UA_EXPORT UA_Client_deleteNodes(UA_Client *client, UA_DeleteNodesRequest *request);
  44. UA_DeleteReferencesResponse UA_EXPORT
  45. UA_Client_deleteReferences(UA_Client *client, UA_DeleteReferencesRequest *request);
  46. #ifdef __cplusplus
  47. } // extern "C"
  48. #endif
  49. #ifdef ENABLE_SUBSCRIPTIONS
  50. typedef struct UA_Client_MonitoredItem_s {
  51. UA_UInt32 ItemId;
  52. UA_UInt32 TimestampsToReturn;
  53. UA_UInt32 MonitoringMode;
  54. UA_NodeId monitoredNodeId;
  55. UA_UInt32 AttributeID;
  56. UA_UInt32 ClientHandle;
  57. UA_UInt32 SamplingInterval;
  58. UA_UInt32 QueueSize;
  59. UA_Boolean DiscardOldest;
  60. LIST_ENTRY(UA_Client_MonitoredItem_s) listEntry;
  61. } UA_Client_MonitoredItem;
  62. typedef struct UA_Client_Subscription_s {
  63. UA_UInt32 LifeTime;
  64. UA_Int32 KeepAliveCount;
  65. UA_DateTime PublishingInterval;
  66. UA_Int32 SubscriptionID;
  67. UA_Int32 NotificationsPerPublish;
  68. UA_Boolean PublishingMode;
  69. UA_UInt32 Priority;
  70. LIST_ENTRY(UA_Client_Subscription_s) listEntry; //?
  71. LIST_HEAD(UA_ListOfUAMonitoredItems, UA_MonitoredItem_s) MonitoredItems;
  72. } UA_Client_Subscription;
  73. UA_CreateSubscriptionResponse UA_EXPORT UA_Client_createSubscription(UA_Client *client, UA_CreateSubscriptionRequest *request);
  74. UA_Int32 UA_EXPORT UA_Client_newSubscription(UA_Client *client);
  75. void UA_EXPORT UA_Client_modifySubscription(UA_Client *client);
  76. void UA_EXPORT UA_Client_addMonitoredItem(UA_Client *client);
  77. void UA_EXPORT UA_Client_publish(UA_Client *client);
  78. void UA_EXPORT UA_Client_removeMonitoredItem(UA_Client *client);
  79. void UA_EXPORT UA_Client_deleteSubscription(UA_Client *client);
  80. #endif
  81. #endif /* UA_CLIENT_H_ */