From a43db1659c72b489b88bbf47575e309203f449aa Mon Sep 17 00:00:00 2001 From: Jeronimo Vallelunga Date: Mon, 27 Nov 2017 19:35:31 -0300 Subject: [PATCH] Bluetooth: message limit --- src/webapp/central/central.js | 6 +----- src/webapp/central/central.test.js | 5 ++--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/webapp/central/central.js b/src/webapp/central/central.js index e16f56a..742a7e1 100644 --- a/src/webapp/central/central.js +++ b/src/webapp/central/central.js @@ -8,7 +8,7 @@ export default function Central( characteristic: null, message: '', configuration: { - limit: 20, + limit: 20, // HARDCODE: https://devzone.nordicsemi.com/question/3860/largest-allowed-setting-for-variable-length-characteristic/ }, id, }; @@ -46,10 +46,6 @@ export default function Central( .then(() => { const eventListener = listener(callback); state.characteristic.addEventListener('characteristicvaluechanged', eventListener); - return state.characteristic.readValue(); - }).then((data) => { - const configuration = decode(data); - state.configuration = JSON.parse(configuration.slice(3, configuration.length - 3)); return state.configuration; }); diff --git a/src/webapp/central/central.test.js b/src/webapp/central/central.test.js index 28cb9de..41f19b4 100644 --- a/src/webapp/central/central.test.js +++ b/src/webapp/central/central.test.js @@ -60,13 +60,12 @@ test('Central: connect', () => { test('Central: handler', () => { const callback = jest.fn(); - expect.assertions(4); + expect.assertions(3); const promise = central.connect('mockName').then(() => central.handler(callback)) .then((configuration) => { - expect(configuration).toEqual({ mockDecode: 'mockDecode' }); + expect(configuration).toEqual({ limit: 20 }); expect(characteristic.startNotifications).toBeCalled(); - expect(characteristic.readValue).toBeCalled(); return true; });