Coder Social home page Coder Social logo

newky2k / dsoft.system.bluetoothle Goto Github PK

View Code? Open in Web Editor NEW
13.0 3.0 3.0 1.53 MB

Cross-platform Bluetooth Low Energy library, based on Plugin.BLE, for Xamarin.iOS, Xamarin.Android, UWP, Xamarin.Mac, .Net Core, TVOS(Preview) and WatchOS(Preview), Tizen(Coming soon)

License: Apache License 2.0

C# 100.00%
xamarin uwp xamarin-forms netcore bluetooth bluetooth-low-energy bluetooth-le android ios tizen

dsoft.system.bluetoothle's Introduction

Hi there, I'm Dave ๐Ÿ‘‹

I've have been into coding since I was a kid, and I get to do my hobby for a job!

I have worked for The Access Group, Xamarin and Microsoft and am currently working for Evoke Systems. I am also working on RainyDay Backup, a backup system for Azure DevOps and Version Changer for Visual Studio, an addin for updating project version numbers.

When not working for money, I spend my time on my opensource projects like Cross-platform Bluetooth library, Cross-platform MVVM library, Web-API client library for JSON and gRPC and many others.

dsoft.system.bluetoothle's People

Contributors

newky2k avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dsoft.system.bluetoothle's Issues

Access Denied When Executing "GetCharacteristicsAsync()" for Write Characteristic

Hi dude @newky2k ,

you are claiming that your library is supporting .NET Framework 4.6.1+.
Did you test your code running in a Win32 e.g. console application? If you did and it is working, maybe you can assist me because I have a serious problem when trying to get the write characteristics from our bluetooth LE device.

I show you inside your code what ALWAYS gives me GattCommunicationStatus.AccessDenied:
You are using: var result = await NativeService.GetCharacteristicsAsync(BluetoothLE.CacheModeGetCharacteristics); in your GattService (https://github.com/newky2k/DSoft.System.BluetoothLe/blob/master/DSoft.System.BluetoothLe/Service/Service.uwp.netcore.netf.cs).
There is another method you can call to directly get a known characteristic, so we use:
var result = await NativeService.GetCharacteristicsForUuidAsync(uuid, BluetoothCacheMode.Cached);
This works when getting the read characteristic but ALWAYS gives result.Status == GattCommunicationStatus.AccessDenied when getting the write characteristic.

If I use the same method as you (NativeService.GetCharacteristicsAsync(BluetoothLE.CacheModeGetCharacteristics)), it also fails with GattCommunicationStatus.AccessDenied.
But the call var accessRequestResponse = await NativeService.RequestAccessAsync(); ALWAYS returns DeviceAccessStatus.Allowed.

I also asked those questions at stackoverflow, within discussions of Shiny library and in the Developer Community of Visual Studio.

If you have ANY hint or advice, I would really appreciate it!

Kind regards,

Mathias Hartner

For UWP Project: Bluetooth State always ON

While running WUP app, disable on board blue Tooth Get state as so:
Run code below , state will be on, StateChange even will never get triggered :

var ble = CrossBluetoothLE.Current;
....
var state = ble.State;
.....
ble.StateChanged += (s, e) =>
{
Debug.WriteLine($"The bluetooth state changed to {e.NewState}");
};

DeviceFoundAsync spuriously throws an Exception

This does not happen all the time, but rarely. Looks like a race condition for me:

Stacktraces I managed to capture:

Message: Value does not fall within the expected range.

at System.BluetoothLe.Adapter.DeviceFoundAsync(BluetoothLEAdvertisementWatcher watcher, BluetoothLEAdvertisementReceivedEventArgs btAdv)\r\n   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)\r\n   at System.Threading.ThreadPoolWorkQueue.Dispatch()\r\n   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()

or

"Message":"Schwerwiegender Fehler (0x8000FFFF (E_UNEXPECTED))"

 at System.BluetoothLe.Adapter.DeviceFoundAsync(BluetoothLEAdvertisementWatcher watcher, BluetoothLEAdvertisementReceivedEventArgs btAdv)\r\n   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)\r\n   at System.Threading.ThreadPoolWorkQueue.Dispatch()

both seem to be thrown unobserved, which makes catching them difficult.

I do not have more stacktraces atm, this mangled stuff comes from our error reporting system.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.