Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Dec 2005

    Couldn't find service after first serviceDiscovery


    I'm currently working on a J2ME game which communicats with a server (PC) over bluetooth.

    I searches for every device in range and save each founded device in a Vector. After the search is completed i start to search for the specific service on every founded device.

    Everything works fine if there is only the device in range that overs the service or this device is the first found by device inquiry.

    I've done a lot of bugtracking but couldn't figure out why it doesn't work if the service runs on e.g. the second founded device.
    I think it isn't a problem of the logic cause it searches for services on different devices but the callback method just didn't get called.

    During my research about this problem i read that the callback method should not call bluetooth functions. So i restructure my program to fullfill this. I also used diffrent callback handler object for each call to searchServices.

    I use a Nokia 6680 and 6600 for testing and eclipse with eclipseme (ant build script) for development.

    any help highly appreciated

  2. #2
    Registered User
    Join Date
    Mar 2003
    Mhm, no idea for this explanation. Make sure you follow certain thread rules. Search for devices and store them in a global vector (deviceDiscovered). If all are found (inquiryCompleted), run the service search. Store all found services (servicesDiscovered) and do then what you want (serviceSearchCompleted).

    Make sure to start a new Thread in serviceSearchCompleted. Not sure if the same is required in inquiryCompleted – have not tested more than one other device, too – but I think so. The problem is, the Nokia Series 60 has an event dispatcher thread which excutes the Bluetooth events. If you block this thread, no event will be generated anymore until you release this event thread. Terrible design by Nokia. A new thread should start for each event, as is done on Nokia Series 40.

    Make sure never to call anything from a Bluetooth event which could generate another (Bluetooth or non-Bluetooth) system event.

    Just my experiences; could be wrong, irritate or perhaps help.

  3. #3
    Registered User
    Join Date
    Dec 2005

    Re: Couldn't find service after first serviceDiscovery

    tx for your reply.

    I've checked the code once more.
    And I'm not calling anything out of the callback methods.
    The only thing i do is to call a synchronized method wakeup(). Which wakes up the main thread that than starts the next serviceDiscovery().

    You wrote that this blocks the eventhandling thread. As far as I understood this, that means if the event handling thread isn't blocked anymore i should receive the callbacks.
    But my problem is that i get the serviceSearchCompleted as i should, put don't get the servicesDiscovered call. The service is registered correctly and everything works fine if the device is the first one found. But if not the serviceDiscovered method just didn't get called.

    any ideas?

    tx, woodi

  4. #4
    Registered User
    Join Date
    Dec 2005

    Re: Couldn't find service after first serviceDiscovery

    I am developing an application for nokia 6235 cdma( Series 40) that will communicate to a server running on my pc, I ve tried all the methos to make my mobile communicating to my pc but i am unable to do it till now. Could you pleawse help me to sort out this problem so that i can make my mobile to send and recieve information to and from my server running on my pc.
    rajender pasricha

  5. #5
    Registered User
    Join Date
    Jan 2006

    Re: Couldn't find service after first serviceDiscovery

    I also doing the same project(service discovery).
    I am having some programs related to that , but its not working. I need Java Package named "Microedition" to run this program. So can help me. Please send your program to me. I will try out. My email id is shengiv@myway.com

  6. #6
    Super Contributor
    Join Date
    Mar 2005

    Re: Couldn't find service after first serviceDiscovery

    didn't you called agent.cancelServiceSearch(myID); in your servicesDiscovered methode ?
    i had a similar problem because i thought it was necesary.
    i think you are cancelling the search at some point

  7. #7
    Registered User
    Join Date
    Sep 2005

    Unhappy Re: Couldn't find service after first serviceDiscovery


    I have exactly the same problem as woodi33. I am working with a 6630 and when discovers 2 devices with the service implemented only discovers the service in the first of them.

    Well, I have tested other situations:
    - With other phones this problem doesn't happens (6230)
    - Cancelling the Service Search as said by njzk doesn't solve it (at least for me)
    - If I turn off the first device then discovers services OK in the second.
    - ....Hello Nokia? All phones that I have tested until now have at least one 'little' bug with Bluetooth. What happens with JSR-82?

    Solution? I will try two options:
    1. Wait between service searches... :-S
    2. Load in memory the connection URL and the BT Address. In the next Service Search, I won't procceed with the first, and go for the second directly... :-S

    Home made solutions... Any other ideas?

    Moises. (Spain, sorry for my bad english)

Similar Threads

  1. Replies: 5
    Last Post: 2006-10-05, 13:50
  2. Replies: 4
    Last Post: 2006-09-05, 15:15
  3. 6680 and bluetooth service profiles
    By ceruault in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2005-10-08, 22:24
  4. Deployment tool of NDS 2.2 could not find service layer
    By goutamm in forum Mobile Java General
    Replies: 1
    Last Post: 2005-03-30, 15:25
  5. Can't find service a second time
    By Leicester22 in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2005-03-28, 12:46

Posting Permissions

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