In the application I am designing, I have to communicate with a device and store a history of data readings in a database. The device is essentially a sensor that spits out numbers via the serial port. The user end of the application is a RubyOnRails interface that allows the user to view this data and configure the device.
I am wondering what kind of connection between the database and the device you could recommend for this kind of a setup.
Up to this point, I had a custom application running on a host computer (a computer with the device connected directly through a serial port) that would serve as a bridge to a MySQL database. The application would connect directly to the MySQL database and execute queries. It works fairly well, but I am not sure if this is the best solution.
The only other alternative I see is to have an intermediate application that my custom application could connect to, instead of directly going to the database. This could be a part of the main application, or something separate. Would this be a better solution?
Would you recommend another approach?
Thank you,
I have a similar structure, although I fetch my data from a Web Service. The way I organize is:
lib/imports, egDailyDataImport,DailyDataSummarize(you can organize the hierarchy and names as per your wish or willingness).raketask under a new namespace, sayimportand add it to your cron job depending frequency. Take a look at Cron in Ruby. Its helpful.This allows me to have a better control over what goes in my database.
Some questions to consider:
to populate the data?
want a little control over it or you
need to process it, like summarizing
and aggregating etc.