Bluetooth: message limit
This commit is contained in:
parent
63c80f1fba
commit
a43db1659c
|
@ -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;
|
||||
});
|
||||
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue