LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Analyse of logs of a serial device (yacc/bison/flex..) (https://www.linuxquestions.org/questions/programming-9/analyse-of-logs-of-a-serial-device-yacc-bison-flex-456900/)

fUNkYbOOStER 06-21-2006 07:41 AM

Analyse of logs of a serial device (yacc/bison/flex..)
 
Hi all

I would like to interpret data streams (logs) comming from a serial device (in my case).

The device is sending informations like following:

[..]
Temperatures: 12 12 13 15 19 30 30 30
Digital Inputs: 0 1 1 1 0 1 0 0 0 1
Temperature Sensor 3 missing
Temperatures: 12 12 13 15 19 30 30 30
Digital Inputs: 0 1 1 1 0 1 0 0 0 1
Temperatures: 12 12 13 15 19 31 30 30
Temperature Sensor 4 reached limit
Turning off heater 4
Digital Inputs: 0 1 1 1 0 1 0 1 0 1
[..]

Some of the messages appears periodicalliy (all x msec) and others appear only in case of an event.

My first idea was to write a C application writing the data stream into a buffer, splits into lines, searches for key words like 'Temperatures:' and takes the values (each value is the temperature of a sensor, 8 sensors here in) and put them into a variable for displaying them on a GUI.
Sometimes lines are incomplete because of limitations of the device attached to the searial port, e.g. 'Temperatures: 12 12 13 1'. This messages I don't want to interpret, because only 3 temperatures are shown.

Of course I could write such a program but I think I'm not the first and not the last one writing such an application. Someone did it before. So searched for libraries/tools doing the interpreter job.

I found (f)lex, yacc or bison. It might be that these tools are helpful to solve my problem efficent. What do you think? How would you do that? Which do you prefer?

Thanks in advance,

fb


All times are GMT -5. The time now is 03:56 AM.