node.js BLE API for windows requires external dongle - node.js

I'm developping a node.js electron app and I need to decide if our Hardware will feature BLE or standard Bluetooth.
I found a couple of APIs (bleno & noble) for this purpose. However for Windows OS both of these require me to use an additional bluetooth usb adapter (used WinUSB & Zadig).
To put it bluntly, is there any way to communicate with a BLE device on a Windows OS using node.js without using an external dongle?
It seems like standard bluetooth is just way less of a hassle. Thanks!

Found a package which solves this issue using a UWP-to-noble bridge:
https://www.npmjs.com/package/noble-winrt
It works just like noble but supports BLE connectivity on Windows without the need for a dongle and complicated driver set-ups!
I was able to easily integrate it on Electron as well, problem solved! :)

The official Bluetooth API on Windows is built for Windows Runtime, https://learn.microsoft.com/en-us/microsoft-edge/windows-runtime. It supports Javascript but I'm not sure if you need a specific js environment. If you don't get that working, you should write or use a native binding for node.js.

Related

How to advertise Bluetooth using electron on Mac

I am aware of Web Bluetooth APIs being accessible in electron. The limitation right now is that those APIs can only be used to connect to nearby devices, but not advertise the device itself.
Are there any options for advertising the existance of the Mac OS app?
Currently researching for ways to use some CLI tool, calling Swift from electron, or interacting somehow with bluetooth via node.

What language/libraries best for BLE connectivity?

Operating system: MacOS
Just for some context on what I am trying to do, I have an Ikea standing desk which has bluetooth. I am able to control the desk with a built in app. I want to create a server running on a raspberry pi that connects to desk and controls it, I then want to create an Alexa skill which will control the desk by calling the server endpoints.
What's the best language/library you would suggest I use? Ideally something that would run on MacOS and Ubuntu.
I don't know anything about BLE yet which is why it is hard for me to find a good answer. If you have resources, books or tutorials that will help me get running with BLE please recommend them.
My use case:
Get desk to go up
Get desk to go down
Get current position of desk
If you want to write one app that works for both MacOS and Ubuntu then as ukBaz said, python and Bleak are your best options. If you want to use the native way of writing BLE apps for each OS, then you can use CoreBluetooth on MacOS and BlueZ on Ubuntu. The advantage of the former is that you can get an application up and running quickly, and the advantage of the latter is that you will find a lot more resources and advanced functionality.
Below are some resources that can help you in your development:-
Theoretical Bluetooth:
Bluetooth Low Energy: A Primer
Getting Started with Bluetooth Low Energy
Ellisys Bluetooth Series
CoreBluetooth
Getting Started with CoreBluetooth
Ultimate Guide to Apple's CoreBluetooth
iOS App Full Example
BlueZ
Configuring Bluetooth devices with bluetoothctl
Ubuntu: Accessing GATT services
Python
Ikea IDÅSEN desk API and CLI
Idasen controller example
Using Python for Bluetooth

Does the Universal Windows Application infrastructure support any Serial Port communications?

I have a WPF desktop application that would make a good candidate as a Universal Windows App. The application has a must-have dependence on USB or Bluetooth devices that act as a Serial Port.
In all my reading I've yet to discover whether there is any access to a SerialPort API in a UWA.
I suspect the answer is 'No support'. If so, does anyone know of a USB or Bluetooth GPS that supports whatever APIs the UWA has for that sort of thing. I have to be able to read things like ground speed, elevation, rate of climb, etc.
If the answer is 'Supported', could you point me to some documentation.
For the "Bluetooth devices that act as a Serial Port", I assume you mean the RFCOMM. They are both supported on Windows Runtime since Windows 8.1 and you can also use them in the Universal Windows Application.
namespace: Windows.Devices.Usb and Windows.Devices.Bluetooth.Rfcomm.
About the Bluetooth GPS, I'm not sure if it uses RFCOMM or not (it depends on the devices), and it is also possible to use the GATT.
Code Sample: Custom USB device access sample

Access to serial port from web browser

I'm trying to access serial port through web browser.
The reason is for downloading firmware to a device that is connected to the same machine that is running the browser (via USB to rs-232).
I'v searched around and have seen that this is doable via Silverlight, but this is Windows only centric since it requires COM support, while my main operating system is Linux, then Windows and then Mac.
I know it's easy to develop JavaFX / QT / Mono / AIR cross platform applications, but those require installing a huge runtime binaries and only then run the application.
I'm trying to keep it really simple, plug your device, visit a web site and it will auto install your application.
Do you guys think it's possible?
Thanks.
https://code.google.com/p/java-simple-serial-connector/
Since Java is cross platform, this would be the only thing required to get the serial support you need in browser.
(not exactly a security nightmare as #"awm" proposed) You could implement a websocket on the localhost, expose a port that is rarely used and call that websocket to open the serial port and feed data to the device to upgrade the firmware.

Deploy a .NET Micro framework application on USB device from GNU/Linux with Mono

I started developing an application for a FEZ Panda device, using the .NET Micro Framework several weeks ago, on Windows.
As I really love GNU/Linux, I would like to use MonoDevelop to develop for this device.
Fortunately, there is an add-in for Mono, that allows deploying .NET Micro Framework applications. Unfortunately, it does not support USB deploy, and my computer has no serial port (it is a laptop).
Do you have any solution about my problem?
Thank you in advance,
ProgVal
EDIT: If there is another way that is not using MonoDevelop, I would like to test it too.
Use a USB to Serial adapter. Keep in mind that on most of these boards it is TTL not RS232 so you'll have to get a USB to TTL adapter.
They are usually very cheap. This one should work.

Resources