Skip to content
This repository was archived by the owner on May 3, 2019. It is now read-only.

Commit f885dcf

Browse files
committed
fixes
1 parent 6374731 commit f885dcf

File tree

3 files changed

+32
-102
lines changed

3 files changed

+32
-102
lines changed

lib/service/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,5 @@ f.init = function () {
3131
}
3232
}
3333
}
34-
}
3534

3635
module.exports = f;

lib/service/stream.js

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -453,30 +453,36 @@ function registerDevice(opts) {
453453
applicationConfigs: true
454454
});
455455

456-
if (channel === 'app-emit') {
457-
if (_.isArray(payload)) {
458-
Matrix.dailyDPCount[new Date().getHours()] += payload.length;
456+
})
457+
}
459458

460-
// in case an ID slipped through
461-
_.each(payload, (p) => {
462-
delete p._id;
463-
});
459+
/**
460+
* pretty damn important for being at the end of the file
461+
* writes to the socket using a standardized format
462+
* @example { channel: 'app-emit', payload: {foo: 'bar'}}
463+
*/
464+
function socketEmit(channel, payload) {
464465

465-
/**
466-
* pretty damn important for being at the end of the file
467-
* writes to the socket using a standardized format
468-
* @example { channel: 'app-emit', payload: {foo: 'bar'}}
469-
*/
470-
function socketEmit(channel, payload) {
471-
472-
if (socket && socket.connected && (socket.registered || channel === 'device-register')) {
473-
debug('[M]->SS', channel.yellow, (_.isArray(payload)) ? '#' + payload.length : payload);
474-
socket.send(JSON.stringify({
475-
channel: channel,
476-
payload: payload
477-
}));
478-
} else if (channel === 'app-emit') {
479-
debug('[M]->SS WARN: emit while socket is unwell');
480-
Matrix.sendCache.push(payload);
481-
}
482-
}
466+
467+
if (channel === 'app-emit') {
468+
if (_.isArray(payload)) {
469+
Matrix.dailyDPCount[new Date().getHours()] += payload.length;
470+
471+
// in case an ID slipped through
472+
_.each(payload, (p) => {
473+
delete p._id;
474+
});
475+
}
476+
}
477+
478+
if (socket && socket.connected && (socket.registered || channel === 'device-register')) {
479+
debug('[M]->SS', channel.yellow, (_.isArray(payload)) ? '#' + payload.length : payload);
480+
socket.send(JSON.stringify({
481+
channel: channel,
482+
payload: payload
483+
}));
484+
} else if (channel === 'app-emit') {
485+
debug('[M]->SS WARN: emit while socket is unwell');
486+
Matrix.sendCache.push(payload);
487+
}
488+
}

package.json

