1

I read the MAP SPEC in order to send a x-bt/message from my PC to my mobile, I am using JAVA blucove API.

I was able to connect over OBEX protocol successful but I had no return from mobile phone and the message was not send.

My OBEX Header:

            HeaderSet hsOperation = clientSession.createHeaderSet();
            hsOperation.setHeader(HeaderSet.TYPE, "x-bt/message");
            hsOperation.setHeader(HeaderSet.LENGTH,new Long(sMessage.length()));
            hsOperation.setHeader(HeaderSet.NAME, "TELECOM/MSG/OUTBOX");

My bMessage and OutputStream:

private final static String CRLF = "\r\n";

static String sMessage = "BEGIN:BMSG"+CRLF
        + "VERSION:1.0"+CRLF
        + "STATUS:UNREAD"+CRLF
        + "TYPE:SMS_GSM"+CRLF
        + " FOLDER:TELECOM/MSG/OUTBOX"+CRLF
        + "BEGIN:VCARD"+CRLF
        + "    VERSION:2.1"+CRLF
        + "    N:Souza,Ricardo"+CRLF
        + "    TEL:+5511666666666"+CRLF
        + "END:VCARD"+CRLF
        + "BEGIN:BENV"+CRLF
        + "    BEGIN:VCARD"+CRLF
        + "        VERSION:2.1"+CRLF
        + "        N:Souza,Ricardo"+CRLF
        + "        TEL:+5511666666666"+CRLF
        + "    END:VCARD"+CRLF
        + "    BEGIN:BBODY"+CRLF
        + "        ENCODING:G-7BIT"+CRLF
        + "        LENGTH:47"+CRLF
        + "        BEGIN:MSG"+CRLF
        + "            This is a short message"+CRLF
        + "        END:MSG"+CRLF
        + "    END:BBODY"+CRLF
        + "END:BENV"+CRLF
        + "END:BMSG"+CRLF; 

    OutputStream os = putOperation.openOutputStream();
    os.write(sMessage.getBytes());
    os.close();

Could someone help me to visualize what is wrong? Please, if someone already worked with Java OBEX in order to send SMS (MAP stack) from PC to mobile. ( like carkits handsfree).

Thank you guys in advance.

Anil_M
  • 10,893
  • 6
  • 47
  • 74

1 Answers1

0

Remove the whitespace: replace the lines like

...
+ "    VERSION:2.1"+CRLF
...

by

...
+ "VERSION:2.1"+CRLF
...

Furthermore the message is expected in 7bit encoding, but in the code above just an ASCII string is provided. E.g. the following block contains the text "Let's go fishing!"

...
"BEGIN:BBODY\r\n" +
    "ENCODING:G-7BIT\r\n" +
    "LENGTH:82\r\n" +
    "BEGIN:MSG\r\n" + /*Length 11 */
        "0001000E8100949821436587000011CC32FD34079DDF20737A8E4EBBCF21\r\n" + /* Length 62 */
    "END:MSG\r\n" + /* Length 9 */
"END:BBODY\r\n" +
 ...

this example is copied from the test suite https://android.googlesource.com/platform/packages/apps/Bluetooth/

Maksim
  • 511
  • 5
  • 15