Getting notifications from a BLE device in C# with GATT is not working










0















I'm developing an application to receive data from an Arduino with a HM-10 module on it. I am writing a WPF .NET app, whilst using the UWP libraries for connecting to the BLE. I previously wrote a program to send data too and from the Arduino in a .NET Console application, which worked fine and I could send text to the Arduino and receive text back. When moving this over too my original project, it stopped working.



No error code was given, the program just stopped when attempting to subscribe to notifications from the characteristic that I was attempting to receive notifications from.



private static async void subscribeToData()

if (readwrite.CharacteristicProperties.HasFlag(GattCharacteristicProperties.Notify))

Console.WriteLine("Attempting subscription");
GattCommunicationStatus status = await readwrite.WriteClientCharacteristicConfigurationDescriptorAsync(
GattClientCharacteristicConfigurationDescriptorValue.None);
if (status == GattCommunicationStatus.Success)

Console.WriteLine("Recieving notifcations from device.");
recieve = false;

else

Console.WriteLine(status);






In the code above, the variable 'readwrite' is the characteristic that I am trying get notifications from. The console prints "Attempting subscription" then stops, with no error code. This code works fine in the console application, just not when copied across.



This is the full class:



class BluetoothHandler

private static BluetoothLEAdvertisementWatcher watcher = new
BluetoothLEAdvertisementWatcher ScanningMode =
BluetoothLEScanningMode.Active ;
private static BluetoothLEDevice ble;
private static List<GattCharacteristic> characterstics = new
List<GattCharacteristic> ;
private static GattCharacteristic readwrite;
private static bool subscribe = true;
private static bool recieve = true;

public static void InitiateConnection()

GetDiscoverableDevices();
while (subscribe)

//Block code

subscribeToData();
while (recieve)

//Block code

readwrite.ValueChanged += recieveDataAsync;


private static async void subscribeToData()

if (readwrite.CharacteristicProperties.HasFlag(GattCharacteristicProperties.Notify))

Console.WriteLine("Attempting subscription");
GattCommunicationStatus status = await readwrite.WriteClientCharacteristicConfigurationDescriptorAsync(
GattClientCharacteristicConfigurationDescriptorValue.None);
if (status == GattCommunicationStatus.Success)

Console.WriteLine("Recieving notifcations from device.");
recieve = false;

else

Console.WriteLine(status);





private static void recieveDataAsync(GattCharacteristic sender, GattValueChangedEventArgs args)

var reader = DataReader.FromBuffer(args.CharacteristicValue);
//var stream = new Windows.Storage.Streams.InMemoryRandomAccessStream();
reader.UnicodeEncoding = Windows.Storage.Streams.UnicodeEncoding.Utf8;
uint bufferLength = (uint)reader.UnconsumedBufferLength;
string receivedString = "";
receivedString += reader.ReadString(bufferLength) + "n";
Console.WriteLine("Recieved Message: " + receivedString);


public static void GetDiscoverableDevices()

Console.WriteLine("Search started");
watcher.Received += bluetoothFoundAsync;
watcher.ScanningMode = BluetoothLEScanningMode.Active;
watcher.Start();


private static async void bluetoothFoundAsync(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementReceivedEventArgs args)

string deviceName = args.Advertisement.LocalName;
if (deviceName == "Carduino")

var bdevice = await BluetoothLEDevice.FromBluetoothAddressAsync(args.BluetoothAddress);
watcher.Stop();
Console.WriteLine("Scan complete: Found Carduino");
bdevice.DeviceInformation.Pairing.Custom.PairingRequested +=
(ss, ev) =>

ev.Accept();
;
var result = await bdevice.DeviceInformation.Pairing.Custom.PairAsync(DevicePairingKinds.ConfirmOnly);
Console.WriteLine($"Pairing Result: result.Status");
if (result.Status == DevicePairingResultStatus.AlreadyPaired)

Console.WriteLine("Attempting Reconnection");
var a = await bdevice.DeviceInformation.Pairing.UnpairAsync();
var result2 = await bdevice.DeviceInformation.Pairing.Custom.PairAsync(DevicePairingKinds.ConfirmOnly);
Console.WriteLine($"Pairing Result: result2.Status");

ble = bdevice;
getServices();

else

Console.WriteLine("Couldn't find device: 'Carduino'");



private static async void getServices()

GattDeviceServicesResult result = await ble.GetGattServicesAsync();
if (result.Status == GattCommunicationStatus.Success)

var services = result.Services;
getCharacterstics(services);



private static async void getCharacterstics(IReadOnlyList<GattDeviceService> services)

foreach (GattDeviceService s in services)

GattCharacteristicsResult result = await s.GetCharacteristicsAsync();
if (result.Status == GattCommunicationStatus.Success)

var characteristicss = result.Characteristics;
foreach (GattCharacteristic c in characteristicss)

characterstics.Add(c);
if (c.Uuid == Guid.Parse("0000ffe1-0000-1000-8000-00805f9b34fb"))

readwrite = c;
Console.WriteLine("Found read/write characteristic");




subscribe = false;
Console.WriteLine("Got characteristics");






Thanks in advance.



Edit:



After further testing, it only seems to work in a console .NET application, and not in a windows form app or a .NET WPF app.










share|improve this question



















  • 2





    Writing None to the descriptor turns off notifications... Didn't you want to turn them on? And please, don't use busy-loops since they eat CPU cycles (your while(variable) /*block code*/). There are many other better ways, for example Wait/Notify.

    – Emil
    Nov 15 '18 at 8:26











  • @Emil It works fine with the none in the other program. I had them on notify earlier and was just changing it to see if it worked. And yeah I'm sorry about the while loops, I did a quick google on a better way and didn't find much. How should I do it?

    – William Holgate
    Nov 15 '18 at 11:55












  • I will not post this as an answer, because it is UWP, not WPF. Have a look at my example on GitHub:link And open MainPage.xaml.cs:link It will show you all you need to know to get you on your way.

    – GrooverFromHolland
    Nov 15 '18 at 17:37















0















I'm developing an application to receive data from an Arduino with a HM-10 module on it. I am writing a WPF .NET app, whilst using the UWP libraries for connecting to the BLE. I previously wrote a program to send data too and from the Arduino in a .NET Console application, which worked fine and I could send text to the Arduino and receive text back. When moving this over too my original project, it stopped working.



No error code was given, the program just stopped when attempting to subscribe to notifications from the characteristic that I was attempting to receive notifications from.



private static async void subscribeToData()

if (readwrite.CharacteristicProperties.HasFlag(GattCharacteristicProperties.Notify))

Console.WriteLine("Attempting subscription");
GattCommunicationStatus status = await readwrite.WriteClientCharacteristicConfigurationDescriptorAsync(
GattClientCharacteristicConfigurationDescriptorValue.None);
if (status == GattCommunicationStatus.Success)

Console.WriteLine("Recieving notifcations from device.");
recieve = false;

else

Console.WriteLine(status);






In the code above, the variable 'readwrite' is the characteristic that I am trying get notifications from. The console prints "Attempting subscription" then stops, with no error code. This code works fine in the console application, just not when copied across.



This is the full class:



class BluetoothHandler

private static BluetoothLEAdvertisementWatcher watcher = new
BluetoothLEAdvertisementWatcher ScanningMode =
BluetoothLEScanningMode.Active ;
private static BluetoothLEDevice ble;
private static List<GattCharacteristic> characterstics = new
List<GattCharacteristic> ;
private static GattCharacteristic readwrite;
private static bool subscribe = true;
private static bool recieve = true;

public static void InitiateConnection()

GetDiscoverableDevices();
while (subscribe)

//Block code

subscribeToData();
while (recieve)

//Block code

readwrite.ValueChanged += recieveDataAsync;


private static async void subscribeToData()

if (readwrite.CharacteristicProperties.HasFlag(GattCharacteristicProperties.Notify))

Console.WriteLine("Attempting subscription");
GattCommunicationStatus status = await readwrite.WriteClientCharacteristicConfigurationDescriptorAsync(
GattClientCharacteristicConfigurationDescriptorValue.None);
if (status == GattCommunicationStatus.Success)

Console.WriteLine("Recieving notifcations from device.");
recieve = false;

else

Console.WriteLine(status);





private static void recieveDataAsync(GattCharacteristic sender, GattValueChangedEventArgs args)

var reader = DataReader.FromBuffer(args.CharacteristicValue);
//var stream = new Windows.Storage.Streams.InMemoryRandomAccessStream();
reader.UnicodeEncoding = Windows.Storage.Streams.UnicodeEncoding.Utf8;
uint bufferLength = (uint)reader.UnconsumedBufferLength;
string receivedString = "";
receivedString += reader.ReadString(bufferLength) + "n";
Console.WriteLine("Recieved Message: " + receivedString);


