|
@@ -394,9 +394,15 @@ Operation_SetMonitoringMode(UA_Server *server, UA_Session *session,
|
|
|
*result = UA_STATUSCODE_BADMONITOREDITEMIDINVALID;
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ if(mon->monitoredItemType != UA_MONITOREDITEMTYPE_CHANGENOTIFY) {
|
|
|
+ *result = UA_STATUSCODE_BADNOTIMPLEMENTED;
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
/* check monitoringMode is valid or not */
|
|
|
if(smc->monitoringMode > UA_MONITORINGMODE_REPORTING) {
|
|
|
+ *result = UA_STATUSCODE_BADMONITORINGMODEINVALID;
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -406,12 +412,13 @@ Operation_SetMonitoringMode(UA_Server *server, UA_Session *session,
|
|
|
mon->monitoringMode = smc->monitoringMode;
|
|
|
if(mon->monitoringMode == UA_MONITORINGMODE_REPORTING) {
|
|
|
MonitoredItem_registerSampleCallback(server, mon);
|
|
|
- } else if (mon->monitoringMode == UA_MONITORINGMODE_DISABLED) {
|
|
|
- /* Setting the mode to DISABLED causes all queued Notifications to be delete */
|
|
|
+ } else {
|
|
|
+ // TODO correctly implement SAMPLING
|
|
|
+ /* Setting the mode to DISABLED or SAMPLING causes all queued Notifications to be delete */
|
|
|
MonitoredItem_queuedValue *val, *val_tmp;
|
|
|
TAILQ_FOREACH_SAFE(val, &mon->queue, listEntry, val_tmp) {
|
|
|
TAILQ_REMOVE(&mon->queue, val, listEntry);
|
|
|
- UA_DataValue_deleteMembers(&val->value);
|
|
|
+ UA_DataValue_deleteMembers(&val->data.value);
|
|
|
UA_free(val);
|
|
|
}
|
|
|
mon->currentQueueSize = 0;
|