Skip to content

Commit bc3b1c3

Browse files
author
Brad Martin
committed
Return firmware version in wifi connect response
This parallels the implementation of the serial channel, and meets the expectation of the GUI which expects this field regardless of communications medium. This is a followup to #81, which resolved OpenBCI/OpenBCI_GUI#449 for serial communications only.
1 parent e379443 commit bc3b1c3

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/background.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,12 +1022,22 @@ const _connectWifi = (msg, client) => {
10221022
.then(() => {
10231023
//TODO: Finish this connect
10241024
if (verbose) console.log("connect success");
1025+
if (wifi.getBoardType() == k.OBCIBoardGanglion) {
1026+
return Promise.resolve('');
1027+
} else {
1028+
// Query cyton firmware version to report in connect response.
1029+
return wifi.write('V');
1030+
}
1031+
})
1032+
.then((version) => {
10251033
// client.write(`${kTcpCmdConnect},${kTcpCodeSuccess}${kTcpStop}`);
10261034
writeCodeToClientOfType(
10271035
client,
10281036
kTcpTypeConnect,
10291037
kTcpCodeSuccess,
1030-
{}
1038+
{
1039+
firmware: version.trim()
1040+
}
10311041
);
10321042
// wifi.on(k.OBCIEmitterRawDataPacket, console.log);
10331043
wifi.on("sample", sampleFunction.bind(null, client));

0 commit comments

Comments
 (0)