×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jul 2006
    Posts
    23

    Thumbs up Connecting to RFCOMM server among multiple bluetooth devices

    There are 5 bluetooth devices, 2 desktops & 3 cellphones.
    Now one of the desktop is running a RFCOMM server and the 3 cellphones want to connect to this server as client.

    But when I run the client on the cellphone a cellphone tries to connect to another cellphone rather then connecting with the server on the desktop.
    How can I acheive such a thing where the cellphone only connects to the desktop and not the other devices ?

    The server may run on any of the desktop on anytime. But it would run on only desktop at a time.

    On my client side I run the following code:

    discoveryAgent.startInquiry(DiscoveryAgent.GIAC, this);
    public void inquiryCompleted(int discType)
    {
    uuidSet = new UUID[1];
    uuidSet[0] = new UUID(0x0003);
    discoveryAgent.searchServices(null,uuidSet,rtDevice,this);
    }

  2. #2
    Super Contributor
    Join Date
    Dec 2005
    Location
    England,UK
    Posts
    1,600

    Re: Connecting to RFCOMM server among multiple bluetooth devices

    Hi,
    You have show how you select and filter services but really you need to look at the devices.

    discoveryAgent.searchServices(null,uuidSet,rtDevice,this);

    How you build up your remote device vector and how you select each address is critical to getting this going.

    rtDevice should be the remote device that you selected out of all the addresses.
    If this is the first or only address your program (the other phone) then it will always connect to that bluetooth address.

    PHP Code:
    Vector remoteDevices = new Vector();
    DiscoveryAgent discoveryAgent;

                
    LocalDevice localDevice LocalDevice.getLocalDevice();
                
    discoveryAgent localDevice.getDiscoveryAgent();


        public 
    void deviceDiscovered(RemoteDevice remoteDeviceDeviceClass cod) {

                 
    remoteDevices.addElement(remoteDevice);


    You now have to provide away way for the user to select the right device using a loop to display each element with the BT functions.

    String rtDevice.getFriendlyName(true)
    and
    String rtDevice.getBluetoothAddress()

    Jim

  3. #3
    Registered User
    Join Date
    Oct 2009
    Posts
    3

    Re: Connecting to RFCOMM server among multiple bluetooth devices

    Hi,

    I am stuck with a similar problem..Any answers guys ??

  4. #4
    Registered User
    Join Date
    Mar 2003
    Posts
    4,105

Similar Threads

  1. A question about bluetooth devices communication!
    By DaphneH in forum Bluetooth Technology
    Replies: 5
    Last Post: 2006-06-19, 09:12
  2. Verify available BlueTooth devices
    By kingnebu in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2005-06-14, 14:23
  3. IOException when connecting to the server many times
    By crazyII in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2004-01-15, 20:14
  4. 3rd Party Bluetooth Devices with Nokia Connection Manager
    By Dmore in forum Bluetooth Technology
    Replies: 1
    Last Post: 2002-06-13, 08:32
  5. Bluetooth simultaneous connection to 2 devices
    By Nokia_Archive in forum Bluetooth Technology
    Replies: 1
    Last Post: 2002-05-27, 19:01

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×