Federico Fuga

Engineering, Tech, Informatics & science

Strong Typing PODs

07 Sep 2017 21:29 +0000 c++ Code
Identifiying object by a numerical integer is an almost trivial task. In DISPLACE, a very complex simulator I am involved with, there are many of different categories of objects that model different categoris of agents in the simulator, like vessels, marine locations, ships, ports, and so on. Each object has an Id, and it was very natural, at the start of the project, to implement it using an **int**. Problems started when we decided, for optimization purpose, to shrink the memory footprint, to use smaller int instead. Continue reading

The dbus-cpp Library, introduction

28 Nov 2015 22:33 +0000 c++ Code Linux
While working on a bluetooth based embedded device, I needed to deal with the somehow infamous dbus. [DBus](https://wiki.freedesktop.org/www/Software/dbus/) and [Bluez5](http://www.bluez.org/) have a very steep learning curve, and if you are don't have access to either [Qt framework](https://www.qt.io/) or [glib framework](https://developer.gnome.org/glib/), you have indeed a problem. Glib are very complex C libraries that mimick some of the built-in feature of the C++ language, while on the other hand, Qt are very vast and sometime a big overkill. Continue reading

Pairing Bluetooth with no pin on Intel Edison

10 Aug 2015 15:30 +0000 Code Embedded
It may seems strange for an IoT enabled device, but there's no obvious way to pair an Intel Edison through Bluetooth without accessing the shell. I spent different hours to do something that with Bluez4 took at most 4 minutes, including the research on Google. Here's what I did. Edison provides Bluez5 that reworks most of the tools using DBUS, so to make two quite frequent actions, like pairing a device without providing user intervention on the device, and registering a new bluetooth RFCOMM service, you need to interface with it, that isn't so obvious from C or C++. Continue reading

TouchWiz and the onOffsetChanged missing call

11 Jul 2013 17:38 +0000 Android Code
I am currently working on a Live Wallpaper project for a customer. Interestingly, I found that though my app works perfectly on different devices - I have a Nexus7, Nexus10, a Galaxy Tab p1010, different chinese allWinner devices, and a Note II phone - my wallpaper can’t scroll when the screen is swiped on some Samsung Device. Usually to detect the swiping on a Live Wallpaper, you use the[ WallpaperService.Engine.onOffsetChanged](http://developer.android.com/reference/android/service/wallpaper/WallpaperService.Engine.html#onOffsetsChanged(float, float, float, float, int, int)), i. Continue reading