0

I'm using nObex on Windows to create a Obex connection to an android phone over bluetooth. As library I'm using nObex https://github.com/nccgroup/nOBEX AF_BLUETOOTH is under windows not available, whereas I'm using pybluez to create the connection.

Authentication works fine, on the phone I have to accept that I get access to the file system. When I'm trying to create the OBEX connection:

b'\x80\x00\x0e\x10\x00\xff\xffF\x00\x071106'
|opcode for connect = 0x80| length = 0x000e|obex version = 0x10 = 16| flags = 0x00| max obex message length = 0xffff| length header = 0x0007| profile = 1106

I'm getting the following response:

b'\xc6\x00\x0c\x10\x00\xff\xfe\xcb\x00\x00\x00\x01'
\xc6 = 198 is the flag for "HTTP Not Acceptable" 

Does anybody understands, why I'm not able to get a connection?

ForRace
  • 96
  • 7
  • Wrong OBEX packet. For OBEX OPP it should be simple 80 00 07 10 00 FF FF. For OBEX FTP it also must include the Target Header (FTP UUID). You can try to use Bluetooth Framework (https://www.btframework.com/bluetoothframework.htm). It includes OBEX client and server. – Mike Petrichenko Aug 30 '19 at 12:11
  • But this should be the connect message. When I'm checking out https://lost-contact.mit.edu/afs/nada.kth.se/misc/cas/documentation/bluetooth/bluetooth_k10.pdf, page 16(316) This package includes much more. – MartinM Sep 02 '19 at 06:14
  • As I wrote the OBEX CONNECT header must be like above (may be with smaller packet size, let say 2K for most cases is OK). It also may include Taget header for some specific cases (for FTP, PBAP and some others). No other headers are allowed for OBEX OPP. – Mike Petrichenko Sep 02 '19 at 09:22
  • I tried to send only 80 00 07 10 00 FF FF, but I get the same status code back. The framework ist not available for python. – MartinM Sep 02 '19 at 10:24
  • Are yo usure you connect to OPP service, not to FTP? If it is FTP than there should be Target header. (As you reffered to 1106 so it is FTP and the target header should be added). The full connect packet will look like: 80 00 1A 10 00 FF FF 46 00 13 F9 EC 7B C4 95 3C 11 D2 98 4E 52 54 00 DC 9E 09 – Mike Petrichenko Sep 02 '19 at 10:49
  • Also please note, that in response packet your app gets CONNECTION ID. You must use this CONNECTION ID and ConnectionID header in all your other requests including OBEX DISCONNECT. The headert is required only in OBEX CONNECT. – Mike Petrichenko Sep 02 '19 at 10:51
  • At the end I would like to read SMS from the android phone. The MAP Profile is 0x1134 == 0x0000113400001000800000805F9B34FB. So the message should look like 80 00 1A 10 00 FF FF 46 00 13 00 00 11 34 00 00 10 00 80 00 00 80 5F 9B 34 FB or? I just tested it with FTP again – MartinM Sep 02 '19 at 12:27
  • No, Service UUID and Taget UUID is different things. Refer to the profile's specification to find out correct CONNECT header. Please note that other commands needs to use some additional headers as well. Here is the specification: https://www.bluetooth.org/docman/handlers/downloaddoc.ashx?doc_id=457095 – Mike Petrichenko Sep 02 '19 at 12:34
  • Why your uuid looks so different to the MAP uuid? – MartinM Sep 02 '19 at 12:34
  • Bluetooth service UUID describes services that are supported by Bluetooth device. Tagets IDs used in OBEX is not related to Bluetooth but only to OBEX and desribes server (software) that is responsible for processing OBEX commands. – Mike Petrichenko Sep 02 '19 at 12:37
  • Thank you Mike. Now it worked to connect to the MAP :) – MartinM Sep 02 '19 at 12:48

1 Answers1

0

For MAP and FTP Profiles the target ID must be added. I used for this the UUID which is wrong. The target ID for the Message Access service (MAS) can be found in the MAP document (https://www.academia.edu/32372957/MESSAGE_ACCESS_PROFILE) on page 64