open62541 1.3.12
Open source implementation of OPC UA
Loading...
Searching...
No Matches
client_subscriptions.h
Go to the documentation of this file.
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#ifndef UA_CLIENT_SUBSCRIPTIONS_H_
6#define UA_CLIENT_SUBSCRIPTIONS_H_
7
8#include <open62541/client.h>
9
11
12#ifdef UA_ENABLE_SUBSCRIPTIONS
13
14
15
16/** Callbacks defined for Subscriptions */
18 (UA_Client *client, UA_UInt32 subId, void *subContext);
19
21 (UA_Client *client, UA_UInt32 subId, void *subContext,
22 UA_StatusChangeNotification *notification);
23
24/** Provides default values for a new subscription.
25 *
26 * RequestedPublishingInterval: 500.0 [ms]
27 * RequestedLifetimeCount: 10000
28 * RequestedMaxKeepAliveCount: 10
29 * MaxNotificationsPerPublish: 0 (unlimited)
30 * PublishingEnabled: true
31 * Priority: 0 */
33UA_CreateSubscriptionRequest_default(void) {
35 UA_CreateSubscriptionRequest_init(&request);
36
37 request.requestedPublishingInterval = 500.0;
38 request.requestedLifetimeCount = 10000;
39 request.requestedMaxKeepAliveCount = 10;
41 request.publishingEnabled = true;
42 request.priority = 0;
43 return request;
44}
45
48 const UA_CreateSubscriptionRequest request,
49 void *subscriptionContext,
52
55 const UA_CreateSubscriptionRequest request,
56 void *subscriptionContext,
60 void *userdata, UA_UInt32 *requestId);
61
64 const UA_ModifySubscriptionRequest request);
65
68 const UA_ModifySubscriptionRequest request,
70 void *userdata, UA_UInt32 *requestId);
71
74 const UA_DeleteSubscriptionsRequest request);
75
80 void *userdata, UA_UInt32 *requestId);
81
82/** Delete a single subscription */
85
87UA_Client_Subscriptions_setPublishingMode(UA_Client *client,
88 const UA_SetPublishingModeRequest request) {
93 return response;
94}
95
96
97
98/** Provides default values for a new monitored item. */
100UA_MonitoredItemCreateRequest_default(UA_NodeId nodeId) {
102 UA_MonitoredItemCreateRequest_init(&request);
103 request.itemToMonitor.nodeId = nodeId;
107 request.requestedParameters.discardOldest = true;
108 request.requestedParameters.queueSize = 1;
109 return request;
110}
111
112
113
114/** Callback for the deletion of a MonitoredItem */
116 (UA_Client *client, UA_UInt32 subId, void *subContext,
117 UA_UInt32 monId, void *monContext);
118
119/** Callback for DataChange notifications */
121 (UA_Client *client, UA_UInt32 subId, void *subContext,
122 UA_UInt32 monId, void *monContext,
123 UA_DataValue *value);
124
125/** Callback for Event notifications */
127 (UA_Client *client, UA_UInt32 subId, void *subContext,
128 UA_UInt32 monId, void *monContext,
129 size_t nEventFields, UA_Variant *eventFields);
130
131/** Don't use to monitor the EventNotifier attribute */
134 const UA_CreateMonitoredItemsRequest request, void **contexts,
137
140 const UA_CreateMonitoredItemsRequest request, void **contexts,
143 UA_ClientAsyncServiceCallback createCallback,
144 void *userdata, UA_UInt32 *requestId);
145
148 UA_UInt32 subscriptionId,
149 UA_TimestampsToReturn timestampsToReturn,
151 void *context, UA_Client_DataChangeNotificationCallback callback,
153
154/** Monitor the EventNotifier attribute only */
157 const UA_CreateMonitoredItemsRequest request, void **contexts,
160
161/** Monitor the EventNotifier attribute only */
164 const UA_CreateMonitoredItemsRequest request, void **contexts,
167 UA_ClientAsyncServiceCallback createCallback,
168 void *userdata, UA_UInt32 *requestId);
169
172 UA_UInt32 subscriptionId,
173 UA_TimestampsToReturn timestampsToReturn,
175 void *context, UA_Client_EventNotificationCallback callback,
177
181
184 const UA_DeleteMonitoredItemsRequest request,
186 void *userdata, UA_UInt32 *requestId);
187
190 UA_UInt32 subscriptionId, UA_UInt32 monitoredItemId);
191
192/** The clientHandle parameter will be filled automatically */
195 const UA_ModifyMonitoredItemsRequest request);
196
197
198
200UA_Client_MonitoredItems_setMonitoringMode(UA_Client *client,
201 const UA_SetMonitoringModeRequest request) {
203 __UA_Client_Service(client,
206 return response;
207}
208
210UA_Client_MonitoredItems_setTriggering(UA_Client *client,
211 const UA_SetTriggeringRequest request) {
213 __UA_Client_Service(client,
216 return response;
217}
218
219static UA_StatusCode
220UA_Client_MonitoredItems_modify_async(UA_Client *client,
221 const UA_ModifyMonitoredItemsRequest request,
223 void *userdata, UA_UInt32 *requestId) {
224 return __UA_Client_AsyncService(client, &request,
227 userdata, requestId);
228}
229
230static UA_StatusCode
231UA_Client_MonitoredItems_setMonitoringMode_async(UA_Client *client,
232 const UA_SetMonitoringModeRequest request,
234 void *userdata, UA_UInt32 *requestId) {
235 return __UA_Client_AsyncService(client, &request,
238 userdata, requestId);
239}
240
241static UA_StatusCode
242UA_Client_MonitoredItems_setTriggering_async(UA_Client *client,
243 const UA_SetTriggeringRequest request,
245 void *userdata, UA_UInt32 *requestId) {
246 return __UA_Client_AsyncService(client, &request,
249 userdata, requestId);
250}
251
252#endif
253
255
256#endif /* UA_CLIENT_SUBSCRIPTIONS_H_ */
void(* UA_ClientAsyncServiceCallback)(UA_Client *client, void *userdata, UA_UInt32 requestId, void *response)
Use the type versions of this method.
Definition client.h:486
void __UA_Client_Service(UA_Client *client, const void *request, const UA_DataType *requestType, void *response, const UA_DataType *responseType)
Don't use this function.
UA_StatusCode __UA_Client_AsyncService(UA_Client *client, const void *request, const UA_DataType *requestType, UA_ClientAsyncServiceCallback callback, const UA_DataType *responseType, void *userdata, UA_UInt32 *requestId)
UA_StatusCode UA_Client_Subscriptions_create_async(UA_Client *client, const UA_CreateSubscriptionRequest request, void *subscriptionContext, UA_Client_StatusChangeNotificationCallback statusChangeCallback, UA_Client_DeleteSubscriptionCallback deleteCallback, UA_ClientAsyncServiceCallback callback, void *userdata, UA_UInt32 *requestId)
UA_MonitoredItemCreateResult UA_Client_MonitoredItems_createEvent(UA_Client *client, UA_UInt32 subscriptionId, UA_TimestampsToReturn timestampsToReturn, const UA_MonitoredItemCreateRequest item, void *context, UA_Client_EventNotificationCallback callback, UA_Client_DeleteMonitoredItemCallback deleteCallback)
UA_StatusCode UA_Client_Subscriptions_deleteSingle(UA_Client *client, UA_UInt32 subscriptionId)
Delete a single subscription.
void(* UA_Client_EventNotificationCallback)(UA_Client *client, UA_UInt32 subId, void *subContext, UA_UInt32 monId, void *monContext, size_t nEventFields, UA_Variant *eventFields)
Callback for Event notifications.
void(* UA_Client_DeleteMonitoredItemCallback)(UA_Client *client, UA_UInt32 subId, void *subContext, UA_UInt32 monId, void *monContext)
Callback for the deletion of a MonitoredItem.
UA_DeleteSubscriptionsResponse UA_Client_Subscriptions_delete(UA_Client *client, const UA_DeleteSubscriptionsRequest request)
UA_StatusCode UA_Client_MonitoredItems_createEvents_async(UA_Client *client, const UA_CreateMonitoredItemsRequest request, void **contexts, UA_Client_EventNotificationCallback *callbacks, UA_Client_DeleteMonitoredItemCallback *deleteCallbacks, UA_ClientAsyncServiceCallback createCallback, void *userdata, UA_UInt32 *requestId)
Monitor the EventNotifier attribute only.
void(* UA_Client_StatusChangeNotificationCallback)(UA_Client *client, UA_UInt32 subId, void *subContext, UA_StatusChangeNotification *notification)
_UA_BEGIN_DECLS typedef void(* UA_Client_DeleteSubscriptionCallback)(UA_Client *client, UA_UInt32 subId, void *subContext)
This Source Code Form is subject to the terms of the Mozilla Public License, v.
UA_ModifyMonitoredItemsResponse UA_Client_MonitoredItems_modify(UA_Client *client, const UA_ModifyMonitoredItemsRequest request)
The clientHandle parameter will be filled automatically.
void(* UA_Client_DataChangeNotificationCallback)(UA_Client *client, UA_UInt32 subId, void *subContext, UA_UInt32 monId, void *monContext, UA_DataValue *value)
Callback for DataChange notifications.
UA_StatusCode UA_Client_MonitoredItems_delete_async(UA_Client *client, const UA_DeleteMonitoredItemsRequest request, UA_ClientAsyncServiceCallback callback, void *userdata, UA_UInt32 *requestId)
UA_ModifySubscriptionResponse UA_Client_Subscriptions_modify(UA_Client *client, const UA_ModifySubscriptionRequest request)
UA_StatusCode UA_Client_Subscriptions_delete_async(UA_Client *client, const UA_DeleteSubscriptionsRequest request, UA_ClientAsyncServiceCallback callback, void *userdata, UA_UInt32 *requestId)
UA_CreateMonitoredItemsResponse UA_Client_MonitoredItems_createDataChanges(UA_Client *client, const UA_CreateMonitoredItemsRequest request, void **contexts, UA_Client_DataChangeNotificationCallback *callbacks, UA_Client_DeleteMonitoredItemCallback *deleteCallbacks)
Don't use to monitor the EventNotifier attribute.
UA_CreateMonitoredItemsResponse UA_Client_MonitoredItems_createEvents(UA_Client *client, const UA_CreateMonitoredItemsRequest request, void **contexts, UA_Client_EventNotificationCallback *callback, UA_Client_DeleteMonitoredItemCallback *deleteCallback)
Monitor the EventNotifier attribute only.
UA_CreateSubscriptionResponse UA_Client_Subscriptions_create(UA_Client *client, const UA_CreateSubscriptionRequest request, void *subscriptionContext, UA_Client_StatusChangeNotificationCallback statusChangeCallback, UA_Client_DeleteSubscriptionCallback deleteCallback)
UA_DeleteMonitoredItemsResponse UA_Client_MonitoredItems_delete(UA_Client *client, const UA_DeleteMonitoredItemsRequest)
UA_StatusCode UA_Client_MonitoredItems_deleteSingle(UA_Client *client, UA_UInt32 subscriptionId, UA_UInt32 monitoredItemId)
UA_StatusCode UA_Client_MonitoredItems_createDataChanges_async(UA_Client *client, const UA_CreateMonitoredItemsRequest request, void **contexts, UA_Client_DataChangeNotificationCallback *callbacks, UA_Client_DeleteMonitoredItemCallback *deleteCallbacks, UA_ClientAsyncServiceCallback createCallback, void *userdata, UA_UInt32 *requestId)
UA_MonitoredItemCreateResult UA_Client_MonitoredItems_createDataChange(UA_Client *client, UA_UInt32 subscriptionId, UA_TimestampsToReturn timestampsToReturn, const UA_MonitoredItemCreateRequest item, void *context, UA_Client_DataChangeNotificationCallback callback, UA_Client_DeleteMonitoredItemCallback deleteCallback)
UA_StatusCode UA_Client_Subscriptions_modify_async(UA_Client *client, const UA_ModifySubscriptionRequest request, UA_ClientAsyncServiceCallback callback, void *userdata, UA_UInt32 *requestId)
@ UA_ATTRIBUTEID_VALUE
Definition common.h:34
#define _UA_BEGIN_DECLS
#undef UA_DEBUG_DUMP_PKGS
Definition config.h:89
#define _UA_END_DECLS
Definition config.h:96
UA_MonitoringParameters requestedParameters
uint32_t UA_UInt32
Definition types.h:56
uint32_t UA_StatusCode
Definition types.h:77
#define UA_TYPES_SETTRIGGERINGRESPONSE
#define UA_TYPES_MODIFYMONITOREDITEMSREQUEST
#define UA_TYPES_MODIFYMONITOREDITEMSRESPONSE
#define UA_TYPES_SETTRIGGERINGREQUEST
UA_TimestampsToReturn
const UA_DataType UA_TYPES[191]
#define UA_TYPES_SETMONITORINGMODEREQUEST
#define UA_TYPES_SETPUBLISHINGMODERESPONSE
#define UA_TYPES_SETMONITORINGMODERESPONSE
@ UA_MONITORINGMODE_REPORTING
#define UA_TYPES_SETPUBLISHINGMODEREQUEST