Tuesday, April 19, 2011

OBEX Message Access Profile introduction

Have you ever tried to push a SMS message from a laptop to an Android phone via Bluetooth? It's very similar to OPP (object push profile) and it is to use OBEX to exchange data too. I found some patches in Aurora about supporting MAP (message access profile) in Android two months ago. Finally, I got some time to play with it.

What is MAP? MAP defines a set of features and procedures to exchange messages between devices. It is especially tailored for the automotive Hands-Free use case where an onboard terminal device (typically a Car-Kit installed in the car) takes advantage of the messaging capability of a communication device (typically a mobile phone). This profile can however also be used for other use cases that require the exchange of messages between two devices.

I have no Car-Kit to verify this profile and I cannot find any platform to support it either. Therefore, I use python lightblue and write few lines to verify this function. I have one samsung smdkv210 platform and one ubuntu laptop. Below is the list about MAP profile from Aurora git repository. If you are using gingerbread, you could apply their patches easily. Also, it's just a simple list and we should review git log to retrieve more patches related to MAP profile.

native bluez
Bluetooth : Add MAP service records into SDP tool

android frameworks
frameworks/bluetooth: Changes for enabling Bluetooth MAP profile

Bluetooth UI application
Bluetooth: Adding MAP Profile implementation

Email UI application
Email: Changes to trigger Email app to update its mailbox from Bluetooth MAP Profile

MMS UI application
Mms: Enable MMS app to push a MMS added to outbox by Bluetooth MAP profile

Add MAS service from init.rc file and then we can see MAP record from sdptool.

#cat /root/init.rc
service map /system/bin/sdptool add --channel=16 MAS
user bluetooth
group bluetooth net_bt_admin

# sdptool browse local
Service Name: OBEX Message Access
Service RecHandle: 0x10008
Service Class ID List:
"" (0x1132)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 16
"OBEX" (0x0008)
Profile Descriptor List:
"" (0x1134)
Version: 0x0100

I use ipython to write my scripts to demo MAP function. I create an OBEX Client from my Ubuntu machine and use it to connect with Android device. It send a 'get' request to retrieve the first slot of SMS.

import lightblue
client = lightblue.obex.OBEXClient(host,port)