Skip to content

Commit

Permalink
Merge pull request #42 from aj-ptw/master
Browse files Browse the repository at this point in the history
FIX: bled112 not found error
  • Loading branch information
AJ Keller authored Mar 23, 2018
2 parents fcd3695 + a4180d5 commit 8f56575
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/env.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "development",
"name": "production",
"description": "Add here any environment specific stuff you like."
}
4 changes: 2 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "OpenBCIHub",
"version": "1.4.0",
"author": "AJ Keller <[email protected]>",
"copyright": "© 2017, OpenBCI inc.",
"copyright": "© 2018, OpenBCI inc.",
"homepage": "http://openbci.com",
"license": "MIT",
"main": "background.js",
Expand All @@ -14,7 +14,7 @@
"lodash": "^4.16.6",
"menubar": "^5.1.0",
"node-ssdp": "^3.2.1",
"openbci-cyton": "^1.0.8",
"openbci-cyton": "^1.1.2",
"openbci-ganglion": "^1.1.5",
"openbci-utilities": "^0.2.7",
"openbci-wifi": "^0.4.1"
Expand Down
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

### Chores

* Bumped cyton to 1.0.8 for new serialport
* Bumped cyton to 1.1.1 for new serialport
* Bumped electron to 1.8.2

# v1.3.9
Expand Down
18 changes: 7 additions & 11 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ var sampleFunction = (client, sample) => {


packet += `${kTcpStop}`;
console.log(JSON.stringify(sample));
console.log(packet);
// console.log(JSON.stringify(sample));
// console.log(packet);
if (!client.destroyed) client.write(packet);
};

Expand Down Expand Up @@ -672,24 +672,20 @@ const _processConnectBLE = (msg, client) => {

const _processConnectSerial = (msg, client) => {
let msgElements = msg.toString().split(',');
const onReadyFunc = () => {
if (verbose) console.log("ready");
client.write(`${kTcpCmdConnect},${kTcpCodeSuccess},${cyton.getInfo().firmware}${kTcpStop}`);
// cyton.on(k.OBCIEmitterRawDataPacket, console.log);
cyton.on(k.OBCIEmitterSample, sampleFunction.bind(null, client));
cyton.on(k.OBCIEmitterEot, messageFunction.bind(null, client));
cyton.once(k.OBCIEmitterClose, closeFunction.bind(null, client));
};
if (cyton.isConnected()) {
if (verbose) console.log('already connected');
client.write(`${kTcpCmdConnect},${kTcpCodeErrorAlreadyConnected}${kTcpStop}`);
} else {
if (verbose) console.log("going to try and connect");
let addr = msgElements[1];
cyton.once(k.OBCIEmitterReady, onReadyFunc.bind(null, client));
cyton.connect(addr)
.then(() => {
if (verbose) console.log("connect success");
client.write(`${kTcpCmdConnect},${kTcpCodeSuccess},${cyton.getInfo().firmware.raw}${kTcpStop}`);
// cyton.on(k.OBCIEmitterRawDataPacket, console.log);
cyton.on(k.OBCIEmitterSample, sampleFunction.bind(null, client));
cyton.on(k.OBCIEmitterEot, messageFunction.bind(null, client));
cyton.once(k.OBCIEmitterClose, closeFunction.bind(null, client));
})
.catch((err) => {
client.write(`${kTcpCmdConnect},${kTcpCodeErrorUnableToConnect},${err}${kTcpStop}`);
Expand Down

0 comments on commit 8f56575

Please sign in to comment.