(1.0.21) bump
This commit is contained in:
14
dist/index.cjs.js
vendored
14
dist/index.cjs.js
vendored
@@ -177,7 +177,7 @@ class Updater {
|
|||||||
let packet = this.file.slice(this._fileProgress, this._fileProgress + this._packetSize);
|
let packet = this.file.slice(this._fileProgress, this._fileProgress + this._packetSize);
|
||||||
this._fileProgress += this._packetSize;
|
this._fileProgress += this._packetSize;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.bleObject.write(this.bleDeviceId, this._updaterServiceUUID, this._updateFileCharacteristicUUID, packet.buffer, () => {
|
this.bleObject.writeWithoutResponse(this.bleDeviceId, this._updaterServiceUUID, this._updateFileCharacteristicUUID, packet.buffer, () => {
|
||||||
resolve(true);
|
resolve(true);
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
this._fileProgress -= this._packetSize;
|
this._fileProgress -= this._packetSize;
|
||||||
@@ -199,14 +199,14 @@ class Updater {
|
|||||||
// send a packet
|
// send a packet
|
||||||
// check for error
|
// check for error
|
||||||
// write file length
|
// write file length
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// start notify
|
// start notify
|
||||||
this.bleObject.startNotification(this.bleDeviceId, this._updaterServiceUUID, this._updaterCommandCharacterisitcUUID, async (rawData) => {
|
this.bleObject.startNotification(this.bleDeviceId, this._updaterServiceUUID, this._updaterCommandCharacterisitcUUID, (rawData) => {
|
||||||
let dataView = new Uint8Array(rawData);
|
let dataView = new Uint8Array(rawData);
|
||||||
console.log(dataView);
|
console.log(dataView);
|
||||||
if (dataView[0] == 1) {
|
if (dataView[0] == 1) {
|
||||||
// send file
|
// send file
|
||||||
await this.sendNextPacket();
|
this.sendNextPacket();
|
||||||
progressCallback(`Sending (${Math.floor((this._fileProgress * 100) / this._fileSize)}%), ${this._fileProgress} / ${this._fileSize}`);
|
progressCallback(`Sending (${Math.floor((this._fileProgress * 100) / this._fileSize)}%), ${this._fileProgress} / ${this._fileSize}`);
|
||||||
}
|
}
|
||||||
else if (dataView[0] == 2) {
|
else if (dataView[0] == 2) {
|
||||||
@@ -215,7 +215,7 @@ class Updater {
|
|||||||
if (this._fileProgress >= this._fileSize) {
|
if (this._fileProgress >= this._fileSize) {
|
||||||
console.log("true");
|
console.log("true");
|
||||||
// send agree
|
// send agree
|
||||||
await this.sendEndCmd(true);
|
this.sendEndCmd(true);
|
||||||
progressCallback(`Complete!`);
|
progressCallback(`Complete!`);
|
||||||
this.bleObject.stopNotification(this.bleDeviceId, this._updaterServiceUUID, this._updaterCommandCharacterisitcUUID, () => {
|
this.bleObject.stopNotification(this.bleDeviceId, this._updaterServiceUUID, this._updaterCommandCharacterisitcUUID, () => {
|
||||||
// success
|
// success
|
||||||
@@ -227,7 +227,7 @@ class Updater {
|
|||||||
else {
|
else {
|
||||||
console.log("False");
|
console.log("False");
|
||||||
// send disagree
|
// send disagree
|
||||||
await this.sendEndCmd(false);
|
this.sendEndCmd(false);
|
||||||
progressCallback(`Error, starting over: ${this._fileProgress} / ${this._fileSize}`);
|
progressCallback(`Error, starting over: ${this._fileProgress} / ${this._fileSize}`);
|
||||||
this._fileProgress = 0;
|
this._fileProgress = 0;
|
||||||
}
|
}
|
||||||
@@ -253,7 +253,7 @@ class Updater {
|
|||||||
const buffer = new ArrayBuffer(4);
|
const buffer = new ArrayBuffer(4);
|
||||||
let view = new Int32Array(buffer);
|
let view = new Int32Array(buffer);
|
||||||
view[0] = this._fileSize;
|
view[0] = this._fileSize;
|
||||||
await this.bleObject.withPromises.write(this.bleDeviceId, this._updaterServiceUUID, this._updaterCommandCharacterisitcUUID, buffer);
|
this.bleObject.withPromises.write(this.bleDeviceId, this._updaterServiceUUID, this._updaterCommandCharacterisitcUUID, buffer);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
14
dist/index.es.js
vendored
14
dist/index.es.js
vendored
@@ -175,7 +175,7 @@ class Updater {
|
|||||||
let packet = this.file.slice(this._fileProgress, this._fileProgress + this._packetSize);
|
let packet = this.file.slice(this._fileProgress, this._fileProgress + this._packetSize);
|
||||||
this._fileProgress += this._packetSize;
|
this._fileProgress += this._packetSize;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.bleObject.write(this.bleDeviceId, this._updaterServiceUUID, this._updateFileCharacteristicUUID, packet.buffer, () => {
|
this.bleObject.writeWithoutResponse(this.bleDeviceId, this._updaterServiceUUID, this._updateFileCharacteristicUUID, packet.buffer, () => {
|
||||||
resolve(true);
|
resolve(true);
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
this._fileProgress -= this._packetSize;
|
this._fileProgress -= this._packetSize;
|
||||||
@@ -197,14 +197,14 @@ class Updater {
|
|||||||
// send a packet
|
// send a packet
|
||||||
// check for error
|
// check for error
|
||||||
// write file length
|
// write file length
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// start notify
|
// start notify
|
||||||
this.bleObject.startNotification(this.bleDeviceId, this._updaterServiceUUID, this._updaterCommandCharacterisitcUUID, async (rawData) => {
|
this.bleObject.startNotification(this.bleDeviceId, this._updaterServiceUUID, this._updaterCommandCharacterisitcUUID, (rawData) => {
|
||||||
let dataView = new Uint8Array(rawData);
|
let dataView = new Uint8Array(rawData);
|
||||||
console.log(dataView);
|
console.log(dataView);
|
||||||
if (dataView[0] == 1) {
|
if (dataView[0] == 1) {
|
||||||
// send file
|
// send file
|
||||||
await this.sendNextPacket();
|
this.sendNextPacket();
|
||||||
progressCallback(`Sending (${Math.floor((this._fileProgress * 100) / this._fileSize)}%), ${this._fileProgress} / ${this._fileSize}`);
|
progressCallback(`Sending (${Math.floor((this._fileProgress * 100) / this._fileSize)}%), ${this._fileProgress} / ${this._fileSize}`);
|
||||||
}
|
}
|
||||||
else if (dataView[0] == 2) {
|
else if (dataView[0] == 2) {
|
||||||
@@ -213,7 +213,7 @@ class Updater {
|
|||||||
if (this._fileProgress >= this._fileSize) {
|
if (this._fileProgress >= this._fileSize) {
|
||||||
console.log("true");
|
console.log("true");
|
||||||
// send agree
|
// send agree
|
||||||
await this.sendEndCmd(true);
|
this.sendEndCmd(true);
|
||||||
progressCallback(`Complete!`);
|
progressCallback(`Complete!`);
|
||||||
this.bleObject.stopNotification(this.bleDeviceId, this._updaterServiceUUID, this._updaterCommandCharacterisitcUUID, () => {
|
this.bleObject.stopNotification(this.bleDeviceId, this._updaterServiceUUID, this._updaterCommandCharacterisitcUUID, () => {
|
||||||
// success
|
// success
|
||||||
@@ -225,7 +225,7 @@ class Updater {
|
|||||||
else {
|
else {
|
||||||
console.log("False");
|
console.log("False");
|
||||||
// send disagree
|
// send disagree
|
||||||
await this.sendEndCmd(false);
|
this.sendEndCmd(false);
|
||||||
progressCallback(`Error, starting over: ${this._fileProgress} / ${this._fileSize}`);
|
progressCallback(`Error, starting over: ${this._fileProgress} / ${this._fileSize}`);
|
||||||
this._fileProgress = 0;
|
this._fileProgress = 0;
|
||||||
}
|
}
|
||||||
@@ -251,7 +251,7 @@ class Updater {
|
|||||||
const buffer = new ArrayBuffer(4);
|
const buffer = new ArrayBuffer(4);
|
||||||
let view = new Int32Array(buffer);
|
let view = new Int32Array(buffer);
|
||||||
view[0] = this._fileSize;
|
view[0] = this._fileSize;
|
||||||
await this.bleObject.withPromises.write(this.bleDeviceId, this._updaterServiceUUID, this._updaterCommandCharacterisitcUUID, buffer);
|
this.bleObject.withPromises.write(this.bleDeviceId, this._updaterServiceUUID, this._updaterCommandCharacterisitcUUID, buffer);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "updaterweblibrary",
|
"name": "updaterweblibrary",
|
||||||
"version": "1.0.20",
|
"version": "1.0.21",
|
||||||
"description": "OTA Updater App frontend library",
|
"description": "OTA Updater App frontend library",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
Reference in New Issue
Block a user