public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [Bluez-devel] Several bluetooth dongles at time
@ 2005-02-10 12:19 schnelte
  2005-02-10 12:41 ` Marcel Holtmann
  0 siblings, 1 reply; 14+ messages in thread
From: schnelte @ 2005-02-10 12:19 UTC (permalink / raw)
  To: bluez-devel

Hi there,

I am runnning a rfcomm server on a linux pc and want mobile phones to
connect to it.
I need some clearence about the following questions:

1) As the phone is connecting to the pc and not the other way around, the
pc is the slave at first. As far as I know a slave cannot connect to more
than one device at time. So I force a role switch to master after
connection. What happend when another phone will connect? The PC will be
master from the beginning and no role switch is needed? (I don't have a
second mobile to test, at the moment)

2) Can i have multiple connections on the same rfcomm channel? So more
than one mobile can connect to my server at time or only one device per
channel and i have to open more than one channel?

3) If I have more than one bluetooth dongle how can I say which dongle to
use for the connections? At the moment I am setting the field rc_bdaddr to
the address of the bluetooth dongle I am willing to use. Is that about
right? What happens if I am using BDADDR_ANY, BDADDR_ALL or BDADDR_LOCAL
instead? Is there any convinient way that bluez automatically chooses
another dongle if all connections on one dongle are full?

Tnx very much in advance for your answers.

Matthias

This is the code I am using:

  int sock, client, alen;
  int dev;

  struct sockaddr_rc addr;
  if( (sock = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)) < 0)
    {
      perror("socket");
      exit(1);
    }

  addr.rc_family = AF_BLUETOOTH;
  bdaddr_t local;
  str2ba("00:10:60:A4:03:01", &local);
  bacpy(&addr.rc_bdaddr, &local);
  addr.rc_channel = htobs(channel);
  alen = sizeof(addr);

  if(bind(sock, (struct sockaddr *)&addr, alen) < 0)
    {
      perror("bind");
      exit(1);
    }

  listen(sock,10);
  printf("%d Waiting for connections...\n\n",channel);

  if(client = accept(sock, (struct sockaddr *)&addr, &alen))
    {
      printf("%d Got a connection attempt!\n",channel);
    }

  dev=hci_open_dev(0);
  if (dev<0) {
    printf("Error opening hci dev");
    exit(1);

    }

  if (hci_switch_role(dev, &addr.rc_bdaddr, 0, 10000) <0) {
    printf("Role switch failed!");
    }
  close(dev);




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread
* [Bluez-devel] HCI forwarding
@ 2005-01-02  4:29 radeX
  2005-01-02 11:39 ` Marcel Holtmann
  0 siblings, 1 reply; 14+ messages in thread
From: radeX @ 2005-01-02  4:29 UTC (permalink / raw)
  To: bluez-devel

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

Hi everybody:

 

I've been months reading the bluez source and learning about the bluetooth
specification, plus other documents (the correct coding style, Wireless
Technologies Congress 2003 and other documents by Marcel holtmann)

 

I'm developing an application to connect two Bluetooth-enabled phones via
internet using two Bluetooth-enabled PCs both connected to internet. I mean
that I can transmit files and play Bluetooth multiplayer games to my friend
that is 25 miles away like if it were in my device's Bluetooth radio range.
(I know that ping times would be very ugly!).

I use a raw socket as hcidump does, then I send the data trough TCP to the
other peer, when received is sent over Bluetooth hoping that the other
device receives it, this is more complex than it seems since bluez handles
and answers all HCI requests, i.e (when a device performs a SDP request to
find a service UUID bluez handles and answers the request) but this is not
correct for my application, hci responses and data acks may be received via
TCP from the other peer, in other words: no bluez support, only HCI frames
sniffing, sending, receiving and transmitting. Now my questions are:

 

-          Can I send HCI frames with a raw socket ?

-          How can I tell the bluez stack not to answer HCI requests
(receiving only, leave the sends to me).

 

-     Is there a better way to make this application?

 

Any help would be greatly appreciated.

 

Thanks in advance and happy new year.


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

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2005-02-11 19:03 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-10 12:19 [Bluez-devel] Several bluetooth dongles at time schnelte
2005-02-10 12:41 ` Marcel Holtmann
2005-02-10 13:10   ` [Bluez-devel] HCI Forwarding radeX
2005-02-10 14:47     ` Marcel Holtmann
2005-02-11 18:51   ` [Bluez-devel] Several bluetooth dongles at time Matthias Schnelte
2005-02-11 19:03     ` Marcel Holtmann
  -- strict thread matches above, loose matches on Subject: below --
2005-01-02  4:29 [Bluez-devel] HCI forwarding radeX
2005-01-02 11:39 ` Marcel Holtmann
2005-01-02 16:58   ` radeX
2005-01-02 17:32     ` Marcel Holtmann
2005-01-02 19:02       ` radeX
2005-01-02 19:21         ` Marcel Holtmann
2005-01-02 20:26           ` radeX
2005-01-02 20:45             ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox