Linux bluetooth development
 help / color / mirror / Atom feed
From: "Mayank Batra" <mayankbatra@gmail.com>
To: "BlueZ development" <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] sending SAP messages on rfcomm?
Date: Mon, 19 Jun 2006 11:20:29 +0530	[thread overview]
Message-ID: <6297d67c0606182250k5370c838g3ea9dcc6a0d0ebcf@mail.gmail.com> (raw)
In-Reply-To: <167599168834.168834167599@fh-wolfenbuettel.de>


[-- Attachment #1.1: Type: text/plain, Size: 3022 bytes --]

Hi *Götz,*

On 6/16/06, Götz Issel <g.issel@fh-wolfenbuettel.de> wrote:
>
> Hi,
> I am still trying to get the remote SimAccessProfile SAP to work. I habe
> a BT scanner too now, showing me all in detail down to single bits and I
> saw that my sent messages are not being sent.
>
> This is what I have done:
>
> --> search for devices that offer SAP service (standard sdp search and
> filter out "the good ones")
>
> --> pairing with the SIM-Server mobile phone using 16 digits pin as
> required, works fine
>
> --> connect to the phone via rfcomm on the channel given by sdp search
> before (i.e. nokia 6810 needs #4, siemens s65 wants #6 etc) and here the
> phone asks again for allowance to access the SIM. Good sign so far.
>     ...
>    // allocate a socket
>    rfcomm_sock = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
>
>    // set the connection parameters (who to connect to)
>    addr.rc_family = AF_BLUETOOTH;
>    addr.rc_channel = (uint8_t) dest_channel;  // dest_channel depends
> on mobile phone
>
>    str2ba( dest, &addr.rc_bdaddr );  // dest is the string of the
> bdaddr of mobile phone
>
>        printf("\r\nrfcomm connect to %s on channel %i",dest,dest_channel);
>        fflush(stdout);
>
>    // connect to server
>    status = connect(rfcomm_sock, (struct sockaddr *)&addr, sizeof(addr));
>    ...
>
> --> now sending the 1st sap message "CONNECT_REQ" like this (bad style,
> i know, only testing)
>
> int send_connect_req(int sock)
> {
>    int status;
>    unsigned char message[12] = {};
>
>    message [0]  = 0x00; // message ID, here connection req
>    message [1]  = 0x01; // number of parameters
>    message [2]  = 0x00; // reserved
>    message [3]  = 0x00; // reserved
>    message [4]  = 0x00; // parameter ID, here MaxMsgSize
>    message [5]  = 0x00; // reserved
>    message [6]  = 0x00; // parameter length high byte
>    message [7]  = 0x02; // parameter length low byte
>    message [8]  = 0x01; // parameter value high byte
>    message [9]  = 0x18; // parameter value low byte
>    message [10] = 0x00; // padding byte
>    message [11] = 0x00; // padding byte
>
>    status = write(sock, &message, sizeof(message));
>    return status;
> }
>
>
> --> using hcidump shows, that the essage is sent in some way,look at end
> of  http://sap.goetzi.de/hci_dump_sap_1st_msg.txt
>
> I have the feeling i am missing something. Any suggestions? Is "write()"
> the correct way? Do I have to define a new type of packet somewhere
> first? I amlost and my deadline for handing in my project at uni is
> coming closer. Any help appreciated, please.


In fact, a few days ago, I was also trying to do the same experiment.
I think that you are doing it correctly, i.e the sap connection request
looks ok to me.
Try changing the maxmasg size parameter of the request to something else.
So what happens after you send the connect req?
Don't you get any response back from the phone?


Regards,
Mayank

[-- Attachment #1.2: Type: text/html, Size: 4078 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



[-- Attachment #3: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

      parent reply	other threads:[~2006-06-19  5:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-16 14:02 [Bluez-devel] sending SAP messages on rfcomm? Götz Issel
2006-06-17 10:14 ` Marcel Holtmann
2006-06-19  5:50 ` Mayank Batra [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6297d67c0606182250k5370c838g3ea9dcc6a0d0ebcf@mail.gmail.com \
    --to=mayankbatra@gmail.com \
    --cc=bluez-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox