Return-Path: Message-ID: <000c01c65ccf$d8af7180$0300a8c0@akira> From: "Sir Graham (Terra)" To: References: <049f01c65cb0$0d478bf0$0300a8c0@akira> Subject: Re: [Bluez-devel] Selection of Local module.... MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0009_01C65CE0.92412390" Sender: bluez-devel-admin@lists.sourceforge.net Errors-To: bluez-devel-admin@lists.sourceforge.net Reply-To: bluez-devel@lists.sourceforge.net List-Unsubscribe: , List-Id: BlueZ development List-Post: List-Help: List-Subscribe: , List-Archive: Date: Mon, 10 Apr 2006 20:51:42 +0200 This is a multi-part message in MIME format. ------=_NextPart_000_0009_01C65CE0.92412390 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, Thanks for you answer.... This works when you make a server conexion.... but... When you create a = client function works also the bind function?=20 you see the function attachment to my first message. If I put a bind = call in this function (client connect funcion) can i select the local = bluetooth device?=20 Regards, Sir Graham. ----- Original Message -----=20 From: Albert Huang=20 To: bluez-devel@lists.sourceforge.net=20 Sent: Monday, April 10, 2006 7:37 PM Subject: Re: [Bluez-devel] Selection of Local module.... bind() to the address and channel of the local adapter you want to use = before the call to connect() -albert On 4/10/06, Sir Graham (Terra) < sir__graham@terra.es> wrote: 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 #include #include #include #include int main(int argc, char **argv) { struct sockaddr_rc addr =3D { 0 }; int s, status; char dest[18] =3D "01:23:45:67:89:AB"; // allocate a socket s =3D socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM); // set the connection parameters (who to connect to) addr.rc_family =3D AF_BLUETOOTH; addr.rc_channel =3D (uint8_t) 1; str2ba( dest, &addr.rc_bdaddr ); // connect to server status =3D connect(s, (struct sockaddr *)&addr, sizeof(addr)); // send a message if( status =3D=3D 0 ) { status =3D 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? =20 Where can I select (in the example) what local module use? = =BF=BF=BF??? Regards, Sir Graham. ------=_NextPart_000_0009_01C65CE0.92412390 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi,
 
Thanks for you answer....
 
This works when you make a server = conexion....=20 but... When you create a client = function=20 works also the bind function?
 
you see the function attachment to my = first=20 message. If I put a bind call in this function (client = connect=20 funcion) can i select the local bluetooth = device? 
 
Regards,
Sir Graham.
 
 
----- Original Message -----
From:=20 Albert = Huang=20
To: bluez-devel@lists.sourc= eforge.net=20
Sent: Monday, April 10, 2006 = 7:37=20 PM
Subject: Re: [Bluez-devel] = Selection of=20 Local module....

bind() to the address and channel of the local adapter = you want=20 to use before the call to connect()

-albert

On 4/10/06, Sir Graham=20 (Terra) <=20 sir__graham@terra.es> wrote:
Hi,
 
I need to use two bluetooth = devices in=20 the same computer with BlueZ.
 
How  can I select = (with socket)=20 the device local that I like make a = conexion?
 
 
If I make a simple = conexion... Can I=20 select what of my local modules (HCI0 or HCI1) makes this=20 conexion?
 
 
#include = <stdio.h>
#include=20 <unistd.h>
#include <sys/socket.h>
#include=20 <bluetooth/bluetooth.h>
#include=20 <bluetooth/rfcomm.h>

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

    // allocate a=20 socket
    s =3D socket(AF_BLUETOOTH, SOCK_STREAM, = BTPROTO_RFCOMM);

    // set the connection = parameters=20 (who to connect to)
    addr.rc_family =3D=20 AF_BLUETOOTH;
    addr.rc_channel =3D (uint8_t)=20 1;
    str2ba( dest, &addr.rc_bdaddr=20 );

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

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

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

    = close(s);
   =20 return 0;
}
 
Can I select what of my = local modules=20 (HCI0 or HCI1) makes this conexion? 
 
Where can I select = (in the=20 example) what local module use?  = =BF=BF=BF???
 
Regards,
Sir=20 Graham.
 

 
 

------=_NextPart_000_0009_01C65CE0.92412390-- ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel