i use the c++ SDK an work with the Client lesson06 Code.
My Client can connect to the Server and recognize Events and show items from the Alarms&Conditions Namespace (Timestamp, message, sourceName, severity, ... )
After an Event (for example the temperature is over the max.Limit of 40 centigrade) i will use the read() function to get the other items/values from the DA Namespace.
But that doesnt work -> see my code :
Code: Select all
void SampleSubscription::newEvents(
OpcUa_UInt32 clientSubscriptionHandle, //!< [in] Client defined handle of the affected subscription
UaEventFieldLists& eventFieldList) //!< [in] List of event notifications sent by the server
{
OpcUa_UInt32 i = 0;
printf("-- Event newEvents -----------------------------------------\n");
printf("clientSubscriptionHandle %d \n", clientSubscriptionHandle);
for ( i=0; i<eventFieldList.length(); i++ )
{
UaVariant message = eventFieldList[i].EventFields[0];
UaVariant sourceName = eventFieldList[i].EventFields[1];
UaVariant severity = eventFieldList[i].EventFields[2];
UaVariant time = eventFieldList[i].EventFields[3];
UaVariant ConditionName = eventFieldList[i].EventFields[4];
printf("Event = [%d] \n Message = %s \n SourceName = %s \n Severity = %s \n Time = %s \n ConditionName = %s \n",
i,
message.toString().toUtf8(),
sourceName.toString().toUtf8(),
severity.toString().toUtf8(),
time.toString().toUtf8(),
ConditionName.toString().toUtf8());
//read values from the DA Namespace
UaStatus status;
SampleClient* pMyClient = new SampleClient();
status = pMyClient->read();
Kadir (Germany)