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
https://www.codeaurora.org/gitweb/quic/la/?p=platform/external/bluetooth/bluez.git;a=commit;h=7f52e048879c74a35a212ed4a0ce2f14133e2806

android frameworks
frameworks/bluetooth: Changes for enabling Bluetooth MAP profile
https://www.codeaurora.org/gitweb/quic/la/?p=platform/frameworks/base.git;a=commit;h=a7d9bf26766e420be997d2858fc7b73b42868860

Bluetooth UI application
Bluetooth: Adding MAP Profile implementation
https://www.codeaurora.org/gitweb/quic/la/?p=platform/packages/apps/Bluetooth.git;a=commit;h=e900ed4897561fbb317a8c1488ac84c0fb051068

Email UI application
Email: Changes to trigger Email app to update its mailbox from Bluetooth MAP Profile
https://www.codeaurora.org/gitweb/quic/la/?p=platform/packages/apps/Email.git;a=commit;h=e11f384228e44cb8b718247436fc0501bb81673a

MMS UI application
Mms: Enable MMS app to push a MMS added to outbox by Bluetooth MAP profile
https://www.codeaurora.org/gitweb/quic/la/?p=platform/packages/apps/Mms.git;a=commit;h=703e2c2ae82f973954c539cd8e55470e4d6c3873

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
disabled
oneshot

# 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
host="12:60:41:7F:03:11"
port=16
client = lightblue.obex.OBEXClient(host,port)
client.connect()
f=file('/home/erin/Desktop/temp','w+')
client.get({'type':"x-bt/message",'name':'1'},f)
f.seek(0)
f.read()
f.close()
client.disconnect()





No comments:

Post a Comment

Note: Only a member of this blog may post a comment.