Thursday, August 22, 2013

Installing and running Antidote IEEE 11073 library for personal healthcare device systems

When comes to personal health care device systems, a major problem which can occur is the incompatibility between different devices manufactured by different vendors. The obvious solution is the standardization. So, IEEE has defined the IEEE 11073 protocol for personal health device communication. Antidote is an open source library which implements this protocol for using in such personal health device systems. Recently I got a chance to try this implementation and find out how it works. As usual, for the sake of not forgetting the steps I followed, I'm writing down everything here.

To test Antidote with the sample Agent and Manager components, we need two computers with the bluetooth capability. So, I used my desktop PC which is connected with a USB bluetooth adapter and a laptop which has bluetooth capability. Both are running Ubuntu 12.04 version. I performed following steps on the desktop PC which is going to run the Manager component.

First of all, download Antidote 2.0 version from their website. After uncompressing it to somewhere in my Ubuntu 12.04 desktop machine, I started the installation process. When I try to install it, there were many error messages about missing packages in my platform. So, before installing Antidote, we have to issue following commands on the terminal to install those required package tools.

sudo apt-get install automake
sudo apt-get install libtool
sudo apt-get install libdbus-1-dev
sudo apt-get install libdbus-glib-1-dev
sudo apt-get install libusb-1.0-0-dev

After completing their installation, we can proceed to install Antidote. Move into the antidote-2.0.0 directory from the terminal and issue following commands.

sudo make install

Now Antidote installation on desktop machine is complete. I have to follow the same steps to install Antidote on the laptop but first I have to fix a little bug. After downloading Antidote to the laptop which is also running Ubuntu 12.04, I opened the file "antidote-2.0.0/src/communication/plugin/bluez/plugin_bluez.c" and commented the line number 1455 which is a call to "channel_connected" function. This is required to solve some problem occured by Agent program in Antidote. I found this solution in this mailing list discussion. After doing this little fix, then followed all the above instructions to install Antidote on the laptop computer too.

After completing the installation, we can try sample applications. In the IEEE 11073, there are two basic components which are Agent and Manager. Agent is the medical device which generate health-care data. Manager is a user device which collects the data from Agent device and provide some useful functionalities for the user such as visualizing and storing data or send to some other remote application. Manager device can be a smart-phone or a tablet, while Agent device will be a medical equipment which generate data. Agent and Manager communicates to each other via Bluetooth HDP profile. In our case, we are going to run a simple Manager program on desktop computer while the simple Agent program will run on the laptop computer(which has the bug fixed Antidote). Agent will send just dummy data to the manager to demonstrate the functionality.

First of all we must run the manager. For this purpose move in to the "antidote-2.0.0/src" directory from the terminal of desktop computer. Now issue the following command.


Our terminal should now print some stuff and then hangout. Open a new terminal or a tab and then move into the same directory. Now issue the following command.


That healthd program and this python script are collectively going to give us the Manager functionality. Now its time to run the Agent on the laptop computer. Before that, turn on wifi in both computers and then pair them. Now in the laptop computer, open a terminal and move into the directory "antidote-2.0.0/src" and issue the following command. Note that we have given the bluetooth address of the desktop computer running Manager as a parameter to this sample Agent program.

./sample_bt_agent 00:19:0E:11:9F:5D

After issuing this command, sample Agent start to communicate with the Manager program via bluetooth HDP with the help of IEEE 11073 protocol. On the desktop computer where the script is running, you will see some output like the following which shows that Manager has received some dummy data from the Agent. When we get this output that means our Agent and Manager are working fine.

This is the very basic level of Antidote Agent and Manager for testing. There are more things for me to learn about Antidote library.

Thursday, August 8, 2013

On Screen Keyboard for Raspberry Pi

I faced a little difficulty with the limited number of USB ports available on Raspberry Pi. I wanted to test a USB bluetooth adapter on a Raspberry Pi and obviously I wanted the keyboard and mouse connected to it at the same time. So, I needed 3 USB ports but there are only 2 ports available. One option was to use a USB hub. However when using a USB hub, it seemed my bluetooth adapter is not working as expected which I guess due to low amount of current it can drag through the USB hub. Anyway, I had to look for a solution and there is a simple solution.

I searched in the web for a on-screen keyboard for Raspberry Pi and found this thread. I tried it and worked fine. I'm writing down it here in case I need to do such a thing again oneday. I installed the on-screen keyboard program by issuing the following command in the terminal.

sudo apt-get install matchbox-keyboard

After it completed the installation, we can start it by typing the following in the terminal. The reason is, there is no any launcher icon coming to the desktop or anywhere. Therefore we have to launch it from the command line.

sudo matchbox-keyboard

However its obvious that we cannot have a hardware keyboard to type that command in the terminal in each time we need a keyboard. So, we need a launcher icon. So, we have to add a desktop shortcut for launching the on-screen keyboard. For that, as instructed in that thread, I created a file in the desktop and named it (name can be anything). In the file I added the following.


When we double click it, this shell script should run. For that we have to set the executable permission for this file. So, from the terminal, I went to the desktop where this file is saved and issued the following command.

chmod +x

 Now, when we double click on the file in the desktop, a pop up message should come asking what to do. One option should be to run the file as an executable. By selecting that option, our on-screen keyboard should launch.