bthrm - Always use a grace period to force some steps into next idle period
parent
9d71928ba1
commit
0f9a117149
|
|
@ -312,13 +312,13 @@ exports.enable = () => {
|
||||||
result = result.then(()=>{
|
result = result.then(()=>{
|
||||||
log("Starting notifications", newCharacteristic);
|
log("Starting notifications", newCharacteristic);
|
||||||
var startPromise = newCharacteristic.startNotifications().then(()=>log("Notifications started", newCharacteristic));
|
var startPromise = newCharacteristic.startNotifications().then(()=>log("Notifications started", newCharacteristic));
|
||||||
if (settings.gracePeriodNotification > 0){
|
|
||||||
log("Add " + settings.gracePeriodNotification + "ms grace period after starting notifications");
|
log("Add " + settings.gracePeriodNotification + "ms grace period after starting notifications");
|
||||||
startPromise = startPromise.then(()=>{
|
startPromise = startPromise.then(()=>{
|
||||||
log("Wait after connect");
|
log("Wait after connect");
|
||||||
return waitingPromise(settings.gracePeriodNotification);
|
return waitingPromise(settings.gracePeriodNotification);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
return startPromise;
|
return startPromise;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -429,13 +429,11 @@ exports.enable = () => {
|
||||||
var connectPromise = gatt.connect(connectSettings).then(function() {
|
var connectPromise = gatt.connect(connectSettings).then(function() {
|
||||||
log("Connected.");
|
log("Connected.");
|
||||||
});
|
});
|
||||||
if (settings.gracePeriodConnect > 0){
|
log("Add " + settings.gracePeriodConnect + "ms grace period after connecting");
|
||||||
log("Add " + settings.gracePeriodConnect + "ms grace period after connecting");
|
connectPromise = connectPromise.then(()=>{
|
||||||
connectPromise = connectPromise.then(()=>{
|
log("Wait after connect");
|
||||||
log("Wait after connect");
|
return waitingPromise(settings.gracePeriodConnect);
|
||||||
return waitingPromise(settings.gracePeriodConnect);
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
return connectPromise;
|
return connectPromise;
|
||||||
} else {
|
} else {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
|
|
@ -476,13 +474,11 @@ exports.enable = () => {
|
||||||
log("Supporting service", service.uuid);
|
log("Supporting service", service.uuid);
|
||||||
result = attachServicePromise(result, service);
|
result = attachServicePromise(result, service);
|
||||||
}
|
}
|
||||||
if (settings.gracePeriodService > 0) {
|
log("Add " + settings.gracePeriodService + "ms grace period after services");
|
||||||
log("Add " + settings.gracePeriodService + "ms grace period after services");
|
result = result.then(()=>{
|
||||||
result = result.then(()=>{
|
log("Wait after services");
|
||||||
log("Wait after services");
|
return waitingPromise(settings.gracePeriodService);
|
||||||
return waitingPromise(settings.gracePeriodService);
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue