added new config parameter and upped version
This commit is contained in:
parent
49214bf8f4
commit
b7f3f65ff0
4 changed files with 14 additions and 15 deletions
|
|
@ -40,7 +40,7 @@ const GATT_SERVICE_ID = 'org.bluez.GattService1';
|
|||
const GATT_CHRC_ID = 'org.bluez.GattCharacteristic1';
|
||||
|
||||
class PlejdService extends EventEmitter {
|
||||
constructor(cryptoKey, devices, sceneManager, connectionTimeout, keepAlive = false) {
|
||||
constructor(cryptoKey, devices, sceneManager, connectionTimeout, writeQueueWaitTime, keepAlive = false) {
|
||||
super();
|
||||
|
||||
this.cryptoKey = Buffer.from(cryptoKey.replace(/-/g, ''), 'hex');
|
||||
|
|
@ -53,6 +53,7 @@ class PlejdService extends EventEmitter {
|
|||
this.devices = devices;
|
||||
this.connectEventHooked = false;
|
||||
this.connectionTimeout = connectionTimeout;
|
||||
this.writeQueueWaitTime = writeQueueWaitTime;
|
||||
this.writeQueue = [];
|
||||
this.writeQueueRef = null;
|
||||
|
||||
|
|
@ -430,13 +431,7 @@ class PlejdService extends EventEmitter {
|
|||
console.log('startWriteQueue()');
|
||||
clearInterval(this.writeQueueRef);
|
||||
|
||||
this.writeQueueRef = setTimeout(() => this.runWriteQueue(), 400);
|
||||
// this.writeQueueRef = setInterval(async () => {
|
||||
// while (this.writeQueue.length > 0) {
|
||||
// const data = this.writeQueue.pop();
|
||||
// await this.write(data);
|
||||
// }
|
||||
// }, 400);
|
||||
this.writeQueueRef = setTimeout(() => this.runWriteQueue(), this.writeQueueWaitTime);
|
||||
}
|
||||
|
||||
async runWriteQueue() {
|
||||
|
|
@ -445,7 +440,7 @@ class PlejdService extends EventEmitter {
|
|||
await this.write(data, true);
|
||||
}
|
||||
|
||||
this.writeQueueRef = setTimeout(() => this.runWriteQueue(), 400);
|
||||
this.writeQueueRef = setTimeout(() => this.runWriteQueue(), this.writeQueueWaitTime);
|
||||
}
|
||||
|
||||
async _processPlejdService(path, characteristics) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue