Using Android to develop healthcare applications and devices

Believe or not, most makers of DIY Gadgets are very greenpeace-compatible because many DIY projects recycle garbage to create something useful. Healthcare is certainly one of the many topics we shouldn't ignore, not only because of the ethical nature that gears to what a DIYer would love, but also because it involves many external hardware devices, great gadgets for curing illness and saving lives.

Since Android Ice Cream Sandwich (Android 4.0, API 14), we can develop Android applications for Bluetooth Health devices.

The official Android Developer site indicates that the BluetoothHealth API allows communication with devices that implement the Bluetooth Health Profile (HDP).

What is that? What can we do?

Let's see what a Bluetooth profile is: it is a wireless interface specification for Bluetooth-based communication between devices. In order to use Bluetooth technology, a device must be compatible with the subset of Bluetooth profiles necessary to use the desired services. A Bluetooth profile resides on top of the Bluetooth Core Specification and (optionally) additional protocols. While the profile may use certain features of the core specification, specific versions of profiles are rarely tied to specific versions of the core specification.

Bluetooth headset users are very familiar with the Advanced Audio Distribution Profile (A2DP). This profile defines how high quality audio (stereo or mono) can be streamed from one device to another over a Bluetooth connection. For example, music can be streamed from a mobile phone, to a wireless headset, hearing aid & cochlear implant streamer, or car audio or from a laptop/desktop to a wireless headset.

Health Device Profile (HDP) is also a traditional Bluetooth profile. It is designed to facilitate transmission and reception of Medical Device data. The APIs of this layer interact with the lower level Multi-Channel Adaptation Protocol (MCAP layer), but also perform SDP behavior to connect to remote HDP devices. It also makes use of the Device ID Profile (DIP).

Here are some documents: 
http://www.ars2000.com/Bluetooth_HDP.pdf
http://www.ars2000.com/Health-Device-Whitepaper.pdf

Ok, too much new information for non bluetooth-experts. Let's see some examples. These videos are really old where you can find some ancient phones. but you can imagine with today's beyond-smart-phones, everything can be greatly refined.

Video links:
http://www.youtube.com/watch?v=ERafau_GKxs
http://www.youtube.com/watch?v=oXFUXIF5Spo
http://www.youtube.com/watch?v=Vrji-kC1rk4


How to use BluetoothHealth API in Android?

It is fairly easy, just create a BluetoothHealth object. BluetoothHealth is a proxy object for controlling the Bluetooth Service via IPC. If you don't know what IPC is, check it out here.

How to connect to an external health device which is acting in the source role:

  • Use getProfileProxy(Context, BluetoothProfile.ServiceListener, int) to get the BluetoothHealth proxy object. 
  • Create an BluetoothHealth callback and call registerSinkAppConfiguration(String, int, BluetoothHealthCallback) to register an application configuration 
  • Pair with the remote device. This currently needs to be done manually from Bluetooth Settings 
  • Connect to a health device using connectChannelToSource(BluetoothDevice, BluetoothHealthAppConfiguration). Some devices will connect the channel automatically. The BluetoothHealth callback will inform the application of channel state change. 
  • Use the file descriptor provided with a connected channel to read and write data to the health channel. 
  • The received data needs to be interpreted using a health manager which implements the IEEE 11073-xxxxx specifications. 
  • When done, close the health channel by calling disconnectChannel(BluetoothDevice, BluetoothHealthAppConfiguration, int) and unregister the application configuration calling unregisterAppConfiguration(BluetoothHealthAppConfiguration) 

PS: There multiple BLE Health related profiles, the profile that Android uses is a very traditional one, which is not to be confused with similar Bluetooth Low Energy (BLE) profiles such as Health Thermometer and Hear Rate Monitor.

Now that Android is starting to provide official APIs, and that wireless integration with Healthcare has always been a great topic, it is worth getting started.

Imagine when you combine the Android BluetoothHealth API with Google Health APIs, that can create something really neat.

The Java Health Client APIs are documented at:

http://code.google.com/apis/health/docs/2.0/developers_guide_java.html

You can use "gdata" APIs on Android:

http://code.google.com/p/gdata-java-client/downloads/list

For authentication, there's a section in the Health API docs on choosing the appropriate mechanism:

http://code.google.com/apis/health/docs/2.0/developers_guide_protocol.html#Authenticating

One more thing: if you are not very interested in Bluetooth, start with something easy but really usesful, with your imagination.

Last weekend I made this application, pure software, aiming at helping people to better sleep without signal radiation and data consumption. It is called "Auto Signal Off When I Sleep", available in Android Market here.



That's way simple! You'd say. Well, it is a useful healthcare application, ain't it? Start your own healthcare applications now.



Share on Google Plus

0 comments: