Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.
Ascii file source, read binary value in file
-
Hi,
I would like to read a file (on a linux filesystem) using the ASCII file data source. The file simply contains either a 0 or a 1 depending on a condition. No other characters or data are present in the file.
I can't figure out how to get the ASCII file data source to read this. It is looking at the correct file but I am not sure about what I should put in the additional settings for point identifier, value index etc. Any hints?
Cheers
Jeremy -
Oops, I meant to post this in 'User help', although this is somewhat hardware related as I am trying to access the GPIO pins on a Raspberry Pi (if successful I will post the steps here/on the wiki for others).
-
Well, after playing around with this - I (mostly) have a solution using python, but it's pretty ugly and inefficient.
I would really like it if I could read the bit directly into mango as above.Again, the file just contains a single bit; a zero or a one, which changes as the input changes.
@phildunlap, perhaps you have some idea about how to do this? -
Also looking to implement similar data points for GPIO.
I have resorted to a "grep" and using the filename as a point identifier, which is ugly in itself, but the real problem is getting the binary data ("1" or "0") to be properly read into the regex. What I seem to be getting is a 1 if the regex matches, not the actual value of the regex pattern. Are there any examples for regex patters for binary data such as the GPIO values?
Thanks in advance.
Aldo
-
This post is deleted! -
Hey guys, sorry I never saw this... I took a bit of a hiatus.
Yes you can do this with the ASCII file data source. Simply point the datasource at the file, configure a data point as follows:
Point Identifier:
Point Identifier Index: 2
Value Index: 1
Value Regex: (0|1)()So the trick here is to leave the point identifier totally empty and then capture an empty group at some point in our regex.