Also add client to monitoredEvent callback

This commit is contained in:
Stefan Profanter 2018-02-05 17:32:03 +01:00 committed by Stefan Profanter
parent 65db398dcb
commit 3af3d9d969
4 changed files with 18 additions and 3 deletions

View File

@ -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

View File

@ -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");

View File

@ -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);

View File

@ -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);
}
}