Skip to content

Seeing nearby bluetooth-low-energy devices , getting information about devices by triggering events (update, add,remove) Seeing information about Gatt, Gap protocol services, characters, features and attributes. A console application that provides write, read and subscribe, communication between client and server.

Notifications You must be signed in to change notification settings

orcunor/Bluetooth_Low_Energy_Devices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bluetooth Low Energy Devices Communication - Pairing and Connecting , Device Enumeration

Seeing nearby bluetooth-low-energy devices, getting information about devices by triggering events (update, add,remove, enumerate devices) Seeing information about Gatt, Gap protocol services, characters, features and attributes. A console application that provides write, read and subscribe, communication between client and server.

Documentation

You can check the Bluetooth Documentation.pdf file I prepared for documentation.

Requirements:

Windows 10, atleast BT 4.0 adapter or above

Build in Visual Studio

For building from source, Microsoft Visual Studio is required (free, Community edition will work).

Start Microsoft Visual Studio and select File > Open > Project/Solution. Double-click the Visual Studio Solution (.sln) file. Press Ctrl+Shift+B, or select Build > Build Solution.

Run the debug session

To debug the application and then run it, press F5 or select Debug > Start Debugging. To run without debugging, press Ctrl+F5 or selectDebug > Start Without Debugging.

Some debug information available in the "Output" section in Visual St

Example of code:

public void StartWatcher()
       {
           try
           {

            string[] requestedProperties = { "System.Devices.Aep.DeviceAddress", "System.Devices.Aep.IsConnected", "System.Devices.Aep.Manufacturer", "System.Devices.Aep.ModelName", "System.Devices.Aep.ModelId" };

            deviceWatcher =
                      DeviceInformation.CreateWatcher(
                          BluetoothLEDevice.GetDeviceSelectorFromPairingState(false),
                              requestedProperties,
                              DeviceInformationKind.AssociationEndpoint);

            // Register event handlers before starting the watcher.
            // Added, Updated and Removed are required to get all nearby devices
            deviceWatcher.Added += DeviceWatcher_Added;
            deviceWatcher.Updated += DeviceWatcher_Updated;
            deviceWatcher.Removed += DeviceWatcher_Removed;

            // EnumerationCompleted and Stopped are optional to implement.
            deviceWatcher.EnumerationCompleted += DeviceWatcher_EnumerationCompleted;
            deviceWatcher.Stopped += DeviceWatcher_Stopped;


            // Start the watcher.
            deviceWatcher.Start();

        }

        catch (Exception ex)
        {

            Console.WriteLine("Exception -> ", ex.Message);
        }
    }

About

Seeing nearby bluetooth-low-energy devices , getting information about devices by triggering events (update, add,remove) Seeing information about Gatt, Gap protocol services, characters, features and attributes. A console application that provides write, read and subscribe, communication between client and server.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages