×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    3

    Post Periodically discovering Bluetooth

    Hi to all..

    I'm developing a application, that searching a particular device via bluetooth. If the device found, then i'll do the process. If the device not present, then the application 'll do another process. So i want to start bluetooh discovery mode periodically. Any replay 'll appreciated.

    Thanks
    Raz

  2. #2
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: Periodically discovering Bluetooth

    Quote Originally Posted by razebond86 View Post
    Hi to all..

    I'm developing a application, that searching a particular device via bluetooth. If the device found, then i'll do the process. If the device not present, then the application 'll do another process. So i want to start bluetooh discovery mode periodically. Any replay 'll appreciated.

    Thanks
    Raz
    Do this Search discovery of available bluetooth devices in a worker thread in a Do while(true) loop and after every search, make this thread sleep for the interval of time after which you want to search again.
    Refer to : http://wiki.forum.nokia.com/index.ph...ice_in_Java_ME
    Thanks,
    Ekta

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    3

    Re: Periodically discovering Bluetooth

    Thanks for your replay ekta..

    Here, could you please tel which part of the code want to write inside the thread. Did you tried with thread. Can we create the discoveryAgent again and again?


    Thanks
    Raz

  4. #4
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: Periodically discovering Bluetooth

    Quote Originally Posted by razebond86 View Post
    Thanks for your replay ekta..

    Here, could you please tel which part of the code want to write inside the thread. Did you tried with thread. Can we create the discoveryAgent again and again?


    Thanks
    Raz
    See this link also - http://wiki.forum.nokia.com/index.ph...ediscovery.zip

    Another approach:

    Use javax.bluetooth.DiscoveryAgent.startInquiry(int accessCode,
    DiscoveryListener listener);

    see Interface DiscoveryListener API methods
    void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod)
    Called when a device is found during an inquiry.
    void inquiryCompleted(int discType)
    Called when an inquiry is completed.

    When the Inquiry is Completed you get a callback in inquiryCompleted(int discType) where you can sleep for predefined time using a Thread and then startInquiry() again.

    In deviceDiscovered is called back, everytime it finds a new device, do what processing you need to do.

    deviceDiscovered

    public void deviceDiscovered(RemoteDevice btDevice,
    DeviceClass cod)
    Called when a device is found during an inquiry. An inquiry searches for devices that are discoverable. The same device may be returned multiple times.
    Parameters:
    btDevice - the device that was found during the inquiry
    cod - the service classes, major device class, and minor device class of the remote device
    See Also:
    DiscoveryAgent.startInquiry(int, javax.bluetooth.DiscoveryListener)
    Thanks,
    Ekta

  5. #5
    Registered User
    Join Date
    May 2010
    Posts
    3

    Re: Periodically discovering Bluetooth

    Thanks ekta...

    Now its working.. Thanks again...

  6. #6
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: Periodically discovering Bluetooth

    Did you switch to DiscoveryListener approach ?
    Quote Originally Posted by razebond86 View Post
    Thanks ekta...

    Now its working.. Thanks again...
    Thanks,
    Ekta

Similar Threads

  1. Discovering a Bluetooth Service on Linux
    By cabezonxdg in forum Symbian
    Replies: 0
    Last Post: 2009-09-18, 20:44
  2. Problem Discovering bluetooth devices
    By babua in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2009-05-04, 11:23
  3. Bluetooth device discovering
    By jewelsust in forum Mobile Java General
    Replies: 1
    Last Post: 2007-12-29, 13:20
  4. Discovering Bluetooth Devices
    By mottaisami in forum Mobile Java General
    Replies: 1
    Last Post: 2007-03-23, 09:57
  5. Problem in discovering Bluetooth devices
    By anummiah in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2005-08-15, 13:24

Posting Permissions

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