Main Site Documentation

Db?


#1

I’ve found that SqlLite database is not supported on Panda II, is this right?

So what is the best and simpler way I can use to create a log-cache on SD to archive data readed from sensors before I will upload then using HTTP? Multithreaded: one thread will write data, one other thread will read from cache and upload data.

thanks!


#2

Probably something very simple like a CSV file is your best bet. If you need something more complex, you could do it with XML, but that’s generally not necessary for something like a data logger.


#3

You’re pretty much on your own. I developed my own (tiny) DBMS based on ISAM principles using the Filestream class.

If all you are doing is writing out log files, then just roll your own CSV logger. To avoid contention between the logging and uploading threads, I suggest end your file at a certain record count and start a fresh one. Use a file naming convention to handle the states… e.g. Data.1.New, Data.2.New, Data.1.Transfer, Data.1.Done .

The logger writes out .New files and the upload thread looks for .Transfer files and renames them when done (or retries if there are problems).

Abusing the FAT filesystem can give you some pseudo-DB like behaviour.


#4

How are SD’s nowadays.
Still have to worry about writing on the same spot increasing the change of failure or is it a thing of the past.
I have on my pc several processes running with a file naming scheme as realiser posted and would like to port them over to a fez board with sd as storage.


#5

Thanks, I think I’ll write a class that manage text files with some roll logic to permit the upload process to access and then delete uploaded data.

I was looking for some open souce ready, just to not reinvente the wheel, but it seems that all code is really too complex for my goal (and for a Panda). Does someone know some interesting project?

thanks


#6

At least some SD cards have wear leveling in them. I would expect it’s fairly common, but I have no specific information to back up that assumption.