RoseOnRails – switch to node.js !

Hellllo 🙂

A whole lot of things have been happening lately.

After having (finally!) solved the UART “problem” as explained in my previous post, we were ready to test the intellligence module. While having done so, though, we found out that there were several bugs in the database and in the code. Therefore, the game, did not fully work as we expected! Furthemore, there were problems with the BLE communication, or more precisely, BlueLib, since we see that the commands are well sent through the TCP socket to the C server but not to the devices… so it can only be BlueLib…

Yesterday, we had to make a point to Alexis & Sam about our advancement and the current state of our project. Since the intelligence module still didn’t properly work and that we had random problems with BlueLib, we couldn’t have a proper demonstration unfortunately. But the imporant hting is that Sam & Alexis advised us to use noble (node.js module for BLE central applications) instead of BlueLib!

This morning, I spent a lot of time to correctly install noble (there are a lot of “tricks” in the installation process, for instance you have to rename files, else Ubuntu doesn’t find the one it’s looking for, you have to downgrade to Python2.6, etc.). Then I started looking at the code. Before this, I tried to learn Javascript with CodeAcademy, but I guess it’s not necessary yo fully learn it, since the code is fairly inderstdandable. However, in order to make sure BlueLib wasn’t functional in our case, I did several tests in order to find out where the problem came from the day of the presentation. The result was that, with my test program where I simply connect to 1-3 devices and send comands/receive notifications, everything works fine, but as soon as we test with the intelligence module (where we connect to up to 6 devices), there are timing issues and some commands are not taken into account by BlueLib. Gleison checked with the BLE sniffer that indeed the BLE commands weren’t sent. According to him, it must be the fact that we connect to too many devices that gives rise to these timing issues and lost packets. This sounds logical since the way Hubert has coded the BlueLib multislave functionality is that he uses several threads, each safely using resources thanks to mutexes. When we have more than 2-3 devices this process takes too much time and we believe this is what leads to timing issues and unsent commands/unreceived notifications…

After having seen all this, I firmly decided to switch to noble because I want our demo to work 100% on the presentation day. So I discussed with Benjamin who has already used this, and he told me that it’s not that difficult to use even if you doesn’t know javascript. So I started coding the central station in node.js using noble… Meanwhile, Noémie impelmented the code for the socket-based communication betweent node.js and our “” module (that links the user to the inteligence modue and then to the node.js BLE app). I hope we’ll manage to finish it at most tomorrow night! Then we can do the test with the intelligence module.

Stay tuned 🙂