'Defining GattCharacteristic as a Server

I want to fill my variable "selectedCharacteristic" with

    GattCharacteristic selectedCharacteristic
    selectedCharacteristic = Constants.ResultCharacteristicUuid;

Unfortunately, this doesn't work. It won't convert.

The ResultCharacteristicUuid is from the Microsoft UWP BLE Example.

https://github.com/microsoft/Windows-universal-samples/blob/main/Samples/BluetoothLE/cs/Constants.cs

My program, which has not much to do with the microsoft example (besides the constants.cs), opens up a BLE Service on start, along with the Result-Characteristic. It acts as an BLE server, nothing more.

So when my BLE Server started, there should be a simple solution to get the device infos and everything GattCharacteristic needs, or not?

The goal is to write to the characteristic as the server, not as a client.

What do I need to get the ResultCharacteristic-Uuid into selectedCharacteristic ?



Solution 1:[1]

The UUID should be defined by yourself when you are creating your own service, characteristic. Based on the document- Bluetooth GATT server, you could generate your custom UUID from Visual Studio through Tools -> CreateGuid (use option 5 to get it in the "xxxxxxxx-xxxx-...xxxx" format). This uuid can now be used to declare new local services, characteristics or descriptors.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Roy Li - MSFT