Coder Social home page Coder Social logo

blewinrtdll's Introduction

UWP BLE packed as C++ winrt dll

To try it out in Unity, open the project "BleWinrtDll Unity" in Unity. Then start the scene "Assets/Scenes/Demo.scene".

This VisualStudio-project compiles to a C++-dll that can be imported into Unity. It wraps a part of the UWP BLE API inside a dll. The dll can be simply dropped into your Unity project and be used in the Unity Editor and the Windows standalone version.

Screenshot of the demo scene.

The Demo.scene in this repo uses non-blocking calls to avoid creating Threads. I would recommend to use threads, though. After getting acquainted with the standard C# Thread API and after making sure you're closing all your threads OnApplicationQuit (Unity API) to avoid Unity Editor freezes, using them is the easier workflow for BLE in my opinion. You'll need less lines of code and you can have less latency. For a threaded version, you can try out Joelx's Unity Ble Demo.

If you distribute a Windows Standalone build to a different device, please ensure that your application requires the latest Microsoft Visual C++ Redistributable to be installed.

Build

There is a prebuilt dll included in this repo, BleWinrtDll Unity\Assets\BleWinrtDll.dll or DebugBle\BleWinrtDll.dll (both are the same). But you can also build the dll yourself in VisualStudio. Follow these steps:

  • Open the file BleWinrtDll.sln with VisualStudio (tested with Community 2019). You may be asked to install VisualStudio components when you open the project. The needed components are C++ Desktop and UWP, or if you want to save space, just the single components "MSVC C++ Buildtools", "Windows 10 SDK"/"Windows 11 SDK" (depending on your os), ".NET Framework 4.7.2 SDK".
  • Choose configuration "Release" and "x64" (I think it must match your machine architecture).
  • In the project explorer, right-click the project "BleWinrtDll" and choose "Compile".
  • If you run into the error wait_for is not a member of winrt::impl, follow the steps on #16 and leave a thumbs up. If enough thumbs accumulate, someone or me will try to make that more convenient.
  • Wait until the compilation finishes successfully.

Now you find the file BleWinrtDll.dll in the folder x64/Release. You can copy this dll into your Unity-project. To try it out, you can also copy the file into the DebugBle folder (replacing the existing file) and start the DebugBle project. If your computer has bluetooth enabled, you should see some scanned bluetooth devices. If you modify the file DebugBle/Program.cs and change the device name, service UUID and characteristic UUIDs to match your specific BLE device, you should also receive some packages from your BLE device.

FAQ

Q: I try to read data but nothing is returned.

This dll doesn't implement ReadValue. You can add it yourself, see #45 (comment) . This dll implements SubscribeValue. After the subscription you can poll for data updates.

Q: Sending data to the device does not work.

