ua_services_monitoreditems.c 1.2 KB

12345678910111213141516171819202122232425262728
  1. #include "ua_services.h"
  2. #include "ua_namespace_0.h"
  3. #include "ua_statuscodes.h"
  4. void Service_CreateMonitoredItems(UA_Server *server, UA_Session *session,
  5. const UA_CreateMonitoredItemsRequest *request,
  6. UA_CreateMonitoredItemsResponse *response) {
  7. if(request->itemsToCreateSize <= 0)
  8. return;
  9. //mock up
  10. response->resultsSize = request->itemsToCreateSize;
  11. UA_Array_new((void**)&response->results, response->resultsSize, &UA_[UA_MONITOREDITEMCREATERESULT]);
  12. for(int i = 0;request->itemsToCreateSize > 0 && i < request->itemsToCreateSize;i++) {
  13. //FIXME: search the object in the namespace
  14. if(request->itemsToCreate[i].itemToMonitor.nodeId.identifier.numeric == 2253) { // server
  15. response->results[i].statusCode = UA_STATUSCODE_GOOD;
  16. response->results[i].monitoredItemId = 1;
  17. response->results[i].revisedSamplingInterval = 4294967295;
  18. response->results[i].revisedQueueSize = 0;
  19. continue;
  20. } else {
  21. // response->results[i]->statusCode = UA_STATUSCODE_BAD_NODEIDUNKNOWN;
  22. response->results[i].statusCode = -1;
  23. }
  24. }
  25. }