Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User vadikv's Avatar
    Join Date
    Dec 2005
    Location
    Ilinois
    Posts
    12
    When I run the following code on my Nokia 6682, it throws a BluetoothStateException:



    Code:
                            // Called when a new device has been discovered
    
                            public void deviceDiscovered(RemoteDevice remote, DeviceClass devclass)
    
                            {
    
                                        try
    
                                        {
    
                                                    System.out.println("DD: " + remote.getFriendlyName(false) + " at " + remote.getBluetoothAddress());
    
                                                    Log.append("Found device: " + remote.getFriendlyName(false) + " at " + remote.getBluetoothAddress(), null);
    
                                                    
    
                                                    if(remote.getFriendlyName(false).equals(devicename))
    
                                                    {
    
                                                                foundDevice = true;
    
                                                                agent.cancelInquiry(this);
    
                                                                Log.append("SSS: " + remote.getFriendlyName(false) + " at " + remote.getBluetoothAddress(), null);
    
                                                                agent.searchServices( null, new javax.bluetooth.UUID[]{ new javax.bluetooth.UUID(0x0100)  }, remote, this);
    
                                                    }
    
                                        }
    
                                        catch(BluetoothStateException e)
    
                                        {
    
                                                    Log.append("BSE while SS TEST", null);
    
                                        }


    All this code does is search for services with UUID 0x0100 on a device with a given device name. Why does it throw this exception and how can I fix it?

    If you can please cc responses to vargasv@msoe.edu

    Thanks much.
    [FONT=Fixedsys]Vargasv[/FONT]

  2. #2
    Registered User madnokk's Avatar
    Join Date
    Feb 2006
    Posts
    3
    Hi vadikv,

    After the check for the device name is passed, you have called agent.cancelInquiry(). Soon after that you are asking the Discovery agent to start a searchServices(). I think this is causing the problem. Make sure that the device discovery is complete and the Inquiry status become cancelled or a callback is got before you issue a call to searchServices().

    Just give it a try.

    madnok

Similar Threads

  1. First-chance exception in emulator S60 3rd ed.
    By darioses in forum Symbian Tools & SDKs
    Replies: 6
    Last Post: 2006-04-25, 18:24
  2. illegal state exception
    By lmtang in forum Mobile Java General
    Replies: 5
    Last Post: 2005-05-26, 02:35
  3. Catching an exception
    By btnokdev in forum Mobile Java General
    Replies: 2
    Last Post: 2003-10-11, 14:45
  4. illegal state exception at startup on 3650?
    By davemee in forum Mobile Java General
    Replies: 1
    Last Post: 2003-08-14, 14:48
  5. can not successfully link any sample using .NET
    By lobotomat in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2002-08-20, 00:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved