Magnavox Daemon

From Wildsong
Jump to navigationJump to search

Status

Brian Wilson 10:14, 29 April 2006 (PDT) The data collector is running. It's storing data to the RRD files. Working on the display module next.

Overview

Basically a continuous stream of data comes in from the receiver at 9600 bps. It is in ASCII text. A line starts with a [[NMEA] message code and ends with a newline.

With my simple CGI program, to get a full set of readings, it has to connect and listen until enough data has gone by. This takes around 10 seconds.

The idea of the daemon is to listen all the time and keep an updated set of readings in memory. When a client asks for the data it just dumps it all out at once.

So there are two parts to code up. The data collector and the network server.

Data collector

This program runs all the time. Instead of collecting data and exiting, each time it gets a new reading it just holds it in a table. When enough data has been collected, a 'data good' flag is set. From then on, whenever a network request comes in, it just sends out the most recent data set. A debug flag can be set that will spew data to the console as it is collected.

Once every 5 minutes, the data collector writes to the RRD databases, so that output can be graphed.

Network server

I am thinking of using Medusa for the network server portion; I briefly considered Twisted but it seems like 100 times more than I need right now.

Even asyncore might be enough.