Cumulocity find all pending operations for tracker -


i' writing parser particular acknowledgement message in tracker-agent. when parsed, retrieve pending commands/firmware updates tracker can compare them content of acknowledgement , update relevant operation display accordingly in cumulocity.

how can that? example, maybe use operationshelper.getoperationsbystatusandagent() ? how have access operationshelper @ level?

edit

here i'm going try now:

trackerdevice:

public iterable<operationrepresentation> getpendingops() {     operationfilter opsfilter = new operationfilter().bystatus(operationstatus.pending)             .byagent(this.gid.getvalue());     return devicecontrol.getoperationsbyfilter(opsfilter).get().allpages(); } 

my custom parser:

trackerdevice trackerdevice = trackeragent.getorcreatetrackerdevice(reportctx.getentry(pos_imei)); // looking pending operations... (operationrepresentation operation: trackerdevice.getpendingops()) {     firmware frm = operation.get(firmware.class);     // ...for firmware updates     if (frm != null) {         string command = (string) frm.getproperty("command");          // (gl200fallback associated command string these)         if (command != null) {             matcher m = commandpattern.matcher(command);              // in each command there random count number...             if (m.find()) {                 string cmdcountnumber = command.substring(m.start(), m.end());                  // ...that must match acknowledgement's                 if (cmdcountnumber.equals(reportctx.getentry(pos_count_number))) {                     trackerdevice.setoperationsuccessful(operation);                     return true;                 }             }         }     } } 

the getoperationsbystatusandagent() function operations tracker devices. not want.

if check startpolling() method in operationdispatcher see agent automatically polls operations each tracker. should triggered automatically whenever new device connects or when start agent (then start polling registered devices).

you don't need handle new tracker protocol. need add classes protocol implement translator interface. these triggered whenever agent receives new operation device.

edit:

if want update operation after device answered there multiple ways it. first of use devicecontrolapi trackerdevice interact operations. not exposed within trackerdevice change that.

to update operation later need id of operation. can either cache operation e.g. in device object after send device or need query e.g. status , fragmenttype


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -