(1.0.30) bump
This commit is contained in:
6
dist/index.cjs.js
vendored
6
dist/index.cjs.js
vendored
@@ -175,9 +175,12 @@ class Updater {
|
||||
}
|
||||
async sendNextPacket() {
|
||||
let packet = this.file.slice(this._fileProgress, this._fileProgress + this._packetSize);
|
||||
this._fileProgress += this._packetSize;
|
||||
// this._fileProgress += this._packetSize;
|
||||
return new Promise((resolve, reject) => {
|
||||
this.bleObject.writeWithoutResponse(this.bleDeviceId, this._updaterServiceUUID, this._updateFileCharacteristicUUID, packet.buffer, () => {
|
||||
console.log("Wrote");
|
||||
console.log(packet.length);
|
||||
this._fileProgress += packet.length;
|
||||
resolve(true);
|
||||
}, (error) => {
|
||||
this._fileProgress -= this._packetSize;
|
||||
@@ -205,7 +208,6 @@ class Updater {
|
||||
this._packetSize = mtu;
|
||||
this.bleObject.startNotification(this.bleDeviceId, this._updaterServiceUUID, this._updaterCommandCharacterisitcUUID, (rawData) => {
|
||||
let dataView = new Uint8Array(rawData);
|
||||
console.log(dataView);
|
||||
if (dataView[0] == 1) {
|
||||
// send file
|
||||
this.sendNextPacket();
|
||||
|
||||
6
dist/index.es.js
vendored
6
dist/index.es.js
vendored
@@ -173,9 +173,12 @@ class Updater {
|
||||
}
|
||||
async sendNextPacket() {
|
||||
let packet = this.file.slice(this._fileProgress, this._fileProgress + this._packetSize);
|
||||
this._fileProgress += this._packetSize;
|
||||
// this._fileProgress += this._packetSize;
|
||||
return new Promise((resolve, reject) => {
|
||||
this.bleObject.writeWithoutResponse(this.bleDeviceId, this._updaterServiceUUID, this._updateFileCharacteristicUUID, packet.buffer, () => {
|
||||
console.log("Wrote");
|
||||
console.log(packet.length);
|
||||
this._fileProgress += packet.length;
|
||||
resolve(true);
|
||||
}, (error) => {
|
||||
this._fileProgress -= this._packetSize;
|
||||
@@ -203,7 +206,6 @@ class Updater {
|
||||
this._packetSize = mtu;
|
||||
this.bleObject.startNotification(this.bleDeviceId, this._updaterServiceUUID, this._updaterCommandCharacterisitcUUID, (rawData) => {
|
||||
let dataView = new Uint8Array(rawData);
|
||||
console.log(dataView);
|
||||
if (dataView[0] == 1) {
|
||||
// send file
|
||||
this.sendNextPacket();
|
||||
|
||||
Reference in New Issue
Block a user