Mock sensors, SQLite and much more

Due to some classes not yet being scheduled in the first few weeks of the new semester, I’ve been able to work non-stop on my app for the past five days and the results are there to prove it this time!

As I mentioned last week, my sensor code needed some serious restructuring and, well, that’s exactly what I did. As a result of this beautiful (if I may say so myself) refactoring, it was relatively easy to add the Empatica wristband sensor to the list of connected bluetooth devices (which only included the Muse headband sensor up until that moment).

Furthermore, since properly debugging my app almost always required me to connect the Android device to both sensors first, I decided to also include a virtual sensor. The code for this mock sensor was made to have the same convenient structure as both other sensors with one important difference: a transmitter was added to the package to actually send fake data to the registered listeners. This decision to include a mock sensor has already proven to be a great one indeed, since the debugging process is now a lot less time consuming.

The last accomplishment of this week is situated in the storage package of my Android project. Up until a day ago, all sensor data were stored in the device’s internal memory in simple text files. Of course, to be able to properly conduct my experiments and analyse the corresponding results in the very near future, this simple storage strategy would not be sufficient at all. For this reason, I decided to refactor the entire data output flow and include the possibility of storing the recorded data in a structured SQLite database. The main advantage of the latter storage technique, compared to the file system approach, is of course the simplicity of retrieving data in a structured way.

Although I’m really proud of myself for implementing these features (and yes, you should be too), there are still a few ideas that linger in my head and that I would like to have implemented by the end of next week. The most important one of those ideas is of course the emotion feedback wheel I already talked about in one of my previous posts (credits to Katrien and Karsten for the idea). Another feature I’m thinking of is the possibility to feed existing sensor data from the SQLite database to the mock sensor for quick visualization. In order to make this work, the database would have to be refactored too, so that would be the next logical step right now. See you next week!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s