Lines changed: 1 addition & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,4 @@
11
{
2-
<<<<<<< HEAD
3-
"name": "matrix-os",
4-
"version": "0.16.0",
5-
"description": "Portal to device layer for AdMobilize Matrix devices. Includes global component, npm install -g matrix-cli",
6-
"main": "app.js",
7-
"repository": "http://github.com/matrix-io/matrix-os",
8-
"keywords": "matrix,creator,iot,zmq,protobuf,zigbee,zwave,nfc,gyroscope,accellerometer,thread,bluetooth,ir,microphone,robots,smart homes,smart business,security,sensors,maker,firebase",
9-
"homepage": "http://creator.matrix.one",
10-
"bugs": "https://github.com/matrix-io/matrix-os/issues/new",
11-
"scripts": {
12-
"debug": "DEBUG=*,-engine*,-needle,-*led,-gatt,-bleno,-Component,-bt-characteristic,-hci NODE_ENV=dev node index.js",
13-
"debugger": "DEBUG=*,-engine*,-needle,-*led,-gatt,-bleno,-Component,-bt-characteristic,-hci NODE_ENV=dev node --debug index.js",
14-
"debug-test": "DEBUG=*,-engine*,-Component*,-gatt,-bleno,-bt-characteristic,-hci node test/_runner.js",
15-
"local-debug": "DEBUG=*,-engine*,-Component* NODE_ENV=local node index.js",
16-
"local": "NODE_ENV=local node index.js",
17-
"start": "nodemon --watch lib --watch config",
18-
"test": "node test/_runner.js",
19-
"pr": "open https://bitbucket.org/admobilize/admatrix/pull-request/new",
20-
"deploy-clear": "sudo rm -r db node_modules/matrix-firebase node_modules/matrix-app-config-helper node_modules/matrix-node-sdk node_modules/matrix-eventfilter",
21-
"deploy-copy": "cd node_modules; cp -r ../../matrix-firebase ./matrix-firebase; cp -r ../../matrix-app-config-helper ./matrix-app-config-helper; cp -r ../../matrix-node-sdk ./matrix-node-sdk; cp -r ../../matrix-eventfilter ./matrix-eventfilter; cd ..;",
22-
"deploy-image": "find apps -name '*.matrix' ! -name 'monitor.matrix' -type d -exec rm -r {} +; docker build --no-cache -t matrix/matrix-os .;docker push admobilize/matrix-os",
23-
"local-setup": "cd node_modules; ln -s ../../pi-wifi ./pi-wifi; ln -s ../../matrix-firebase ./matrix-firebase; ln -s ../../matrix-app-config-helper ./matrix-app-config-helper; ln -s ../../matrix-node-sdk ./matrix-node-sdk; ln -s ../../matrix-eventfilter ./matrix-eventfilter; cd ..",
24-
"sync": "rsync -e ssh --progress -u package.json index.js pi@m:mos/;rsync -ru -e ssh --progress lib proto config apps test pi@m:mos",
25-
"sync-local": "rsync -e ssh --progress -u package.json index.js pi@l:matrix-os/;rsync -ru -e ssh --progress lib proto config apps test pi@l:matrix-os",
26-
"sync-m1": "rsync -e ssh --progress -u package.json index.js pi@m1:matrix-os/;rsync -ru -e ssh --progress lib proto config apps test pi@m1:matrix-os",
27-
"device-diagnostics": "DEBUG=*,-engine*,-gatt,-bleno,-bt-characteristic,-hci START_APP=monitor NODE_ENV=dev node index.js",
28-
"screensaver": "START_APP=life NODE_ENV=dev node index.js",
29-
"clock": "START_APP=clock NODE_ENV=dev node index.js",
30-
"apphost-debug": "docker run -v `pwd`/apps:/apps -it matrix-apphost bash",
31-
"apphost-build": "docker build -t matrix-apphost -f Dockerfile-apphost-arm .",
32-
"upgrade": "npm update matrix-node-sdk matrix-app-config-helper matrix-firebase matrix-eventfilter pi-wifi",
33-
"watch": "nodemon --exec npm run sync"
34-
},
35-
"author": "Sean Canton <[email protected]>",
36-
"contributors": [
37-
"Sean Canton <[email protected]>"
38-
],
39-
"license": "ISC",
40-
"dependencies": {
41-
"async": "^1.5.2",
42-
"chai": "^3.5.0",
43-
"colors": "^1.1.2",
44-
"debug": "^2.2.0",
45-
"engine.io-client": "^3.1.4",
46-
"fs-extra": "^0.30.0",
47-
"grpc": "^1.0.0",
48-
"js-yaml": "^3.6.1",
49-
"jsonwebtoken": "^5.7.0",
50-
"lodash": "^4.13.1",
51-
"matrix-app-config-helper": "https://github.com/matrix-io/matrix-app-config-helper/tarball/master",
52-
"matrix-eventfilter": "https://github.com/matrix-io/matrix-eventfilter/tarball/master",
53-
"matrix-firebase": "https://github.com/matrix-io/matrix-firebase/tarball/master",
54-
"matrix-node-sdk": "https://github.com/matrix-io/matrix-node-sdk/tarball/master",
55-
"matrix-protos": "0.0.11",
56-
"mic": "^2.1.1",
57-
"mocha": "^2.4.5",
58-
"nedb": "^1.8.0",
59-
"network": "^0.3.2",
60-
"optional": "^0.1.4",
61-
"pi-wifi": "^1.1.2",
62-
"protobufjs": "^5.0.1",
63-
"request": "^2.72.0",
64-
"rimraf": "^2.5.2",
65-
"should": "^7.0.2",
66-
"tinycolor2": "^1.3.0",
67-
"tree-kill": "^1.1.0",
68-
"unzip2": "^0.2.5",
69-
"zeromq": "^4.6.0"
70-
},
71-
"engines": {
72-
"node": ">=0.12.7 <=6.5"
73-
}
74-
}
75-
=======
762
"name": "matrix-os",
773
"version": "0.16.0",
784
"description": "Portal to device layer for AdMobilize Matrix devices. Includes global component, npm install -g matrix-cli",
@@ -148,5 +74,4 @@
14874
"engines": {
14975
"node": ">=0.12.7 <=6.5"
15076
}
151-
}
152-
>>>>>>> sc/matrix-protos
77+
}

0 commit comments

Comments
 (0)