×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    8

    Nokia 7610, bluetooth device search

    Hi, I have a huge problem.
    I'm writing a J2ME application with the mobile phone 7610. Its an app to control an electrical device over bluetooth.
    Now I'm trying to implement the bluetooth device search and that should be no problem with the API functions. But the application doesn't finde other bluetooth devices, but the inquiryCompleted method is called at the end. Is there sometimes a problem with 7610? Or is there an error in my code?

    Please, I need help!

    Diskordia

    PS. my code of the devcie search class, I cant post the whole class, ist to huge

    Code:
    (...)
         DiscoveryAgent discoveryAgent = LocalDevice.getLocalDevice().getDiscoveryAgent();
    (...)
        public void commandAction(Command command, Displayable d)
        {
           
            if (command == searchCommand)
            {
                try
                {
                    LocalDevice dev = LocalDevice.getLocalDevice();
                    dev.setDiscoverable(DiscoveryAgent.NOT_DISCOVERABLE);
    
                    discoveryAgent.startInquiry(DiscoveryAgent.GIAC, this);
                }
                catch (BluetoothStateException e)
                {
                    MyDisplay.setCurrent(new Alert("errortext '"  
                                             + e.getMessage(),Error, AlertType.ERROR),this);
                }
            }
        }
    
    (...)
        public void deviceDiscovered(RemoteDevice remoteDevice,
                                     DeviceClass deviceClass)
                                   
        {
            String DeviceName = "";  
            
            boolean could_be_a_BT_Modul = 
                (deviceClass.getMajorDeviceClass() == 0x1F00);
    
            if (could_be_a_BT_Modul==true)
            {
                // Add the element to the list
            }
        }
    
    (...)
    
        public void inquiryCompleted(int discoveryType)
        {
              // Post an errormessage if no devices is found
        }

  2. #2
    Nokia Developer Expert
    Join Date
    Jun 2005
    Posts
    923

    Re: Nokia 7610, bluetooth device search

    It might be that the major device class you're using is incorrect or there are no devices with this code in the neighborhood. Is the deviceCompleted method called at all? You should try first discover all devices (without filtering by class) just to check that the connection is working.

    Daniel

  3. #3
    Registered User
    Join Date
    Jan 2006
    Posts
    8

    Re: Nokia 7610, bluetooth device search

    Thanks, that was the problem. I tried it with a mobile phone, that's MajorDeviceClass 0x200 and it has found the device.
    But it's funny, next I tried it with the old MajorDeviceClass I'd already posted, an it has found the specieal electrical device (0x1F00 should be unknown device class) ^^
    I don't know what the problem was.

    And know it still doesn't run. I have a new problem. Ich can connect to th device correctly, but if I try to open a InputStream or OutputStream I get a Symbian OS Error. Well, I'll post my code

    Diskordia

    Code:
    // Constructor of the Class ConnectionHandler
    public ConnectionHandler(RemoteDevice remoteDevice) throws IOException{
            this.remoteDevice = remoteDevice;
            
            this.url ="btspp://" + this.remoteDevice.getBluetoothAddress() + ":1;authenticate=true;encrypt=true;master=false";
            this.connection = (StreamConnection)Connector.open(url,Connector.READ_WRITE, true);
            this.inputStream = this.connection.openInputStream();
            
    }

  4. #4
    Nokia Developer Expert
    Join Date
    Jun 2005
    Posts
    923

    Re: Nokia 7610, bluetooth device search

    When you discover a device, you have to search for services on it, using the startServiceSearch method and handling discovered services accordingly. Only when you find the service you want (via its UUID), you call the getConnectionURL() on the ServiceRecord object you'll get, and then you'll be able to open streams to it.

    Daniel

  5. #5
    Registered User
    Join Date
    Jan 2006
    Posts
    8

    Re: Nokia 7610, bluetooth device search

    Hi, but the electrical device doesn't support service search. Its the Wrapp Thor from Bluegiga.
    I can open a connection to the bluegiga module, but I can't open any stream from the connection. So I have to start the service search despite the non supportable service search?

    Discordia

  6. #6
    Registered User
    Join Date
    Jan 2006
    Posts
    8

    Re: Nokia 7610, bluetooth device search

    Well, I tried the same way as the previous project from another team at my school and they did it without service search too.

    Theire code:
    Code:
                            url = ("btspp://"+iSpot.getconnectionUrl()+
                                    ":1;authenticate=true;encrypt=true;master=false");
    
                            // Verbindung wird aufgebaut:
    
    
                            connection = (StreamConnection) Connector.open(url);
                            SendeDaten = connection.openDataOutputStream();
    I tried it in exactly the same way, but I still get the Symbian Os error. I don't know any further ...

    Diskordia

  7. #7
    Registered User
    Join Date
    Jan 2006
    Posts
    8

    Re: Nokia 7610, bluetooth device search

    Now it's worse, I cant't open a connection anymore! I get now a Symbian Os error while opening the connection.....

    What do I wrong?

    I put my source online, If you could take a short look in it please.
    Source

    Thanks for help

    Diskordia

  8. #8
    Registered User
    Join Date
    Jan 2006
    Posts
    8

    Re: Nokia 7610, bluetooth device search

    Well, I searched a little bit more about this error, its error code -11 that should mean already exists, whatever this means ^^

    Diskordia

Similar Threads

  1. Bluetooth error on the Nokia 7610
    By ianstrain in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2004-09-30, 18:13
  2. Nokia Mobile VPN Client
    By marcyl in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2003-12-01, 14:47
  3. Nokia 7650 support Bluetooth audo?
    By ovjo12 in forum Bluetooth Technology
    Replies: 5
    Last Post: 2003-07-17, 18:50
  4. 6310 to Laptop Via Bluetooth
    By JASMAX in forum Bluetooth Technology
    Replies: 20
    Last Post: 2003-03-13, 19:26
  5. Why can't my nokia 8910 search for my ipaq3870 by using the bluetooth
    By mojung20002 in forum Bluetooth Technology
    Replies: 4
    Last Post: 2002-07-05, 13:48

Posting Permissions

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