#VSCP HOWTO: DM write/append to file

The Level I logger and the Level II logger are great tools for logging events in a VSCP based system.  Useful also for debugging etc. Another method is to use the execute external program action and execute a script and write to a file there. We have seen this method being used in other howtos.  Also while running a JavaScript or a Lua script files can be written.

But…

file writing is also available as an action.  It is documented here. This action allows writing or appending a string with output to a named file that is created if it does not exist. With the VSCP escapes a lot of dynamic information can go into this file.

Suppose that we want to  log events of a certain type to a file, here CLASS1.DATA, Type=2 A/D values form a specific device. We then write a decision matrix (DM) row

<row enable="true" groupid="" >

<comment>
 Collect A/D values from node X
</comment>

<mask priority="0"
 class="0xFFFF"
 type="0xFFFF"
 GUID="FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF" />

<filter priority="0"
 class="15"
 type="2"
 GUID="00:01:02:03:04:05:06:07:08:09:0A:0B:0C:0D:0E:0F" />

<action>0x70</action>
 <param>
 /tmp/addata;1;%isoboth: %measurement.string %lf 
 </param>

</row>

will generate output content like this

With the other VSCP escapes and literals you have many options to generate meaningful output.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.