public static void GetDiscoverableDevices()

Console.WriteLine("Search started");
watcher.Received += bluetoothFoundAsync;
watcher.ScanningMode = BluetoothLEScanningMode.Active;
watcher.Start();


private static async void bluetoothFoundAsync(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementReceivedEventArgs args)

string deviceName = args.Advertisement.LocalName;
if (deviceName == "Carduino")

var bdevice = await BluetoothLEDevice.FromBluetoothAddressAsync(args.BluetoothAddress);
watcher.Stop();
Console.WriteLine("Scan complete: Found Carduino");
bdevice.DeviceInformation.Pairing.Custom.PairingRequested +=
(ss, ev) =>

ev.Accept();
;
var result = await bdevice.DeviceInformation.Pairing.Custom.PairAsync(DevicePairingKinds.ConfirmOnly);
Console.WriteLine($"Pairing Result: result.Status");
if (result.Status == DevicePairingResultStatus.AlreadyPaired)

Console.WriteLine("Attempting Reconnection");
var a = await bdevice.DeviceInformation.Pairing.UnpairAsync();
var result2 = await bdevice.DeviceInformation.Pairing.Custom.PairAsync(DevicePairingKinds.ConfirmOnly);
Console.WriteLine($"Pairing Result: result2.Status");

ble = bdevice;
getServices();

else

Console.WriteLine("Couldn't find device: 'Carduino'");



private static async void getServices()

GattDeviceServicesResult result = await ble.GetGattServicesAsync();
if (result.Status == GattCommunicationStatus.Success)

var services = result.Services;
getCharacterstics(services);



private static async void getCharacterstics(IReadOnlyList<GattDeviceService> services)

foreach (GattDeviceService s in services)

GattCharacteristicsResult result = await s.GetCharacteristicsAsync();
if (result.Status == GattCommunicationStatus.Success)

var characteristicss = result.Characteristics;
foreach (GattCharacteristic c in characteristicss)

characterstics.Add(c);
if (c.Uuid == Guid.Parse("0000ffe1-0000-1000-8000-00805f9b34fb"))

readwrite = c;
Console.WriteLine("Found read/write characteristic");




subscribe = false;
Console.WriteLine("Got characteristics");






Thanks in advance.



Edit:



After further testing, it only seems to work in a console .NET application, and not in a windows form app or a .NET WPF app.










share|improve this question



















  • 2





    Writing None to the descriptor turns off notifications... Didn't you want to turn them on? And please, don't use busy-loops since they eat CPU cycles (your while(variable) /*block code*/). There are many other better ways, for example Wait/Notify.

    – Emil
    Nov 15 '18 at 8:26











  • @Emil It works fine with the none in the other program. I had them on notify earlier and was just changing it to see if it worked. And yeah I'm sorry about the while loops, I did a quick google on a better way and didn't find much. How should I do it?

    – William Holgate
    Nov 15 '18 at 11:55












  • I will not post this as an answer, because it is UWP, not WPF. Have a look at my example on GitHub:link And open MainPage.xaml.cs:link It will show you all you need to know to get you on your way.

    – GrooverFromHolland
    Nov 15 '18 at 17:37













0












0








0


0






I'm developing an application to receive data from an Arduino with a HM-10 module on it. I am writing a WPF .NET app, whilst using the UWP libraries for connecting to the BLE. I previously wrote a program to send data too and from the Arduino in a .NET Console application, which worked fine and I could send text to the Arduino and receive text back. When moving this over too my original project, it stopped working.



No error code was given, the program just stopped when attempting to subscribe to notifications from the characteristic that I was attempting to receive notifications from.



private static async void subscribeToData()

if (readwrite.CharacteristicProperties.HasFlag(GattCharacteristicProperties.Notify))

Console.WriteLine("Attempting subscription");
GattCommunicationStatus status = await readwrite.WriteClientCharacteristicConfigurationDescriptorAsync(
GattClientCharacteristicConfigurationDescriptorValue.None);
if (status == GattCommunicationStatus.Success)

Console.WriteLine("Recieving notifcations from device.");
recieve = false;

else

Console.WriteLine(status);






In the code above, the variable 'readwrite' is the characteristic that I am trying get notifications from. The console prints "Attempting subscription" then stops, with no error code. This code works fine in the console application, just not when copied across.



This is the full class:



class BluetoothHandler

private static BluetoothLEAdvertisementWatcher watcher = new
BluetoothLEAdvertisementWatcher ScanningMode =
BluetoothLEScanningMode.Active ;
private static BluetoothLEDevice ble;
private static List<GattCharacteristic> characterstics = new
List<GattCharacteristic> ;
private static GattCharacteristic readwrite;
private static bool subscribe = true;
private static bool recieve = true;

public static void InitiateConnection()

GetDiscoverableDevices();
while (subscribe)

//Block code

subscribeToData();
while (recieve)

//Block code

readwrite.ValueChanged += recieveDataAsync;


private static async void subscribeToData()

if (readwrite.CharacteristicProperties.HasFlag(GattCharacteristicProperties.Notify))

Console.WriteLine("Attempting subscription");
GattCommunicationStatus status = await readwrite.WriteClientCharacteristicConfigurationDescriptorAsync(
GattClientCharacteristicConfigurationDescriptorValue.None);
if (status == GattCommunicationStatus.Success)

Console.WriteLine("Recieving notifcations from device.");
recieve = false;

else

Console.WriteLine(status);





private static void recieveDataAsync(GattCharacteristic sender, GattValueChangedEventArgs args)

var reader = DataReader.FromBuffer(args.CharacteristicValue);
//var stream = new Windows.Storage.Streams.InMemoryRandomAccessStream();
reader.UnicodeEncoding = Windows.Storage.Streams.UnicodeEncoding.Utf8;
uint bufferLength = (uint)reader.UnconsumedBufferLength;
string receivedString = "";
receivedString += reader.ReadString(bufferLength) + "n";
Console.WriteLine("Recieved Message: " + receivedString);


public static void GetDiscoverableDevices()

Console.WriteLine("Search started");
watcher.Received += bluetoothFoundAsync;
watcher.ScanningMode = BluetoothLEScanningMode.Active;
watcher.Start();


private static async void bluetoothFoundAsync(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementReceivedEventArgs args)

string deviceName = args.Advertisement.LocalName;
if (deviceName == "Carduino")

var bdevice = await BluetoothLEDevice.FromBluetoothAddressAsync(args.BluetoothAddress);
watcher.Stop();
Console.WriteLine("Scan complete: Found Carduino");
bdevice.DeviceInformation.Pairing.Custom.PairingRequested +=
(ss, ev) =>

ev.Accept();
;
var result = await bdevice.DeviceInformation.Pairing.Custom.PairAsync(DevicePairingKinds.ConfirmOnly);
Console.WriteLine($"Pairing Result: result.Status");
if (result.Status == DevicePairingResultStatus.AlreadyPaired)

Console.WriteLine("Attempting Reconnection");
var a = await bdevice.DeviceInformation.Pairing.UnpairAsync();
var result2 = await bdevice.DeviceInformation.Pairing.Custom.PairAsync(DevicePairingKinds.ConfirmOnly);
Console.WriteLine($"Pairing Result: result2.Status");

ble = bdevice;
getServices();

else

Console.WriteLine("Couldn't find device: 'Carduino'");



private static async void getServices()

GattDeviceServicesResult result = await ble.GetGattServicesAsync();
if (result.Status == GattCommunicationStatus.Success)

var services = result.Services;
getCharacterstics(services);



private static async void getCharacterstics(IReadOnlyList<GattDeviceService> services)

foreach (GattDeviceService s in services)

GattCharacteristicsResult result = await s.GetCharacteristicsAsync();
if (result.Status == GattCommunicationStatus.Success)

var characteristicss = result.Characteristics;
foreach (GattCharacteristic c in characteristicss)

characterstics.Add(c);
if (c.Uuid == Guid.Parse("0000ffe1-0000-1000-8000-00805f9b34fb"))

readwrite = c;
Console.WriteLine("Found read/write characteristic");




subscribe = false;
Console.WriteLine("Got characteristics");






Thanks in advance.



Edit:



After further testing, it only seems to work in a console .NET application, and not in a windows form app or a .NET WPF app.










share|improve this question
















