Linux bluetooth development
 help / color / mirror / Atom feed
From: "Sir Graham (Terra)" <sir__graham@terra.es>
To: <bluez-devel@lists.sourceforge.net>
Subject: [Bluez-devel] Selection of Local module....
Date: Mon, 10 Apr 2006 17:03:02 +0200	[thread overview]
Message-ID: <049f01c65cb0$0d478bf0$0300a8c0@akira> (raw)

[-- Attachment #1: Type: text/plain, Size: 1249 bytes --]

Hi,

I need to use two bluetooth devices in the same computer with BlueZ.

How  can I select (with socket) the device local that I like make a conexion?


If I make a simple conexion... Can I select what of my local modules (HCI0 or HCI1) makes this conexion?


#include <stdio.h>
#include <unistd.h>
#include <sys/socket.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/rfcomm.h>

int main(int argc, char **argv)
{
    struct sockaddr_rc addr = { 0 };
    int s, status;
    char dest[18] = "01:23:45:67:89:AB";

    // allocate a socket
    s = 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) 1;
    str2ba( dest, &addr.rc_bdaddr );

    // connect to server
    status = connect(s, (struct sockaddr *)&addr, sizeof(addr));

    // send a message
    if( status == 0 ) {
        status = write(s, "hello!", 6);
    }

    if( status < 0 ) perror("uh oh");

    close(s);
    return 0;
}

Can I select what of my local modules (HCI0 or HCI1) makes this conexion?  

Where can I select (in the example) what local module use?  ¿¿¿???

Regards,
Sir Graham.





[-- Attachment #2: Type: text/html, Size: 3267 bytes --]

             reply	other threads:[~2006-04-10 15:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-10 15:03 Sir Graham (Terra) [this message]
2006-04-10 17:37 ` [Bluez-devel] Selection of Local module Albert Huang
2006-04-10 18:51   ` Sir Graham (Terra)
2006-04-11 19:29     ` Albert Huang
2006-04-11 20:21       ` Sir Graham (Terra)
2006-04-11 22:10         ` Albert Huang

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='049f01c65cb0$0d478bf0$0300a8c0@akira' \
    --to=sir__graham@terra.es \
    --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