Server wrapper: callback set with SOPC_HelperConfigServer_SetWriteNotifCallback is never called
Description
When using the server wrapper API (server_wrapper/libs2opc_server_config.h
) and setting a write notification callback using SOPC_HelperConfigServer_SetWriteNotifCallback
, the callback is never called even in case of write operation in the server.
Workaround
In order to have access to the write notification callback when using the server wrapper API, it is possible to use the following workaround when using code revision not containing this fix.
In the module which was calling SOPC_HelperConfigServer_SetWriteNotifCallback(<writeNotifCB>)
:
- Add
#include "sopc_toolkit_config.h"
- Define a static function as follow:
static void AddressSpaceNotifCB(SOPC_App_AddSpace_Event event, void* opParam, SOPC_StatusCode opStatus)
{
if (AS_WRITE_EVENT != event)
{
return;
}
<writeNotifCB>((OpcUa_WriteValue*) opParam, opStatus);
}
- Replace call to
SOPC_HelperConfigServer_SetWriteNotifCallback(<writeNotifCB>)
by:
SOPC_ToolkitServer_SetAddressSpaceNotifCb(AddressSpaceNotifCB)