I'm developing an application to receive data from an Arduino with a HM-10 module on it. I am writing a WPF .NET app, whilst using the UWP libraries for connecting to the BLE. I previously wrote a program to send data too and from the Arduino in a .NET Console application, which worked fine and I could send text to the Arduino and receive text back. When moving this over too my original project, it stopped working.



No error code was given, the program just stopped when attempting to subscribe to notifications from the characteristic that I was attempting to receive notifications from.



private static async void subscribeToData()

if (readwrite.CharacteristicProperties.HasFlag(GattCharacteristicProperties.Notify))

Console.WriteLine("Attempting subscription");
GattCommunicationStatus status = await readwrite.WriteClientCharacteristicConfigurationDescriptorAsync(
GattClientCharacteristicConfigurationDescriptorValue.None);
if (status == GattCommunicationStatus.Success)

Console.WriteLine("Recieving notifcations from device.");
recieve = false;

else

Console.WriteLine(status);






In the code above, the variable 'readwrite' is the characteristic that I am trying get notifications from. The console prints "Attempting subscription" then stops, with no error code. This code works fine in the console application, just not when copied across.



This is the full class:



class BluetoothHandler

private static BluetoothLEAdvertisementWatcher watcher = new
BluetoothLEAdvertisementWatcher ScanningMode =
BluetoothLEScanningMode.Active ;
private static BluetoothLEDevice ble;
private static List<GattCharacteristic> characterstics = new
List<GattCharacteristic> ;
private static GattCharacteristic readwrite;
private static bool subscribe = true;
private static bool recieve = true;

public static void InitiateConnection()

GetDiscoverableDevices();
while (subscribe)

//Block code

subscribeToData();
while (recieve)

//Block code

readwrite.ValueChanged += recieveDataAsync;


private static async void subscribeToData()

if (readwrite.CharacteristicProperties.HasFlag(GattCharacteristicProperties.Notify))

Console.WriteLine("Attempting subscription");
GattCommunicationStatus status = await readwrite.WriteClientCharacteristicConfigurationDescriptorAsync(
GattClientCharacteristicConfigurationDescriptorValue.None);
if (status == GattCommunicationStatus.Success)

Console.WriteLine("Recieving notifcations from device.");
recieve = false;

else

Console.WriteLine(status);





private static void recieveDataAsync(GattCharacteristic sender, GattValueChangedEventArgs args)

var reader = DataReader.FromBuffer(args.CharacteristicValue);
//var stream = new Windows.Storage.Streams.InMemoryRandomAccessStream();
reader.UnicodeEncoding = Windows.Storage.Streams.UnicodeEncoding.Utf8;
uint bufferLength = (uint)reader.UnconsumedBufferLength;
string receivedString = "";
receivedString += reader.ReadString(bufferLength) + "n";
Console.WriteLine("Recieved Message: " + receivedString);


public static void GetDiscoverableDevices()

Console.WriteLine("Search started");
watcher.Received += bluetoothFoundAsync;
watcher.ScanningMode = BluetoothLEScanningMode.Active;
watcher.Start();


private static async void bluetoothFoundAsync(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementReceivedEventArgs args)

string deviceName = args.Advertisement.LocalName;
if (deviceName == "Carduino")

var bdevice = await BluetoothLEDevice.FromBluetoothAddressAsync(args.BluetoothAddress);
watcher.Stop();
Console.WriteLine("Scan complete: Found Carduino");
bdevice.DeviceInformation.Pairing.Custom.PairingRequested +=
(ss, ev) =>

ev.Accept();
;
var result = await bdevice.DeviceInformation.Pairing.Custom.PairAsync(DevicePairingKinds.ConfirmOnly);
Console.WriteLine($"Pairing Result: result.Status");
if (result.Status == DevicePairingResultStatus.AlreadyPaired)

Console.WriteLine("Attempting Reconnection");
var a = await bdevice.DeviceInformation.Pairing.UnpairAsync();
var result2 = await bdevice.DeviceInformation.Pairing.Custom.PairAsync(DevicePairingKinds.ConfirmOnly);
Console.WriteLine($"Pairing Result: result2.Status");

ble = bdevice;
getServices();

else

Console.WriteLine("Couldn't find device: 'Carduino'");



private static async void getServices()

GattDeviceServicesResult result = await ble.GetGattServicesAsync();
if (result.Status == GattCommunicationStatus.Success)

var services = result.Services;
getCharacterstics(services);



private static async void getCharacterstics(IReadOnlyList<GattDeviceService> services)

foreach (GattDeviceService s in services)

GattCharacteristicsResult result = await s.GetCharacteristicsAsync();
if (result.Status == GattCommunicationStatus.Success)

var characteristicss = result.Characteristics;
foreach (GattCharacteristic c in characteristicss)

characterstics.Add(c);
if (c.Uuid == Guid.Parse("0000ffe1-0000-1000-8000-00805f9b34fb"))

readwrite = c;
Console.WriteLine("Found read/write characteristic");




subscribe = false;
Console.WriteLine("Got characteristics");






Thanks in advance.



Edit:



After further testing, it only seems to work in a console .NET application, and not in a windows form app or a .NET WPF app.







c# .net arduino bluetooth-lowenergy bluetooth-gatt






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 16:30







William Holgate

















asked Nov 15 '18 at 8:16









William HolgateWilliam Holgate

134




134







  • 2





    Writing None to the descriptor turns off notifications... Didn't you want to turn them on? And please, don't use busy-loops since they eat CPU cycles (your while(variable) /*block code*/). There are many other better ways, for example Wait/Notify.

    – Emil
    Nov 15 '18 at 8:26











  • @Emil It works fine with the none in the other program. I had them on notify earlier and was just changing it to see if it worked. And yeah I'm sorry about the while loops, I did a quick google on a better way and didn't find much. How should I do it?

    – William Holgate
    Nov 15 '18 at 11:55












  • I will not post this as an answer, because it is UWP, not WPF. Have a look at my example on GitHub:link And open MainPage.xaml.cs:link It will show you all you need to know to get you on your way.

    – GrooverFromHolland
    Nov 15 '18 at 17:37












  • 2





    Writing None to the descriptor turns off notifications... Didn't you want to turn them on? And please, don't use busy-loops since they eat CPU cycles (your while(variable) /*block code*/). There are many other better ways, for example Wait/Notify.

    – Emil
    Nov 15 '18 at 8:26











  • @Emil It works fine with the none in the other program. I had them on notify earlier and was just changing it to see if it worked. And yeah I'm sorry about the while loops, I did a quick google on a better way and didn't find much. How should I do it?

    – William Holgate
    Nov 15 '18 at 11:55












  • I will not post this as an answer, because it is UWP, not WPF. Have a look at my example on GitHub:link And open MainPage.xaml.cs:link It will show you all you need to know to get you on your way.

    – GrooverFromHolland
    Nov 15 '18 at 17:37







2




2





Writing None to the descriptor turns off notifications... Didn't you want to turn them on? And please, don't use busy-loops since they eat CPU cycles (your while(variable) /*block code*/). There are many other better ways, for example Wait/Notify.

– Emil
Nov 15 '18 at 8:26





Writing None to the descriptor turns off notifications... Didn't you want to turn them on? And please, don't use busy-loops since they eat CPU cycles (your while(variable) /*block code*/). There are many other better ways, for example Wait/Notify.

– Emil
Nov 15 '18 at 8:26













@Emil It works fine with the none in the other program. I had them on notify earlier and was just changing it to see if it worked. And yeah I'm sorry about the while loops, I did a quick google on a better way and didn't find much. How should I do it?

– William Holgate
Nov 15 '18 at 11:55






@Emil It works fine with the none in the other program. I had them on notify earlier and was just changing it to see if it worked. And yeah I'm sorry about the while loops, I did a quick google on a better way and didn't find much. How should I do it?

– William Holgate
Nov 15 '18 at 11:55














I will not post this as an answer, because it is UWP, not WPF. Have a look at my example on GitHub:link And open MainPage.xaml.cs:link It will show you all you need to know to get you on your way.

– GrooverFromHolland
Nov 15 '18 at 17:37





I will not post this as an answer, because it is UWP, not WPF. Have a look at my example on GitHub:link And open MainPage.xaml.cs:link It will show you all you need to know to get you on your way.

– GrooverFromHolland
Nov 15 '18 at 17:37












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53315015%2fgetting-notifications-from-a-ble-device-in-c-sharp-with-gatt-is-not-working%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53315015%2fgetting-notifications-from-a-ble-device-in-c-sharp-with-gatt-is-not-working%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3

Museum of Modern and Contemporary Art of Trento and Rovereto