LukasBombach / sblendid

A JavaScript Bluetooth Low Energy (BLE) Library
MIT License
63 stars 5 forks source link

Does it support linux? #4

Open gissleh opened 5 years ago

gissleh commented 5 years ago

The description lists Linux, Mac and Windows as supported platforms, but I get this error on Ubuntu 19.04.

Error: Unsupported platform "linux". Please file an issue at https://github.com/LukasBombach/sblendid/issues

The code responsible for it (unminified) seems to just support the other two platforms.

function loadNativeAddonFromFs() {
    var n = os.platform(),
        t = path.resolve(__dirname, "../native/noble_mac.node"),
        i = path.resolve(__dirname, "../native/noble_winrt.node");
    if ("darwin" === n) return require(t).NobleMac;
    if ("win32" === n) return require(i).NobleWinrt;
    throw new Error('Unsupported platform "' + n + '". Please file an issue at https://github.com/LukasBombach/sblendid/issues')
}
atrovato commented 5 years ago

LukasBombach is working on this feature on linux-support branch.

gissleh commented 5 years ago

Fair enough. I think the WIP state of linux support should be made clear in the readme, though. I refactored to using noble instead.

marksyzm commented 5 years ago

The readme did say before that Linux was coming up and not quite ready but it now says it supports it. Probably just getting ahead of oneself.

LukasBombach commented 5 years ago

Sorry, I am in a work in progress here, I have been working on the "final" readme and did not think people would actually already use this. I will correct this tonight. as @atrovato stated, I am currently workin on Linux support here

https://github.com/LukasBombach/sblendid/tree/linux-support

I am using Bluez & DBus there and I can currently scan the environment for BLE devices, I will get back to you as soon as I merge!

marksyzm commented 5 years ago

Excellent work though! I will certainly contribute where it’s needed once you’ve put the Linux part in as I’m working on a product that needs exactly what you’ve put into this -- Mark Elphinstone-Hoadley www.oxfordsourceltd.com

LukasBombach commented 5 years ago

I have added a warning

https://github.com/LukasBombach/sblendid#important-development-notice

LukasBombach commented 5 years ago

You can also follow my progress here

https://github.com/LukasBombach/sblendid/projects/3

For whom it might interest, the implementation is based on Bluez which I connect to via DBus. For this I will be using https://www.npmjs.com/package/dbus which is a native node addon written in C++ that bridges Linux' DBus interface to Node.js

KrakenTyio commented 5 years ago

Will be provided also slim docker ubuntu/alpine?

LukasBombach commented 5 years ago

Hey @KrakenTyio I have tried setting this up for local development of this thing, but I could not manage to get Bluetooth to work in my container. I want to give it a go again after the release of v1.0.0 (which is mostly delayed by implementing support for Linux), but I can't promise I will get far with this.

Can I ask, what would you do with this (docker image)? I will distribute this as an npm package that should run in macOS, Windows and Linux environments. If you do have a docker image you want to run this in it should just work by npm installing it.

KrakenTyio commented 5 years ago

Its ok, ill use only docker as wraper with dependencies on local server with his own host dbus/bluetooth usb sticker

I asked just in case if you have already resolved few needed steps to containing it to docker, or it will work without any backaround for dockering.

But when i looked on your already created work, its look good, so good job. Primary ill test it on https://www.gearbest.com/home-gear/pp_009768490252.html?wid=1433363 where is needed use notify

diginfo commented 4 years ago

I would like to give it a go under linux after spending the last 3 days trying to get a stable conection with noble.

What's the install procedure for the linux-branch, I tried : npm install https://github.com/LukasBombach/sblendid.git that installed a splendid-umbrella folder but I was unable to require it in nodejs ?!

LukasBombach commented 4 years ago

Hey @diginfo

unfortunately Linux support is far from ready, it is under heavy work right now. If you checkout the Linux branch and transpile it you will end up with most features lacking. You can see my current progress here:

https://github.com/LukasBombach/sblendid/projects/3

Also, I am constantly committing into this branch so if you reinstall your project via npm you will end up with a completely different state (and most likely broken) setup.

I'm sorry to say, but it's not worth the effort.

If you really want to do it, you'd have to:

git clone git@github.com:LukasBombach/sblendid.git
cd sblendid
git checkout linux-support
yarn
cd packages/adapter-node
yarn build
cd ../sblendid
yarn build
yarn link

then you can switch to your project and do this

cd /Your/Project
yarn link "@sblendid/sblendid"