software you can take with you

Unabale to get an error on removal of bluetooth doungle.

Last post 09-05-2011 6:55 AM by ramesh.shivakumar. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 09-05-2011 2:59 AM

    Unabale to get an error on removal of bluetooth doungle.

     Hello all,

    i want to check wheather the bluetooth bongle is connected or not using c# code .

    both with dongle as well as built in BT.same problem

    i used this code

    BluetoothDeviceInfo[ bdi=null ;

    void GetDevices ( )
            {
                if(bdi == null)
                {
                    // addtolog ( "Discovering Devices..." );

                    BluetoothClient bc = new BluetoothClient ( );
                   try
                    {
                        
                        bdi = bc.DiscoverDevices ( );
                    }
                    catch(Exception ex)
                    {
                        
                        throw;
                    }
                    // bc.HardwareStatus

                }
            }

     

    its not showing any error if the bluetooth doungle is not connected so please provide the solution

     

     

    Regards

    Ramesh

  • 09-05-2011 6:32 AM In reply to

    Re: Unabale to get an error on removal of bluetooth doungle.

    What version of 32feet.NET are you using?

    I guess you are running your app on desktop Windows and with the Microsoft Bluetooth stack?  That platform (MSFT+Win32) doesn't produce errors when doing discovery and the dongle has been unplugged, neither does creating a Socket produce an error.  Wierd huh!  A funny decision on their part.  So instead you can check BluetoothRadio.PrimaryRadio for null and if not null on the instance returned check Status and/or HardwareStatus.  (Though HardwareStatus would need the new code I'm working on, see http://32feet.codeplex.com/workitem/31087)

  • 09-05-2011 6:55 AM In reply to

    Re: Unabale to get an error on removal of bluetooth doungle.

     I am using 3.2.606.0 version.

    just now i rectified the problem using 

    bool CheckBluetoothconnection ( )
            {
                if(BluetoothRadio.PrimaryRadio != null)
                    return true;
                else
                {
                    MessageBox.Show ( "Bluetooth device not Installed. \rPlease plugin the Dongle or enable the bluetooth.",
                        "BlueTooth Connection Failed", MessageBoxButtons.OK ,MessageBoxIcon.Error  );
                    return false;
                }
            }

    but i am littele confused wheather it will work at continiously running program.

    when discovering devices ,while connection i am calling this function

    Is that fine to use this code?

Page 1 of 1 (3 items)
Copyright © 2001-2013 In The Hand Ltd. All rights reserved. Terms of Use and Privacy Policy. OrcsWeb's Windows Cloud Server Hosting