|
@@ -57,20 +57,26 @@ int main(int argc, char *argv[]) {
|
|
|
UA_BrowseRequest_deleteMembers(&bReq);
|
|
|
UA_BrowseResponse_deleteMembers(&bResp);
|
|
|
|
|
|
-
|
|
|
+#ifdef ENABLE_SUBSCRIPTIONS
|
|
|
+
|
|
|
UA_Int32 subId = UA_Client_newSubscription(client, 0);
|
|
|
if (subId)
|
|
|
printf("Create subscription succeeded, id %u\n", subId);
|
|
|
|
|
|
-
|
|
|
+
|
|
|
UA_NodeId monitorThis;
|
|
|
monitorThis = UA_NODEID_STRING_ALLOC(1, "the.answer");
|
|
|
UA_UInt32 monId = UA_Client_monitorItemChanges(client, subId, monitorThis, UA_ATTRIBUTEID_VALUE, &handler_TheAnswerChanged );
|
|
|
if (monId)
|
|
|
printf("Monitoring 'the.answer', id %u\n", subId);
|
|
|
UA_NodeId_deleteMembers(&monitorThis);
|
|
|
+
|
|
|
+
|
|
|
UA_Client_doPublish(client);
|
|
|
+
|
|
|
+
|
|
|
UA_Client_doPublish(client);
|
|
|
+#endif
|
|
|
|
|
|
UA_Int32 value = 0;
|
|
|
|
|
@@ -114,12 +120,15 @@ int main(int argc, char *argv[]) {
|
|
|
|
|
|
UA_WriteRequest_deleteMembers(&wReq);
|
|
|
UA_WriteResponse_deleteMembers(&wResp);
|
|
|
-
|
|
|
+
|
|
|
+#ifdef ENABLE_SUBSCRIPTIONS
|
|
|
+
|
|
|
UA_Client_doPublish(client);
|
|
|
|
|
|
|
|
|
if(!UA_Client_removeSubscription(client, subId))
|
|
|
printf("Subscription removed\n");
|
|
|
+#endif
|
|
|
|
|
|
UA_Client_disconnect(client);
|
|
|
UA_Client_delete(client);
|