Skip to content

Commit

Permalink
Also add client to monitoredEvent callback
Browse files Browse the repository at this point in the history
  • Loading branch information
Pro committed Feb 5, 2018
1 parent 65db398 commit 3af3d9d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
This changelog reports changes to the public API. Internal refactorings and bug
fixes are not reported here.

2018-02-05 pro <profanter at fortiss.org>

* Also pass client to monitoredItem/Events callback

The UA_MonitoredItemHandlingFunction and UA_MonitoredEventHandlingFunction
did not include a reference to the corresponding client used for the call of
processPublishResponse.
This now also allows to get the client context within the monitored item
handling function.

The API changes are detected by the type-matching in the compiler. So there
is little risk for bugs due to unaligned implementations.

2017-09-07 jpfr <julius.pfrommer at web.de>

* Make Client Highlevel Interface consistent
Expand Down
3 changes: 2 additions & 1 deletion examples/tutorial_client_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ static void stopHandler(int sig) {
#ifdef UA_ENABLE_SUBSCRIPTIONS

static void
handler_events(const UA_UInt32 monId, const size_t nEventFields,
handler_events(UA_Client *client,
const UA_UInt32 monId, const size_t nEventFields,
const UA_Variant *eventFields, void *context) {
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_USERLAND, "Notification");

Expand Down
3 changes: 2 additions & 1 deletion include/ua_client_highlevel.h
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,8 @@ UA_Client_Subscriptions_addMonitoredItem(UA_Client *client, UA_UInt32 subscripti

/* Monitored Events have different payloads from DataChanges. So they use a
* different callback method signature. */
typedef void (*UA_MonitoredEventHandlingFunction)(const UA_UInt32 monId,
typedef void (*UA_MonitoredEventHandlingFunction)(UA_Client *client,
const UA_UInt32 monId,
const size_t nEventFields,
const UA_Variant *eventFields,
void *context);
Expand Down
2 changes: 1 addition & 1 deletion src/client/ua_client_highlevel_subscriptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ UA_Client_processPublishResponse(UA_Client *client, UA_PublishRequest *request,
continue;
}

mon->handler.eventHandler(mon->monitoredItemId, eventFieldList->eventFieldsSize,
mon->handler.eventHandler(client, mon->monitoredItemId, eventFieldList->eventFieldsSize,
eventFieldList->eventFields, mon->handlerContext);
}
}
Expand Down

0 comments on commit 3af3d9d

Please sign in to comment.