hashtagchris / DotNet-BlueZ

A quick and dirty library for BlueZ's D-Bus APIs. Focus is on Bluetooth Low Energy APIs.
Apache License 2.0
103 stars 37 forks source link

Subscribe to GATT Characteristic Notifications not found #23

Open esleybonomo opened 2 years ago

esleybonomo commented 2 years ago

Hello guys,

I need make a communication with a fat scale equipment in .Net core, so i need followings:

So, I can't get the notify value. I looked for samples, but I didn't find it. I beleave that I'm doing anything wrong in code.

Look it:

          private async Task GetNotificationBodyFatScaleAsync()
          {
              var characteristic = await LoadCharacteristic(CHARACTERISTIC_MEASURE);
              characteristic.Value += BodyFatScaleDataReceivedAsync;
          }

        private async Task BodyFatScaleDataReceivedAsync(GattCharacteristic sender, GattCharacteristicValueEventArgs eventArgs)
        {
            try
            {
                Console.Out.WriteLine($"Received event from fat scale {eventArgs.Value}");
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex);
            }
        }

I'm following by this one https://github.com/hashtagchris/DotNet-BlueZ#subscribe-to-gatt-characteristic-notifications

Could you help me? Could you send me an example? Or are there any error in lib?