Skip to content

Commit bbdb07e

Browse files
author
Daisuke Baba
committed
Merge branch 'release/0.1.0'
2 parents f9b2560 + 857e69c commit bbdb07e

File tree

7 files changed

+1345
-38
lines changed

7 files changed

+1345
-38
lines changed

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
node-red-contrib-generic-ble
2+
===
3+
4+
A Node-RED node for providing access to generic BLE devices via GATT.
5+
6+
**ALPHA RELEASE** : not yet available in [flows.nodered.org](https://flows.nodered.org)
7+
8+
# How to install
9+
10+
```
11+
cd ~/.node-red
12+
npm install node-red-contrib-generic-ble
13+
```
14+
15+
# HCI Dump Debugging
16+
17+
```
18+
sudo apt-get update
19+
sudo apt-get install bluez-hcidump
20+
```
21+
22+
then
23+
24+
```
25+
sudo hcidump -t -x
26+
```
27+
28+
# Enabling trace log
29+
30+
Set `GENERIC_BLE_TRACE=true` on starting Node-RED.
31+
32+
# Known Issues
33+
34+
Connecting to peripherals keeps failing in some cases after selecting a BLE peripheral from the scan result select box in the Generic BLE node configuration dialog. If you get stuck in that case, stop Node-RED and run `sudo hciconfig hci0 reset` (replace `hci0` with a proper interface if necessary) then start Node-RED again.
35+
36+
# Revision History
37+
38+
* 0.1.0
39+
- Initial Release (alpha)
40+
- `node-red` keyword is not yet added

gulpfile.js

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
const gulp = require('gulp');
22
const util = require("gulp-util");
33
const babel = require('gulp-babel');
4-
const browserify = require('browserify');
5-
const babelify = require('babelify');
64
const uglify = require('gulp-uglify');
75
const del = require('del');
8-
const source = require('vinyl-source-stream');
9-
const buffer = require('vinyl-buffer');
106
const jshint = require('gulp-jshint');
117
const mocha = require('gulp-mocha');
128
const sourcemaps = require('gulp-sourcemaps');
@@ -15,7 +11,6 @@ const htmlmin = require('gulp-htmlmin');
1511
const cleancss = require('gulp-clean-css');
1612
const less = require('gulp-less');
1713
const manifest = require('gulp-manifest');
18-
const shim = require('browserify-shim');
1914
const yaml = require('gulp-yaml');
2015

2116
const minified = process.env.NODE_ENV === 'production';
@@ -40,6 +35,12 @@ gulp.task('clean', () => {
4035
]);
4136
});
4237

38+
gulp.task('cleanTestJs', () => {
39+
return del([
40+
'dist/**/*.test.js',
41+
]);
42+
});
43+
4344
gulp.task('i18n', () => {
4445
return gulp.src([
4546
'./src/locales/**/*.{yaml,yml}'
@@ -57,25 +58,15 @@ gulp.task('assets', ['i18n'], () => {
5758
});
5859

5960
gulp.task('js', ['assets'], () => {
60-
return browserify({
61-
entries: './src/generic-ble.js',
62-
debug: true
63-
})
64-
.transform(babelify, {
61+
return gulp.src('./src/**/*.js')
62+
.pipe(gulpif(sourcemapEnabled, sourcemaps.init(), util.noop()))
63+
.pipe(babel({
6564
minified: minified,
6665
compact: minified,
6766
presets: ["es2015"],
68-
plugins: ['add-module-exports'],
69-
sourceMaps: sourcemapEnabled,
70-
}).on('error', util.log)
71-
.transform(shim, {
72-
global: true
73-
}).on('error', util.log)
74-
.bundle()
75-
.pipe(source('generic-ble.js'))
76-
.pipe(buffer())
77-
.pipe(gulpif(sourcemapEnabled, sourcemaps.init({loadMaps: true}), util.noop()))
78-
.pipe(uglify({
67+
plugins: ['add-module-exports']
68+
}))
69+
.pipe(gulpif(!sourcemapEnabled, uglify({
7970
mangle: minified,
8071
compress: {
8172
dead_code: true,
@@ -84,12 +75,12 @@ gulp.task('js', ['assets'], () => {
8475
unused: true,
8576
toplevel: true,
8677
if_return: true,
87-
drop_console: !sourcemapEnabled,
78+
drop_console: true,
8879
conditionals: true,
8980
unsafe_math: true,
9081
unsafe: true
9182
},
92-
}))
83+
}), util.noop()))
9384
.pipe(gulpif(sourcemapEnabled, sourcemaps.write(), util.noop()))
9485
.pipe(gulp.dest('./dist'));
9586
});
@@ -119,7 +110,7 @@ gulp.task('testAssets', () => {
119110
.pipe(gulp.dest('./dist'));
120111
});
121112

122-
gulp.task('testJs', ['build'], () => {
113+
gulp.task('testJs', ['cleanTestJs', 'build'], () => {
123114
return gulp.src('./tests/**/*.js')
124115
.pipe(sourcemaps.init())
125116
.pipe(babel({

package.json

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-red-contrib-generic-ble",
3-
"version": "1.0.0",
3+
"version": "0.1.0",
44
"description": "Node-RED nodes for generic BLE devices",
55
"license": "MIT",
66
"repository": {
@@ -19,27 +19,20 @@
1919
},
2020
"homepage": "https://github.com/CANDY-LINE/node-red-contrib-generic-ble#readme",
2121
"keywords": [
22-
"node-red",
2322
"bluetooth",
2423
"BLE",
2524
"bluetooth low energy",
2625
"bluetooth smart",
2726
"CANDY RED",
2827
"CANDY EGG"
2928
],
30-
"browserify-shim": {
31-
},
3229
"devDependencies": {
33-
"node-red": "^0.16.2",
3430
"babel": "^6.23.0",
3531
"babel-cli": "^6.24.0",
3632
"babel-plugin-add-module-exports": "^0.2.1",
3733
"babel-plugin-transform-runtime": "^6.23.0",
3834
"babel-preset-babili": "0.0.12",
3935
"babel-preset-es2015": "^6.24.0",
40-
"babelify": "^7.3.0",
41-
"browserify": "^14.3.0",
42-
"browserify-shim": "^3.8.14",
4336
"chai": "^3.3.0",
4437
"del": "^2.2.2",
4538
"gulp": "^3.9.1",
@@ -62,14 +55,13 @@
6255
"jshint-stylish": "^2.0.1",
6356
"mocha": "^3.0.2",
6457
"sinon": "^2.1.0",
65-
"supertest": "^1.1.0",
66-
"vinyl-buffer": "^1.0.0",
67-
"vinyl-source-stream": "^1.1.0"
58+
"supertest": "^1.1.0"
6859
},
6960
"dependencies": {
7061
"noble": "^1.8.1",
71-
"source-map-support": "^0.4.2",
72-
"lru-cache": "^4.0.0"
62+
"node-cache": "^4.1.0",
63+
"queue": "^4.2.1",
64+
"source-map-support": "^0.4.2"
7365
},
7466
"node-red": {
7567
"nodes": {

0 commit comments

Comments
 (0)