notjosh / bleno-mac Goto Github PK
View Code? Open in Web Editor NEWBleno MacOS bindings using the official CoreBluetooth API
License: MIT License
Bleno MacOS bindings using the official CoreBluetooth API
License: MIT License
Can't install bleno-mac :(
I can install noble-mac fine using the same command, which from what I read sounds like this is just a fork of that then modified to be used for peripherals instead of central. So I'm thinking maybe there is a bug somewhere in this package.
os: macOS Mojave (10.14.2)
node: 10.14.2
node-gyp: 3.8.0
npm: 6.4.1
npm i github:notjosh/bleno-mac
> [email protected] install /Users/mark-rodgers/Projects/playground/nodehu/node_modules/bleno-mac
> node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/notjosh/bleno-mac/releases/download/0.0.1/bleno_mac-v0.0.1-node-v64-darwin-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error Connection closed while downloading tarball file
CC(target) Release/obj.target/nothing/../node-addon-api/src/nothing.o
CC(target) Release/obj.target/nothing/../node-addon-api/src/nothing.o
rm: ./Release/.deps/Release/obj.target/nothing/../node-addon-api/src/nothing.o.d.raw: No such file or directory
make: *** [Release/obj.target/nothing/../node-addon-api/src/nothing.o] Error 1
gyp LIBTOOL-STATIC Release/nothing.a
ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/Cellar/node@10/10.14.2/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/Cellar/node@10/10.14.2/bin/node" "/usr/local/Cellar/node@10/10.14.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/mark-rodgers/Projects/playground/nodehu/node_modules/bleno-mac/native/bleno_mac.node" "--module_name=bleno_mac" "--module_path=/Users/mark-rodgers/Projects/playground/nodehu/node_modules/bleno-mac/native" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /Users/mark-rodgers/Projects/playground/nodehu/node_modules/bleno-mac
gyp ERR! node -v v10.14.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node@10/10.14.2/bin/node /usr/local/Cellar/node@10/10.14.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/mark-rodgers/Projects/playground/nodehu/node_modules/bleno-mac/native/bleno_mac.node --module_name=bleno_mac --module_path=/Users/mark-rodgers/Projects/playground/nodehu/node_modules/bleno-mac/native --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/mark-rodgers/Projects/playground/nodehu/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Darwin 18.2.0
node-pre-gyp ERR! command "/usr/local/Cellar/node@10/10.14.2/bin/node" "/Users/mark-rodgers/Projects/playground/nodehu/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/mark-rodgers/Projects/playground/nodehu/node_modules/bleno-mac
node-pre-gyp ERR! node -v v10.14.2
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/Cellar/node@10/10.14.2/bin/node /usr/local/Cellar/node@10/10.14.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/mark-rodgers/Projects/playground/nodehu/node_modules/bleno-mac/native/bleno_mac.node --module_name=bleno_mac --module_path=/Users/mark-rodgers/Projects/playground/nodehu/node_modules/bleno-mac/native --napi_version=3 --node_abi_napi=napi' (1)
SOLINK_MODULE(target) /Users/mark-rodgers/Projects/playground/nodehu/node_modules/bleno-mac/native/bleno_mac.node
clang: error: no such file or directory: 'Release/obj.target/bleno_mac/src/bleno_mac.o'
clang: error: no such file or directory: 'Release/obj.target/bleno_mac/src/napi_objc.o'
clang: error: no such file or directory: 'Release/obj.target/bleno_mac/src/ble_peripheral_manager.o'
clang: error: no such file or directory: 'Release/obj.target/bleno_mac/src/objc_cpp.o'
clang: error: no such file or directory: 'Release/obj.target/bleno_mac/src/callbacks.o'
make: *** [/Users/mark-rodgers/Projects/playground/nodehu/node_modules/bleno-mac/native/bleno_mac.node] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/Cellar/node@10/10.14.2/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/Cellar/node@10/10.14.2/bin/node" "/usr/local/Cellar/node@10/10.14.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/mark-rodgers/Projects/playground/nodehu/node_modules/bleno-mac/native/bleno_mac.node" "--module_name=bleno_mac" "--module_path=/Users/mark-rodgers/Projects/playground/nodehu/node_modules/bleno-mac/native" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /Users/mark-rodgers/Projects/playground/nodehu/node_modules/bleno-mac
gyp ERR! node -v v10.14.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/bluetooth-hci-socket):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"linux,android,win32","arch":"any"} (current: {"os":"darwin","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mark-rodgers/.npm/_logs/2018-12-28T18_17_01_916Z-debug.log
It seems advertising service UUIDs are not correctly being advertised, even though the log indicates it is.
This is the output from the advertising call:
startAdvertising:SOMEBOX #212222 serviceUUIDs:( "445B9FFB-348F-4E1B-A417-3559B8138390" )
But when I detect it via e.g. nRF Connect on an Android, or Bluecap on iOS, the advertised service IDs turns out to be an empty array. I'm digging some more into it, but it becomes rather problematic.
I have copy and pasted the echo example from bleno and I am using it with bleno-mac
.
This is the code I am using: https://github.com/LukasBombach/de1-emulator/tree/8703eaf24a5fcbc23887c136a88fa1be5de28e6a
I was able to advertise my device and find it with BlueSee. When I try to connect I am running into error though:
disconnected in underlying BLE layer with error: Error Domain=CBErrorDomain Code=6 "The connection has timed out unexpectedly."
Any ideas?
Hi,
I've been trying to get this to work for days. I'm running;
When I run a simple echo example I get a segfault 11 error, this error occures regardless of whether I have Bluetooth enabled or disabled. I have attached the relevant system log.
The error appears to relate to the native bindings - BlenoMac::Init(Napi::CallbackInfo const&) + 133 (bleno_mac.mm:52)
I've created a repo to replicate my issue.
Hey,
I am trying to rewrite parts of Noble / Bleno in TypeScript and I am looking for some documentation on adapters. Can you tell me how you figured out how to implement your adapter (interface)?
Cheers
Lukas
Since updating to 10.14.2, I haven't been able to see any services or characteristics, although I can connect to the device just fine. Seeing as this was not the issue with 10.14.1, I'm suspecting some change in how CoreBluetooth handles adding services "on-the-fly". I'm investigating it as well, but any pointers to where to start would be greatly appreciated.
It seems that this only affects Android for now.
EDIT: It turned out to be due to mismatched bonding information. This can be avoided by forgetting the previous bonding information. It's going to be interesting seeing if this issue persists with the next macOS update.
Hey, I managed to get this installed and start advertising, at least the console output says so. I explained how I did it here. I started advertising with this script:
const bleno = require("bleno-mac");
bleno.on("stateChange", function(state) {
if (state === "poweredOn") {
bleno.startAdvertising("DE1", ["a000"]);
} else {
bleno.stopAdvertising();
}
});
bleno.on("accept", clientAddress => {
console.log("Accepted connection to", clientAddress);
});
Unfortunately my device cannot be discovered. So I am wondering if I am doing something wrong or if the project is currently broken. Oh I am running macOS Mojave 10.14.5
.
Can you tell me if this should work and maybe the project does not work on Mojave or if I am doing something wrong? Maybe as a proper GitHub issue and not a should-be-stack-overflow post, can you include a simple example in the project?
Thank you
Attempting to set the following descriptors fails on the second descriptor. This approach works flawlessly on Linux, assuming something is getting lost in translation for the second descriptors arraybuffer
descriptors: [
new Descriptor({
uuid: '2901',
value: Buffer.from('Volume', 'utf8')
}),
new Descriptor({
uuid: '2904', // https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.descriptor.gatt.characteristic_presentation_format.xml
value: new Buffer([
0x04, // Uint8 0-255 value is allowed (numeric keypad)
0x00, // no exponent (value === value)
0x27, 0x25, // https://www.bluetooth.com/specifications/assigned-numbers/units joules (energy)
0x01, // Bluetooth SIG Assigned Numbers
0x00, // No description
0x00])
})
]
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Expecting NSData value type for Format descriptor'
I'm trying this fork because the sandeepmistry version never starts advertising. I was hoping this version would work.
I am running Mojave.
It seems to run without errors. I'm not sure I installed it correctly.
npm install blen-mac
didn't work.
So, I:
npm install
which seemed to install successfullywhen running, the poweredOn event occurs, after which I'm called startAdvertising, but the advertisingStart never occurs.
I use bleno to emulate a BLE device, which writes values on a characteristic as data packets.
When I switched to Mojave, I started using bleno-mac, and my emulator stopped working.
The only output I got is peripheralManagerIsReadyToUpdateSubscribers
.
Seems it is due to too much data being written.
I was able to verify this by:
First off I want to preface this with I'm a BLE noob so apologies up front,
Second thank you for a node BT lib that actually works with OSX, it's maddening how many are broken or haven't been updated in a long while.
So I'm trying to send information from the peripheral (OSX) but the max value size is set to 20 so if it's bigger than that I can't.
Is it possible to change that or is there a better way to send more info from a peripheral?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.