LukasBombach / web-bluetooth-node

MIT License
1 stars 0 forks source link

Roadmap #1

Open readeral opened 3 years ago

readeral commented 3 years ago

Hi Lukas,

Thanks for your hard work across sblendid and then this lower-level work.

I'm by no means an expert in any of this stuff, but I'm so eager to see it move forward, I'm hesitantly willing to learn some C++ to help it move along. Do you have a roadmap in your mind about this portion of the project that would be worth getting down in written form so we can contribute?

Cheers,

Al

LukasBombach commented 3 years ago

Hey Al,

edit: sorry, wall of text. tldr;

  • find a rust crate that does BLE
  • use neon-bindings to map that to node
  • implement web-bluetooth on top of that with TypeScript
  • if that does not work out, read below

that would help yes. This is one of my ongoing whenever I find the time lovechild projects. In about 2 weeks my 4 months paternity leave starts so I'll have more time then. I can write a roadmap then, I can't be sure I can do it before then.

But the basic idea is to have native layers that are as-thin-as-possible on native BLE APIs using native languages and map those as straight-forward to node to be able to work on the system APIs with JS / TS

An alternaitve to using Objective-C++ and C++ is to use Rust and https://github.com/neon-bindings/neon which would mean

The upside would be having to deal with a lot less languages and frameworks, but this would mean the Rust crate hast to be pretty solid. From what I have learned, Rust has no built-in BLE capabilites, the crates that really are the same idea as the first strategy up there, just that someone else already did it with Rust.

Long story short: I would still check out if there is a stable Rust implementation out there first, because that would make this project happen and if something does not work out, strategy 1 is still an option

readeral commented 3 years ago

Awesome, thanks for the brain dump run down!

If Rust is the way to go, I'm far more interested in that anyway. Been trying to teach myself Rust as my first systems language (I'm just a Javascript dev), but without a project to get my teeth into I've had far less incentive and motivation to work at it than I would have liked. So this is perfect, albeit I'll be slow as heck... haha!

So how about in the meantime before you start paternity leave (congrats, also so rad you're taking 4 months leave!) I'll see what I can find in terms of Rust crates and I'll report back

readeral commented 3 years ago

So the only truly viable library that covers all 3 major OSs is this one https://github.com/deviceplug/btleplug / https://docs.rs/btleplug/0.7.1/btleplug/ It's essentially a deliberate amalgamation of all the semi-complete abandoned alternatives to try get a BLE library covering all OSs. Unlike all other BLE implementations this one has financial incentive to continue so hopefully it won't get abandoned.

readeral commented 3 years ago

Using multiple crates, there doesn't seem to be an alternative to btleplug for getting MacOS working

LukasBombach commented 3 years ago

Makes sense yeah, thanks for the research. I guess that would bring the Roadmap down to

:D

LukasBombach commented 3 years ago

Oh wow, just wanted to give btleplug and neon-bindings a try and... it went FLAWLESS 🤯

https://github.com/LukasBombach/web-bluetooth-node/tree/main/packages/btleplug-neon-bindings

this scans and logs peripherals when you install / build / run node index.js in that package's directory. mac only though for now

LukasBombach commented 3 years ago

Ok my plan for the next few days is to get those btleplug neon-bindings to work. Thank you for this issue 🎉

readeral commented 3 years ago

Awesome glad it's been relatively smooth sailing with neon bindings!

I'll be keen to read through your work once I've got my kids to bed 🤞

Seems the best help I can be is be a sounding board, so I'll do my best to keep up with whatever you're doing so you've got someone to converse with!

LukasBombach commented 3 years ago

I mean I wouldn't mind collaborating, but at this stage—for me at least—it would be best if I can get my hands on a basic setup first to get things going without the overhead of coordinating etc, and I would assume—if you are interested then and have the time for it and all—there would be lots of opttortunities to improve things etc

LukasBombach commented 3 years ago

Here it is https://github.com/LukasBombach/web-bluetooth-node/tree/blteplug-node

LukasBombach commented 3 years ago

(errm, "here's the branch I will be working in")

readeral commented 3 years ago

Yeah, totally. I have no particular desire to have a stake in the project given my lack of relevant experience, just want to do what I can to move forward OSS that I'm interested in. If and when I can make a contribution, hopefully it will be helpful!

KTibow commented 1 year ago

@LukasBombach is this project abandoned or...?

LukasBombach commented 1 year ago

Yeah it is, I’m sorry