.NET Components for Mobility

Issues in Bluetooth discover mode

Last post 06-26-2009 9:04 AM by alanjmcf. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 06-22-2009 1:40 PM

    • kasun
    • Top 500 Contributor
    • Joined on 01-31-2009
    • Posts 5

    Issues in Bluetooth discover mode

    By using 32feet.net libraries I manage to discover bluetooth enabled devices in range. for some reason it hangs and the program goes not responding. what kind of a bug is this? how can I over come this? I used 5 seconds timer to discover devices. Codes are written in C# is this a problem in32feet library?

  • 06-22-2009 1:42 PM In reply to

    • veit
    • Top 10 Contributor
    • Joined on 05-16-2008
    • munich / germany
    • Posts 62

    Re: Issues in Bluetooth discover mode

     discovering devices does take time ...

     

    which timer do you mean`?

     

    code would be helpful

  • 06-22-2009 1:54 PM In reply to

    • kasun
    • Top 500 Contributor
    • Joined on 01-31-2009
    • Posts 5

    Re: Issues in Bluetooth discover mode

     I use the in built timer  (using C#) for trigering the discovery event for every 5 seconds. the sudden froze arise as i try to close the program. 

    public Dictionary<string,string> testMethod()
            {
                          
                Dictionary<string,string> btDictionary = new Dictionary<string, string>();
               
                BluetoothDeviceInfo[ devices = bc.DiscoverDevices(8, true, false, true);
                foreach (BluetoothDeviceInfo test in devices)
                {
                               
                    //btItems.Add(test.DeviceName + " " + test.DeviceAddress + " " + test.Connected);
               
                    btDictionary.Add(test.DeviceAddress.ToString(), test.DeviceName);

                }
                return btDictionary;

            }

  • 06-23-2009 3:33 AM In reply to

    Re: Issues in Bluetooth discover mode

    I guess this is caused by the default discover time.

    For unknown devices, the method DiscoverDevices(int maxDevices, bool authenticated, bool remembered, bool unknown ) of BluetoothClient takes default 10 seconds, that is, the last parameter is set "true".

    You can change the value by setting the property "InquiryLength". 

    Please see http://inthehand.com/library/html/P_InTheHand_Net_Sockets_BluetoothClient_InquiryLength.htm

  • 06-23-2009 6:04 AM In reply to

    • kasun
    • Top 500 Contributor
    • Joined on 01-31-2009
    • Posts 5

    Re: Issues in Bluetooth discover mode

    Thanks for the reply. i did not understand in how to change theInquiryLenght. can you give a sample code on how to  handle it?

  • 06-25-2009 6:34 AM In reply to

    Re: Issues in Bluetooth discover mode

    Device discovery / Inquiry in Bluetooth is slow...  It takes more than ten seconds in my experience.  One can change the time the discovery will abort with the InquiryLength property, but that means that you won't get to know all the devices in range.

    You could try running the discovery on a background thread and updating a shared list of devices but do you really need to know the devices in range so often??

    Alan J. McFarlane
    http://www.alanjmcf.me.uk/
    Please follow-up in the newsgroup for the benefit of all.
    Have I helped? Consider visiting my Amazon wishlist, see my homepage.
  • 06-26-2009 1:38 AM In reply to

    Re: Issues in Bluetooth discover mode

    Hello,

    I have a question...

    If the InquiryLength less than default value, devices with short distance in range will be discovered?

  • 06-26-2009 9:04 AM In reply to

    Re: Issues in Bluetooth discover mode

    I don't really know.  My educated *guess* is that the discoverying (inquiring) device sends out the multiple discovery requests including an id, each device in range sees if the id matches its address some function of its address and responds then [if (id == compress(myAddress)) then Respond].  So I don't think the distance matters...

    Alan J. McFarlane
    http://www.alanjmcf.me.uk/
    Please follow-up in the newsgroup for the benefit of all.
    Have I helped? Consider visiting my Amazon wishlist, see my homepage.
Page 1 of 1 (8 items)
Copyright © 2001-2010 In The Hand Ltd. All rights reserved. Terms of Use and Privacy Policy.