Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
///Sensor management start logging 
cmd = COMMAND({CommandExpression='startLogging("Camera1234"))'}, in)

/// change Timer period
cmd = COMMAND({commandExpression='setPeriod("MyTimer.transport", 1000.0))'}, in)

/// add query
cmd = COMMAND({CommandExpression='addQuery("data = ACCESS(...)", "PQL")'}, in)


Here is a more complex example:

Code Block
#PARSER PQL
#ADDQUERY
timer = TIMER({id = 'timer1', PERIOD = 1000, STARTTIME = 0 , SOURCE = 'source'})

filter = SELECT({PREDICATE = 'time % 2 == 0'},timer)

command = COMMAND({COMMANDEXPRESSION = 'updateTransportOption("timer1.transport","PERIOD",toString((counter()+1)*1000))'}, filter)

updateTransportOption can be used to change some options that are given for the Transport handler.

The first parameter defines the target, where to apply the method (same in other handlers). Here the part in front of the dot defines the id of the operator (here timer1) and the second part tells, that the transport handler ist the target. There is a similar function updateProtocolOption where you should use (<id>.protocol). So, timer1.transport means, that you want to access the transport handler of the operator with the id timer1.

The second parameter is the option that should be changed (here PERIOD) and the third one the new value as a string (here an increasing counter).

The commandexpression is always evaluted when an object arrives at the operator and the content of the object can be used in any parameter.

We are working on a version, that get activated with some specific punctuation.

Remark: To react on this requests, the transport handler needs to implement the optionsMapChanged(String key, String value) method. It is typically so, that the handler will not allow to change any value.