Friday, January 31, 2014

Mongoose and Tactonic Modifications Updated

As of today, the information provided by the modifications to Tactonic's sensor source code is available in three different formats. Mongoose was recently updated to version 5, which introduced struct mg_server to handle all server requests in place of struct mg_context. This update allows a bit more flexibility in handling user requests, or maybe just makes it simpler, and this week was spent updating existing code and making sure it worked.


This short block of code added to TactonicNums.cpp, along with a later call to <code>mg_poll_server(milliseconds_per_poll)</code> in an infinite loop, sets up a server, sets its hosting information,  and adds three request handlers that allow us to work with different URIs from within the file calling the server itself.

This is the result.

Human-Readable Data

Machine-Readable Data

Center of Pressure

These three are accessed by navigating to the server's IP and listening port while it is running.
They are, respectively
  1.  <ServerIP>:<ListeningPort>/
  2.  <ServerIP>:<ListeningPort>/data
  3. <ServerIP>:<ListeningPort>/center
As we do not have a dedicated server machine that can run the Tactonic sensors yet, I've continued testing on localhost,  but Daniel was able to connect to the server prior to these modifications, and I connected using one of the lab computers after modifying.

A significant issue so far has been response time. Requests can take up to 30 seconds to complete, and that performance is not good enough for our needs. Cesanta has given Mongoose its own threading API, so that can be implemented to make a concurrent server if necessary.
  
The updated files are zipped in Box with one big improvement: a Makefile! No longer is some huge compilation command involving no less than 7 filenames necessary!

No comments:

Post a Comment