The standard Microsoft GATT API (legacy and modern WinRT (UWP)) has some problems with device connections management. When your application connects to a remote GATT-enabled device (peripheral), you cannot disconnect it from the server in an easy way. The Microsoft WinRT (and legacy) GATT API does not provide any Disconnect method. Also, when your application acts as a GATT server (peripheral), there is no event that can notify your application when a remote client is connected to and disconnected from your server. And this is the big problem.
Why This Is The Problem?
When your GATT client application finished its work with a peripheral device, it needs to disconnect. The disconnection is critical because most peripheral devices will not accept any new connections while there is an active one. Also, peripheral devices usually stop advertising when any active connection exists. So your or any other application is not able to find your peripheral device because WinRT API did not close the connection. You need to close your application and start again to release the device.
If your application is a GATT server (peripheral), you need to know when a remote client (central) is connected to and disconnected from your application. There are many reasons why you need it: your application may need to prepare data, to initialize internal state, and many other reasons. However, the standard Microsoft UWP GATT API does not provide any events to notify your application about a remote client connection state. You even cannot know when a client disconnected to do a cleanup.
The Solution
Fortunately, the Bluetooth Framework library can solve all the GATT connection problems. If your application is connected to a remote GATT-enabled device and, when it finishes all the communication and needs to disconnect, the Bluetooth Framework executes the real disconnection immediately. So now your peripheral device can be discovered and connected again. Also, the library can easily detect when a remote GATT server (peripheral) terminates connection for different reasons, even if it was turned off. To test this feature, download the Bluetooth Framework package and run the GattClient sample application.
The other problem is the connection state detection when your application runs as a GATT server. The standard Microsoft WinRT UWP GATT API can notify your application only when a client subscribes, unsubscribes, reads, or writes a characteristic. It is not very useful if your application needs a complex initialization when the client connects. Also, the client can subscribe to more than one characteristic and read or write a few times. And of course there is no event that can notify your application when a remote client disconnects. That makes it impossible to do a clean-up and makes client connection management too complex.
In the versions before 7.19.8 the Bluetooth Framework emulated the client connection event based on client subscribing, reading, and writing. That worked somehow but not actually very well. And of course, the Bluetooth Framework SDK provided a client disconnection detection mechanism. But because of the first reason, it did not work very well too.
And now, starting from version 7.19.8 the Bluetooth Framework is able to do a real client connection detection. The library is able to detect when a client connects to the server without needing to subscribe, read, or write a characteristic. The notification is immediately sent to your application when a client connects and disconnects. Also, the library allows your application to disconnect any connected client. To test this unique feature, download the Bluetooth Framework package and run the GattServer sample application.