Try replacing WriteWithoutResponse with WriteWithResponse (#66 (comment)).

Q: I want to run it on HoloLens 2.

You need specific configuration for that. See #23 on how to do that.

Alternatives

win32 Bluetooth API, as used by https://github.com/DerekGn/WinBle (thanks to david-sackstein).

Bluetooth Framework by Soft Service Company. It is paid and you can get support. You also find answers on stackoverflow.

If you find more, you are welcome to report them, e.g. via opening an issue.

Background

The Unity Editor is working with .NET-Framework but Microsoft's BLE API is only usable with .NET-Core. There is a C#-wrapper for .NET-Core functions, but these wrappers don't work in Unity for Unity-specific reasons. You can find some details in this blog-post by Mike Taulty. The blog-post also motivated me during the development of this dll.

As of now, .NET 4.6 or .NET Standard 2.0 allows you to access the WinRT API from C# in Unity, but only from the UWP and Xbox platforms. When Unity switches over to .NET Core, the API should be accessible from other platforms as well. However, the Unity Editor always uses Mono. Therefore, you may always need a dll solution for editor testing. If you plan on using the WinRT API directly from C# now through UWP/XBOX or in the future with .NET Core integration, know the dll's API is strongly leaned on Windows' own API. Actually, it is only a wrapper (plus some subtle thread handling). So doing so shouldn't be much work.

This project is based on Microsoft's Bluetooth Low Energy sample. It contains UWP and the corresponding C++-winrt code for every function that you find in this repo.

Furthermore I used the included 420-slide presentation on bluetooth low energy to get an understanding of what maximum throughput and latency can be achieved with BLE. I found it on the web but don't know the author.

blewinrtdll's People

Contributors

abrahamh08 avatar adabru avatar ehauner avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blewinrtdll's Issues

Write to FTMS Device

Hi,
I am using your library to read the data from the BLE sensors and I was able to receive the information correctly.
Now I would also need to write data on some devices (such as assigning the friction to a roller). I am using the WritePackage but I can never write! I also tried your example but without any success.

To be precise I'm trying to write on the 00002ad9-0000-1000-8000-00805f9b34fb characteristics of the 00001826-0000-1000-8000-00805f9b34fb service

Thank you so much.
Matteo.

Make BLE.cs generally usable

It would be nice to have a C# file that can be imported into a Unity project and used as is. My idea is to move the file BLE.cs into the top directory and add the possibility to read the data from a received package.

Other stuff can be added when new feedback comes in.

Subscribe never finishes

I have a custom device that I am trying to interact with and using another plugin (for android and ios) I got it to work nicely ( https://assetstore.unity.com/packages/tools/network/bluetooth-le-for-ios-tvos-and-android-26661 ) but now I am trying to get support for Windows too (and especially inside the Unity Editor for quick prototyping).

On the demo scene after selecting my device, the correct service, and the correct characteristic, hitting Subscribe does nothing (by "does nothing" I mean that "if I change it to "block: true" it just freezes the demo scene).

Any idea here?

Unable to write to device

Hiya,

I recently started use this library and It is amazing, thank you very much.

I am trying to get this working in the Unity Editor for faster debugging. After connecting to my BLE device I am able to receive data just fine but the device does not receive any data I try to send.

I know the device works because I can send data through our webpage.

I am not too familiar with Bluetooth development so I was wondering if anyone had run into this issue. I was also wondering what the best way I can debug this issue is?

Thank you.

Choice of low level implementation

Thanks adabru for this project.
I have a question about your choice of the WinRT for your low level implementation.
Is there any reason why you did not use the apis in C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\bluetoothleapis.h? (as in https://github.com/DerekGn/WinBle) ?
Will they not work in Unity?
Thanks

Connection with multiple devices

Hi, thank you for this amazing repository. I was using your code to connect to a single custom device without problem for a project. In particular, I modified it using threads so that I could receive packages and in the meantime be able to do other things with the Unity application. Now I want to connect multiple devices at once. Is it possible? I tried with multiple instance of the same class but they seem to interfere with each other.

Since I don't have much experience in programming, I tried momentarily to create two different classes that utilize two different dlls. In this way I seem to be able to receive packets correctly from two devices at the same time. However, this method is not sustainable in case I want to connect more than two devices. Is there a way to connect to more than one device without using the gimmick I am using right now? Is it possible that I am missing something and is it easier than it seems?

Thank you!

Problems connecting two devices at the same time.

I would like to connect 2 BLE devices simultaneously with unity. For this I copied the demo script and did the same for the canvas. The goal is to connect one device at a time via a canvas. The functions of the canvas I have of course connected to the copied demo script. However, I can now connect to one canvas and also subscribe to it, but as soon as I search for devices in the second canvas, no devices are displayed. Do I have to connect the copied demo script to another cpp script or is there another way to connect two devices at the same time?

Multiple BLE connections alternating so buffer doesnt get overflood

Hello I managed to connect 3 BLE devices and everything works super fine, thanks for the DLL.

But for my application (thesis). I have to read data simultaneously meaning that I am reading 0.5 seconds the data from Sensor1, then 1 second reading my sensor 2, and then sensor 3. The buffer data always gets messed up and my code is reading the wrong sensor for each data field. Is it possible to switch between connected BLE devices and then make a scheduler to indicate when every sensor is allowed to read or is this simply not possible with your DLL? Thanks in advance

Danke!

Hi, ich schreibe einfach mal auf Deutsch, weil ich eben gesehen habe, dass Du aus NRW kommst ;)
Wollte einfach schnell "Danke(!)" sagen für das coole Projekt hier.
Ich wollte vor etwa einem Jahr auch eine BLE Schnittstelle für Desktop Projekte in Unity implementieren. Nach ziemlich langer Recherche (und auch etwas Verwunderung) bin ich dann auch zu dem Schluss gekommen, dass ein derartiger "DLL-Wrapper" wohl die einzig (?) vernünftige Lösung zu sein scheint. Ich hatte aber nie die Muße das tatsächlich mal umzusetzen, weil ich bei meinem spezifischen Projekt erstmal mit ANT+ weiterarbeiten konnte.
Nun habe ich mich aber nochmal damit beschäftigt und bin auf deinen Stackoverflow Post hier gestoßen ( https://stackoverflow.com/questions/60686302/ble-device-with-unity#comment107382716_60686302 ).

Habe mit deinem Projekt hier gerade alles innerhalb von 5-10 Minuten zum Laufen gebracht. VIELEN DANK!! Echt spitzen Arbeit!

Missing DLL after Build

The readme mentions that this dll should work for a Windows Standalone build, but I have been unable to actually produce a working build of this project or my own which was was built with the existing BleApi.cs script. I am not terribly familiar with dll's in unity, and the available answers around the web are unclear to me. On each frame, I receive a DLLNotFoundException for BleWinrtDll.dll immediately at startup after building. This is not an issue when using the Unity editor. Could anyone shed light on what I'm doing wrong?

To be clear, this is only after building the application and using it on a different device. The standalone will work on the device that is is built on.

SubscribeCharacteristicAsync error

it's working when query fe55 / 0001 bytes from a google daydream controller, but, report failure in SubscribeCharacteristicAsync() / characteristic.WriteClientCharacteristicConfigurationDescriptorAsync(), when I'm trying to get data from 180a / 2a25 (or 180f/2a29 which is the 1 byte battery data), which was supposed to be a string of some 34 bytes serial numbers.
Would you help me to figure out why?

Laptop BLE no issue Resolving Characteristics, Desktop has issues...

So tested this with laptop, after a windows update I had to get the latest intel BLE drivers but laptop can resolve services and characteristics and then write to device.

On Desktop my motherboards BLE could not resolve services until I updated the intel BLE driver but it would then never resolve characteristics. I went out and got an ASUS BLE Dongle and it too has the same issue, and if I can't resolve the characteristics I can't write to the device or subscribe.

Has anyone noticed any odd issues like this? Where it works on some machines but not others?

The Same BLE project by microsoft has no issue, so I'll be looking at their code and trying to understand what may be different.

Clarification of Readme with regards to unity editor

I think this statement needs clarification:
"With Unity's future integration of C# version 5 this repo most probably should become obsolete as C# version 5 is meant to merge .NET-Framework and .NET-Core so you should be able to call Windows' BLE API directly from C# then."

https://docs.unity3d.com/Manual/windowsstore-scripts.html notes that the Unity Editor always uses mono. That means that while you can build your application with calls to the Windows SDK, you cannot test it in the editor. This is important because when building for platforms like Android, the entire purpose of integrating BLE for windows is just to test the application in the editor. Therefore, I do not think this repository can ever become obsolete, as people will need to maintain it as an interface for the editor.

Am I wrong? I think I could be misunderstanding, like maybe the editor uses Mono, but not the player?

Unity skipping .Net 5

FYI, Unity is not planning to implement .Net 5, rather they plan to skip to .Net 6
".NET 6 support: Peterson described this as "still a bit fuzzy," with the company hoping to provide a preview around the time the landmark, unifying, milestone .NET 6 ships in November as a long-term support (LTS) release, meaning that "Unity will likely skip .NET 5 entirely." He described the biggest hurdles for this as:
This is a breaking change for all Unity users. Any assemblies compiled against mscorlib.dll from the .NET Framework ecosystem will not work, and must be recompiled.
The .NET Core ecosystem does not support domain reloading, which is a fundamental requirement of the Unity Editor. We have done work to use Assembly Load Context instead, but that will be a breaking change, and will require time to implement properly, both from the Unity side and in user projects. "

https://visualstudiomagazine.com/articles/2021/04/22/unity-plans.aspx

How can i get more than 30 packets a second.

Firstly, thanks for this great .DLL

I have a BLE device that streams data 30 times a second. Each data contains 5 bytes.
This .DLL seems to handle in-coming data with ease when my BLE device is streaming at 30/sec.
However, when I set my BLE device to stream at 60/second, there is a lot of delays and corrupted data. Same as 45/sec.
Even at 38/sec, I'm still seeing some delays. It seems like this .DLL can only handle a maximum of 30 characteristic updates per second.

Is this something that can easily be changed? Or am I doing something wrong.

Not working with baudrate 115200

Hi, I changed the baudrate of my BLE device to 115200 and now my Unity project won't communicate any more. Before that change everything worked properly. Where do I have to look at to make it work again?

ANDROID support

There is a way to have android support to this asset? Thanks

Connecting and Subscribing to heart sensor

Thank you for this really amazing project.
I have a heart sensor and it connects fine and the Scan services and Scan characteristic seems to populate fine.
When I try to subscribe to the sensor, the editor completely hangs. I also built the app and tested it. It also hanged when trying to subscribe to the data.
Correct Heart Service

The heart rate service is 0x180D
0x2A37 is the UUID for the Heart Rate Measurement characteristic

Other information:
Unity 2022.2.13f1
Built for windows 10 standalone, not UWP

Do you know what I am missing.

Thank you in advance.

Reading/Polling Buffer

Hey, it's me again :D
I hope I'm not bugging you by now ;) But I'd really need your advice again :/

So here's the thing:
I'm packaging uint8 (sbyte) packages on my ESP32 and sending them as 1 byte packets over my characteristic:
uint8_t package[1]; package[0] = convertRawAngleToDegrees(ams5600.getRawAngle()); pCharacteristicCommand->setValue(package, 1); pCharacteristicCommand->notify();
It does nothing but continiously sending out a current HALL sensor angle value over BLE.
Then in Unity I have a Thread thats reading the buffer like you showed in your example "ReadPackage()" function:
Impl.BLEData packageReceived; bool result = Impl.PollData(out packageReceived, true);
First I couldn't figure out how to access the data without HUGE latency (half a minute or so), until I made a really unpretty workaround:
On my ESP32 I created a full package with 512 one byte packages before sending it out. With this "throwing s*** on the wall until it sticks approach" I could access my values from Unity ;)
This was fine for debugging, but using the data for a game/simulation input is far too slow :/

On the UWP platform one could use the DataReader Interface I guess? Do I have a similar option with your DLL?
I have also an Android app where I can receive the same data perfectly with a BLE characteristic "Notify".
I have tried it in block and non block mode btw, but I'm not sure wether I used it correctly.

Long story short: How can I read the LATEST momentary value sent out from my BLE device at any given time?

Like I said, I'm sorry to have to bother you again, but I have tried for several hours ;(

Disconnected peripherals, Reading specific characteristics.

Hello!

I started using this library today in my Unity Project, seems nice to use so far.
I am able to scan, connect(trough 'polling' services), subscribe and write to specific characteristics 👍

But I did end up with 2 problems.

I can't figure out how to see if my peripheral got disconnected.
This is quite handy to know if I want to automaticly reconnect to the device.

I also can't figure out how to read a specific characteristic.

After called Quit(),Can not find any connectedable devices.

I am doing reconnect works.After called Quit() function, I found the scan func didm't work. I guess it is because the filter in c++ code worked in error.
IVector<hstring> requestedProperties = single_threaded_vector<hstring>({ L"System.Devices.Aep.DeviceAddress", L"System.Devices.Aep.IsConnected", L"System.Devices.Aep.Bluetooth.Le.IsConnectable" });
I need connect and disconnect.So, what can I do?

Communication with Dongle

Hello, I have previously used your API successfully to connect with a custom sensor and receive data from multiple custom devices. Now, I want to connect my Unity application with commercial devices that require a dongle. However, unlike the previous custom devices, the application is no longer able to automatically detect these devices when I connect them using API commands. I believe this is because the commercial devices require me to configure a virtual COM before I can receive data. I was hoping you could suggest a way to use the current API to establish a connection with these commercial devices. Unfortunately, I am not very familiar with these technical details.

The ValueChanged function runs at irregular intervals.

Hello,

I'm currently facing an issue while communicating with a BLE device. The device sends data packets of 21 bytes every 25 ms. However, I've noticed that the ValueChanged function is only triggering up to 20 times per second. This seems to be causing a delay or loss of some data packets. Interestingly, I've confirmed that the BLE device is capable of sending data at a faster rate (every 25 ms) using an Android app.

I'm seeking advice on how to address this problem and achieve a smoother data reception experience. Is there a way to ensure that the ValueChanged function is called more frequently to match the data transmission rate of the BLE device? I would greatly appreciate any insights or suggestions you could provide.

Thank you in advance for your assistance.

Unity crashing when calling Connect() method

In fact, I was probably a little too hasty when I said that "everything" worked. The scan works beautifully. However, when I try to connect a device with "ble.Connect()", the Unity Editor hangs completely and has to be terminated via the Task Manager.
I rebuilt the code of "Program.cs" in a Unity monobehavior and replaced any "Thread.Sleep" with coroutines. But it completely boils down to the "Connect()" method. More specifically to the "PollService()" routine inside the .dll.

ScanStatus PollService(Service* service, bool block) { ScanStatus res; unique_lock<mutex> lock(serviceQueueLock); if (block && serviceQueue.empty() && !serviceScanFinished) if (QuittableWait(serviceQueueSignal, lock)) return ScanStatus::FINISHED; if (!serviceQueue.empty()) { *service = serviceQueue.front(); serviceQueue.pop(); res = ScanStatus::AVAILABLE; } else if (serviceScanFinished) res = ScanStatus::FINISHED; else res = ScanStatus::PROCESSING; return res; }

I'm not sure why this would be a problem from inside Unity, but not from your VS project? May it have something to do with my Unity project settings?
I know this is not too accurate information, but off the top of your head, do you have any idea what this could be?
Please let me know, if you need further information.
Or maybe you have a small example snippet of an implementation in Unity?
I would be very grateful!

Unity crash when I press the subscribe button(MRTK)

Hello!

I am in a project of AR and using the MRTK UGUI to conncet to my BLE device. I almost paste your 2D demo script on my project. I can get the correct device, service and characteristics. However, when I press the subscribe button, the unity just crashes. Do you know how to solve this issue?
image

Suddenly unable to subscribe to notifications from and write to characteristic

Hi, thanks so much for putting together this package, it's been very helpful for one of my projects. A few days ago I was able to get everything communicating nicely between my Arduino board and Windows PC, but today I suddenly encountered the following errors when trying to subscribe to notifications or write to a characteristic:
image

Here are some more details:

  • I've tried rolling back my code without success, and my previous builds are no longer working. I even tried rolling back the most recent Windows updates without success.
  • The same errors are occurring when I try to subscribe/write to the device from Microsoft's BLE sample, and from your demo scene.
  • The errors are reproduced on multiple PCs, and I also get the same errors using third party apps on my PC such as this one .
  • I am experiencing the same errors when trying to communicate with a second BLE device (that I had no trouble communicating with before today).
  • I'm able to scan for the services and characteristic UUIDs from the device, I just can't subscribe to or write to them.
  • Everything works when I try to subscribe/write to the devices using an android phone, or macOS laptop.

Would really appreciate any hints on where to look for a solution!

BleScan.Impl.PollData make my Unity crashed.

Hi, im a student doing a FYP about BLE communication. Sorry that I only had very little knowledge about Unity and Visual studio coding. Im using the BleWinrtDll Unity/Assets/Scenes/Demo and modify the subscribe function to call ReadPackage. I also changed BleApi.cs to BLE.cs.

I tried to debug line by line, notice the Unity crashed when it reached PollData. So i try to search the error in the library and notice is the QuittableWait(dataQueueSignal, lock) make my Unity crashed. I understand PollData is a function to retrieve data from BLE device, and QuittableWait() used to wait unitl there is data. My BLE device characteristic did not have data thats why it keep waiting (might causing loop).

I create a backup and try to ignore QuittableWait() function and replace it with saveError. So when block=true, and data is empty, it will saveError "no data". Everything work fine and Unity also did display the error (i modified Demo.cs and BLE.cs too so I can start ReadPackage when click subcribe).

May i know what is the problem?

Enable Indication into Client Characteristic Configuration

I would like to enable DFU mode of my nordic device.
In order to perform this, I have to subscribe to a characteristic with Indications enabled.
To do it, I have modified your code as followed :
status = co_await characteristic.WriteClientCharacteristicConfigurationDescriptorWithResultAsync(GattClientCharacteristicConfigurationDescriptorValue::Indicate);
Unfortunately, indications do not seem to be enabled.

Could you please help me ?

Any idea how to add RSSI / signal strength?

It is working well for me, thank you. How might it be possible to get RSSI signal strength of the devices that are found in the scan? There may be a property System.Devices.Aep.SignalStrength that can be added to the requested properties list inside StartDeviceScan, but I am not sure how to retrieve its value afterwards.

Much appreciate your help if possible!

Nuget Package Microsoft.Windows.CppWinRT needed to build solution

Cloned project and tried to build according to instructions in Readme.md, however build failed on error "wait_for is not a member of winrt::impl"

Found solution being installing the Nuget Package Microsoft.Windows.CppWinRT,

  1. Right-click on Refernces in solution window.
  2. Click manage Nuget packages...
  3. Click browse tab
  4. Find Microsoft.Windows.CppWinRT
  5. Install
    After that building worked.

How can i subscribe to multiple BLE characteristics?

first for all, thanks for this DLL, is amazing, but i need to suscribe to multiple characteristics from a xiao sense ble, can you help to know how can i made this? sorry for my english and thanks for your reply.

Device not connecting after scanning

Tried "build and run" from unity with these settings,
Architecture - Intel 64-but
Build type - D3D project
Target SDK version - Latest installed
Min Platform version - 10.0.10240.0
VS Version - latest installed (2019)
Build and run on - local machine
Build config - Release
copy references - untick
copy pdb files - untick
development build - untick
IL2CPP code gen - faster runtime
compression method - default

After running the application, scanning pressed, device selected, when scan for services given, " Failed to connect to device" error occurs.

Using dll in the Unity but can't subscribe

Hello. I met a situation with SubscribeCharacteristic() when I try it in the Unity in PC. I had got the deviceId, serviceId and characteristicId, and try to subcribe it. But it return false when I used BleApi.SubscribeCharacteristic(selectedDeviceId, selectedServiceId, selectedCharacteristicId, false);
And in the while loop:BleApi.PollData(out res, false) never gets true.

I used the dll in the form C# program, which is good running.
is there some important things I lost?

Unable to write attribute

Hello !
First of all, thanks a lot for your project and the work you've done, as a novice when working with Bluetooth, it helps a lot. I've scoured the different issues already listed on this repo, but can't find something that answers my questions.
That being said, I'm currently having an issue when trying to subscribe to my write notification on my bluetooth device.
I get this error :
"Could not establish connection to device with ID BluetoothLE#BluetoothLEc4:23:60:eb:a3:ec-c5:02:be:bb:2a:69
System.Exception: Connection failed: BleWinrtDll.cpp:501 SubscribeCharacteristicAsync catch: Unable to write attribute (translated from French, not sure about the translation, sorry about that)"

The strange thing is that it happens when trying to subscribe to my device's Write characteristic.
I have 2 different characteristics on my device, one that is for Read/Notify, and one that is for Write, and I figured the script would be able to identify which is which, and subscribe to notifications for the Notify one, and subscribe to the Write characteristic to send messages, but I realize I might be wrong ?

I also had another question, it might be because I can't reach this part yet because of my previous issue, but I don't see a way to read data sent by the BLE device, am I missing something ? I looked for "Read" "Receive" and other keywords in the code but found no results

Anyways, I'm very much stuck and I'd really appreciate if you could help me 😁
Thank you so much, have a nice day !

Unable to scan for or subscribe to characteristics

Hello.

I am able to search and find my BLE device, as well as successfully searching for a list of services. When I select 'scan characteristics' however, I am either met with no results, or the error "BleWinrtDll.cpp:429 ScanCharacteristicsAsync catch: Catastrophic failure". As such, I am unable to subscribe to and read incoming data from the device.

I'm just wondering if anyone has faced this issue?

Thank you!

Failed to load 'BleWinrtDll.dll' because one or more of its dependencies could not be loaded.

First of all, thank you so much for this Dll! It works wonders in Unity.

I am attempting to use it on HoloLens 2 and at first it failed because of the wrong architecture, so I've built the Dll for ARM64 following this guide. Alas, now it fails because it is missing some of the dependencies. I have used Dependencies program to check which I am missing in the BleWinrtDll built for ARM64:

  • MSVCP140.dll
  • VCRUNTIME140.dll

When I check BleWinrtDll built for x64 those Dlls are found, but I am not able to build it to HoloLens since it is wrong architecture.
This is way over my head, so I am wondering:

  • Is there any way to specifically define where those dependencies are?
  • Is there something I should look out for when I am building for ARM64 so that those Dlls are included correctly?

Any tips would be highly appreciated! As I am quite stuck.

How to make it work on Android?

Hi,

thank you for the great example. I tried it an it works quite well in the editor. I was wondering if this can be made to work for Android and how?

Would you be able to implement BluetoothLEAdvertisementWatcher, connection status ?

Thank you very much for this great API. Thans to it was able to connect to BLE sensor and subscipe to notification, however I woud want to:

  1. Check connection status, i.e. to know if I am connected and subsciption is active.
  2. Scan only for devices that support my desired service (cycle cadance and speed service)

For the later I need to use BluetoothLEAdvertisementWatcher instead of devicewatcher.
For the later I'm not sure, in Web-bluetooth (JS) I set an iternal connected varible true upon completing the pairing and set it false upon disconnect event.

Looked at the code in hope to be able to do it myself, but I'm not familiar in C++.

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.