Skip to content
Michiel TJampens edited this page May 3, 2023 · 53 revisions

Welcome to the dcafs wiki!

Note: I'm still building this wiki, and it's far from complete (or in final form) as of 9 september 2021.

  • To slowly be introduced to how dcafs works, follow: Getting to know dcafs
  • To look up more in depth information on a specific topic, check the links to the right.

New Functionality

Starting from 0.10.0 I'll list new note-worthy functionality that has been added in the current major version and then integrate it in the getting to know etc. Pretty much a 'if you don't read the changelog, you should at least now about this'.

1.2.0

  • (Re)loading Taskmanager scripts now gives feedback in the telnet interface instead of only the logs.
  • Now possible to use CTRL+s in telnet to send something without eol, mainly usefull to interact with a sensor CLI. Related is that \e is replaced with \x1B or ESC.

1.1.0

  • Added the optional node 'store' to a stream, this allows for processing inside the acquire thread. This is as an alternative to the real/int/text label and some of the generic uses.
    <!-- Example -->
    <!-- Before -->
    <stream id="sbe38" type="tcp">
      <address>localhost:4001</address>
      <label>generic:sbe38</label>
    </stream>
    <rtvals>
        <group id="sbe38">
            <real name="temp" unit="°C"/> 
        </group>
    </rtvals>
    <generics>
      <generic id="sbe38" group="sbe38" delimiter=":">
          <real index="1">temp</real>
      </generic>
    </generics>
    <!-- Now -->
    <stream id="sbe38" type="tcp">
      <address>localhost:4001</address>
      <store delimiter=":"> <!-- Take the group id from the stream id, delimiter is : -->
        <ignore/> <!-- ignore the first element of the split, can be repeated -->
        <real id="temp" unit="°C"/> <!-- second element is a real -->
        <!-- don't care about any other elements -->
      </store>
    </stream>
    <!-- or -->
  <stream id="sbe38" type="tcp">
    <setup>
        <address>localhost:4001</address>  
    </setup>
    <store delimiter=":"> <!-- Take the group id from the stream id, delimiter is : -->
      <real index="1" id="temp" unit="°C"/> <!-- second element is a real, starts at 0 -->
    </store>
  </stream>
  • Now possible to add path node to a stream node, do note, this is checked when reading paths not when reading streams (for now)
    <stream id="test" type="tcp">
      <eol>crlf</eol>
      <address>localhost:4001</address>
      <!-- Option one -->
      <path>paths/rtk.xml</path>
      <!-- Option two -->
      <path import="paths/rtk.xml"/>
    </stream>

1.0.6

  • Added listreplace to allow to replace a digit at a certain position with another value.
<editor type="listreplace" index="1" delimiter="," first="1">cat,dog,horse</editor>
        <!-- index is the position of the value in the input after split on delimiter
             first means that the first element of the list corresponds to that number, default is 0
             So if the input was 'cow,chicken,3,goat' this will become 'cow,chicken,horse,goat' because horse is third
         -->

1.0.0 - 1.0.5

  • Bugfix, general cleanup releases

0.11.10

  • Simple file monitor option, xml only for now. Allows cmd's to be executed when a file was changed etc.

0.11.9

  • Initial Matrix support, can send and read messages
  • Improved modbus support
  • Interval (taskmanager) now tries to start on a clean interval (fe. 5min will actually run add the multiples of 5 in an hour etc)

0.11.8

  • When the settings.xml is bad (fe. missing > ), telnet server will now show latest 15 lines from errorlog instead of of standard welcome message
  • Added admin:errors and admin:info to get the last 30 lines from those logs

0.11.7

  • Rtvals now use real instead of double for consistency
  • Rtvals now has proper integers (used doubles till now)

0.11.4 - 0.11.6

  • Upgraded the (barebone) CLI to use serverside editing, this allows
    • Use of backspace and left/right arrowkeys to change current input
    • Use up/down to go through previous inputs

0.11.3

  • Bugfix release

0.11.2

  • Added support for GPIO pins (through diozero), can be used to trigger cmds.

0.11.1

I2C

  • Added new node 'math' to apply math operations on read data, do note that this happens before any logging. Meaning raw data will be less 'raw'.
<command id="senses" info="Read the sense of the both outputs" bits="10"> 		
	<read reg="0xE0" return="2"/> 
        <!-- Because the packs per 10bits and we read 2 bytes, from this point i0 exists -->
	<read reg="0xE2" return="2"/> 
        <!-- From this point i1 exists -->
	<math>i0=i0*62.5</math>	<!-- i0 refers to the first value read -->	
	<math>i1=i1*62.5</math> <!-- i1 refers to the second value read -->
        <math>i1=i0*256+i1</math> <!-- This is allowed to -->
</command> 
  • i2c:id replaces i2c:forward,id and also allows the use of regex.

0.11.0

FilterForward

  • New attribute ignores, the count equals the amount of false's that are ignored after a true. So if a check succeeds successive checks are allowed to fail up to the ignores count. This is mainly meant for processing files in which one line should determine if the next x lines should pass.
  • Now allows checking with mathematical functions, it needs a delimiter
  <filter type="math" delimiter=",">i1 below 50000 and i1+5 above 0</filter>
<!-- Just like all the other math functionality, count starts at 0 so i1 refers to the second element after split -->

Telnet

  • Added new command to broadcast messages telnet:broadcast,info,message besides info, warn and error are also possible. The only difference that makes is the color of the message.
  • A session can be given an id with >>id:sessionid
  • It's now possible to 'talk' to a specific session, >>talkto:sessionname, terminate this with '!!' This pretty much allows the telnet sessions to be used as a chat client.
  • It's possible to 'spy' on a session, with spy:sessionid and stop with spy:off, could come in handy for support purposes

0.10.13

Bugfixes again, and small change to doubleval node again. It's now possible to trigger on standard deviation if history is enabled: <cmd when="stdev below 0.01">dosomething</cmd>
Note that this will only start working once a full history is available (if history:10, it will wait for 10 values).

0.10.12

Mainly bugfixes, but a small change to doubleval nodes. Timekeep and history are now in a single 'options node'

<!-- To enable time keeping and a history of 10 values -->
<double id="group_name" options="time,history:10"/>
<!-- New options include:
  minmax -> store min/max value (visible in th rtvals output) usage options="minmax"
  order -> determine which position this takes in a group listing with same order beind sorted alphabetically, usage options="order:1" (default is -1),
-->

0.10.11

Another bugfix release.

Only thing changed was that paths now allow for multiple customsrc nodes.

<path id="example">
   <customsrc interval="1s">Hello World?</customsrc>
   <customsrc interval="2s">Anybody home?</customsrc>
</path>

So now this can be used to simulate a device outputting multiple lines.

0.10.10

Generics

  • Improved the gens:addblank command to set up a generic almost completely in a single command.
    For example: to create a generic with the name 'example', the delimiter ':' and process an integer on index 1 named humidty and a real on 4 named temp
    gens:addblank,example,i1humidity,r4temp,:
<generic delimiter=":" id="example" table="">
    <int index="1">humidity</int>
    <real index="4">temp</real>
</generic>

Table could already be set using gens:alter,example,table:tablename.

  • The same functionality can be used to add a generic to a path: pf:addgen,pathid:genid,subnodes,delimiter if no genid is specified, pathid is used.

Other

  • Added {D: and {F: which indicate that the double/flag can be created if not existing yet, should be usable in all places that allow {d: and {f:
    • Added change is that those will also add them to the settings.xml

0.10.9

This was mainly a bugfix release.

Telnet

  • Added broadcast functionality so someone could send a message to all open sessions, could be used for warning or ... chat client?
    • This has three options (info,warn,error) with each a distinct color (green, 'orange', red)
      Examples:
      telnet:broadcast,warn,Will shutdwown dcafs in 5 minutes! or
      telnet:broadcast,info,I know you are messing things up, please stop... telnet:broadcast,error,Make me...

TaskManager

  • New output for the telnet broadcast, fe. output="telnet:info"
  • Added tm:load,tmscript to load a script that isn't in settings.xml yet but in the default tmscripts folder. Otherwise the only option to load in an existing script was either editing the xml manually or using the tm:addblank and then replacing the file.

0.10.8

MathForward

Now supports referencing doubles ({d: or {double:) and flags ({f:, {flag:)

<!-- Before -->
<path id="example">
    <editor type="resplit">i0;{double:offset};{f:addoffset}</editor>
    <math cmd="double:update,temp,$">i0=i0+2*i1*i2</math>
</path>
<!-- Now -->
<math id="example">{d:temp}=i0+2*{d:offset}*{f:addoffset}</math>

0.10.7

Datapaths

  • Can now be reloaded with path:reload,id this will (try to) retain targets, making debugging/building them easier.

MathForward

  • Now op's use i0= instead of the index attribute (still use index for the 'special ops' like truewind,soundvelocity and salinity)
  • Added the attribute scale to immediately scale the result.
<!-- Before -->
<maths>
  <math id="test">
    <op index="0">(i0+25)/4</op>
    <op type="scale" index="0">2</op>
  </math>
  <!-- Now -->
  <math id="test">
      <op scale="2">i0=(i0+25)/4</op>
  </math>
  <!-- or Shorter -->
  <math id="test" scale="2">i0=(i0+25)/4</math>
</maths>

0.10.6

Create/Update a double

These command were restricted to simple calculations like:
doubles:new,meters,distancekm/1000

But now these can be a tad more:
doubles:new,waterdepthm,echodepth+draught/100
Or just for example:
dv:update,waterdepthfeet,(echodepth+(draught/100))*3.2808399

Realtimevalues

Added flags (which are in addition to double and text), for boolean states:

  • Can be used in formulas
  • Allows short version to use in checks flag:pumpactive or !flag:pumpactive (instead of equals 1 or equals 0)
  • Created with flags:raise,pumpactive orflags:lower,pumpactive (or set,clear instead)
  • The rtvals node now allows an extra subdivision
<rtvals>
  <!-- Used to be -->
  <double id="printer_toner"/>
  <text id="printer_motd"/>
  <double id="printer_ignoredprints"/>
  
  <!-- New option -->
  <group id="printer">
    <!-- both id and name are valid -->
    <double id="toner"/>
    <text id="motd"/>
    <double name="ignoredprints"/>
  </group>
</rtvals>

A listing of a group can be requested with ``rtvals:group,printer`

Datapaths

These can now generate a src instead of receiving data.

<path id="customexample">
  <customsrc interval="1s">Hello World! It's {double:outsidetemp}°C now.</customsrc>
</path>

The above will send to whatever requests path:customexample that sentence with the temperature filled in (if it exists ofcourse).
Interval can be freely chosen, with at least ms resolution.

Instead of such sentence, it's also possible to issue a command instead.

<path id="stupdate">
  <customsrc type="cmd" interval="10s">st</customsrc>
</path>

When using path:stupdate in telnet, you'll get the result of the st command every ten seconds.

It's possible to add other steps to the path as usual

<path id="customexample2" delimiter=",">
    <customsrc interval="1s">{double:insidetemp},{double:outsidetemp},1</customsrc>
    <math>i2=(i0+i1)/2</math>
    <editor>
      <edit type="resplit">Inside: i0°C, Outside= i1°C, Difference: i2°C</edit>
      <edit type="replace" find="ce: -">ce: </edit> <!-- ugly way to take away the sign of the difference -->
    </editor>
</path>

The datapaths manual has been adjusted accordingly.

IssuePool

0.10.5

Datapaths! This has been described on this page.

0.10.4

Up until now, the forwards didn't have access to rtvals or any other data that was not received from the src. In this release support for this was added to the editor resplit command to enable combining data.

In addition {utc} was added to add the current utc timestamp (with millis) or {utcshort} without millis.

<editor id="editor_resplit" src="raw:data">
    <edit type="resplit" delimiter=";" leftover="remove">"{utc}";i1;{rtval:pd_iout1};i3;{rttext:pd_error}</edit>
</editor>

0.10.3

Waypoints! When a GPS is connected to the device, the lat/lon updates can be used to trigger cmd's depending preset waypoints and with which bearing they are reached (default 0 to 360°). Sog (speed over ground) is used for estimating time of arrival.

    <waypoints latval="lat_rtval" lonval="lon_rtval" sogval="sog_rtval"> <!-- the id's of the rtvals that hold lat,lon,sog -->
  <waypoint id="wp_id" lat="1" lon="1" range="50"> <!-- Position and range in meters, which is the distance from which travel is checked -->
    <name>harbor</name> <!-- Optional, more readible name, otherwise id is taken -->
    <travel id="leave_harbor" dir="out" bearing="from 100 to 180"> <!-- dir or direction, out/leave or in/enter -->
      <cmd>email:send,admin,Left the harbor at {localtime},st</cmd> <!-- Email admin to inform about leaving -->
    </travel>
  </waypoint>
</waypoints>
  • The store:rtval,value command was replaced with update:rtval,value that only updates existing rtvals and create:rtval,value was added to allow for creating the rtval(s) first.

0.10.2

  • Rtvals can now also contain metadata and execute command based on their value. Other functionality:
    • store the last 100 values
    • keep timestamp of the last data
    <rtvals>
      <double id="tof_range" unit="mm" keeptime="false" >
        <name>distance</name>
        <group>laser</group>
        <cmd when="above 150">issue:start,overrange</cmd>
        <cmd when="below 100">issue:stop,overrange</cmd>
      </double>
    </rtvals>

0.10.1

User

  • TaskManager
    • Now possible to use {rtval:xxx} or {rttext:xxx} in the value of tasks
<task output="stream:device" trigger="delay:1s">sending {rtval:setp}</task>
<!-- This will send 'sending ' to the device with the current value of setp appended to it -->
  • Added attribute stoponfail to tasks, if no/false/0 this will cause the taskset not to fail on task failure

  • CommandPool

    • update:rtval,value has been improved to support math operations so update:dp1,dp1+3orupdate:dp1,dp2+3 is now possible. This can be used in tasks...
<!-- This taskset is run 4 times, and every time the setp rtval will be increased with 5 -->
<taskset id="store" info="Show usage of store" run="step" repeat="4">
    <task output="stream:device" trigger="delay:1s">out_sp_00 {rtval:setp}</task>  <!-- Send it to the device -->
    <task output="system" >update:setp,setp+5</task>	    <!-- Take a step -->
</taskset>

0.10.0

User

  • TaskManager
  • There was no way of letting a taskset wait for something, so waitfor was added. This will wait indefinitely for the req given as value to be met before going to the next step
  <waitfor interval="5s" checks="5">rtval below 10</waitfor>
<!-- Check when the waitfor is reached and then every 5 seconds till successive positive results were obtained -->
  • The default behaviour of tasks (not in a set) is that they are executed on startup if they have a trigger, this can now be prevented with the 'atstartup' attribute
<task id="sendhello" output="stream:device" atstartup="no" trigger="interval:1s">Hello World!</task>
<!-- This will only be run if the sendhello task is called directly -->
  • Other
    • Triggered commands that send an email, now support having a command as content

Developer

  • EmailWork replaced with Email fluid api
  • Datagram constructors replaced with fluid api
  • Commandable interface added to add commands to the CommandPool without extending it
  • QueryWriting interface added to write queries etc to a chosen database
Clone this wiki locally