brilliantsole 0.0.24 → 0.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -57,5 +57,6 @@ declare abstract class BaseConnectionManager {
57
57
  mtu?: number;
58
58
  sendTxData(data: ArrayBuffer): Promise<void>;
59
59
  parseRxMessage(dataView: DataView): void;
60
+ clear(): void;
60
61
  }
61
62
  export default BaseConnectionManager;
package/build/index.d.ts CHANGED
@@ -395,6 +395,7 @@ declare abstract class BaseConnectionManager {
395
395
  mtu?: number;
396
396
  sendTxData(data: ArrayBuffer): Promise<void>;
397
397
  parseRxMessage(dataView: DataView): void;
398
+ clear(): void;
398
399
  }
399
400
 
400
401
  type SensorConfiguration = {
@@ -398,6 +398,7 @@ declare abstract class BaseConnectionManager {
398
398
  mtu?: number;
399
399
  sendTxData(data: ArrayBuffer): Promise<void>;
400
400
  parseRxMessage(dataView: DataView): void;
401
+ clear(): void;
401
402
  }
402
403
 
403
404
  type SensorConfiguration = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brilliantsole",
3
- "version": "0.0.24",
3
+ "version": "0.0.25",
4
4
  "description": "JavaScript SDK for BrilliantSole Smart Insoles",
5
5
  "main": "./build/brilliantsole.module.js",
6
6
  "module": "./build/brilliantsole.module.js",
package/src/Device.ts CHANGED
@@ -424,6 +424,7 @@ class Device {
424
424
  }
425
425
 
426
426
  #clear() {
427
+ this.connectionManager?.clear();
427
428
  this.latestConnectionMessage.clear();
428
429
  this._informationManager.clear();
429
430
  this.#deviceInformationManager.clear();
@@ -217,7 +217,7 @@ class FileTransferManager {
217
217
  this.#assertValidCommand(command);
218
218
 
219
219
  const promise = this.waitForEvent("fileTransferStatus");
220
-
220
+ _console.log(`setting command ${command}`);
221
221
  const commandEnum = FileTransferCommands.indexOf(command);
222
222
  this.sendMessage(
223
223
  [{ type: "setFileTransferCommand", data: Uint8Array.from([commandEnum]).buffer }],
@@ -433,6 +433,7 @@ class FileTransferManager {
433
433
 
434
434
  async cancel() {
435
435
  this.#assertIsNotIdle();
436
+ _console.log("cancelling file transfer...");
436
437
  await this.#setCommand("cancel");
437
438
  }
438
439
 
@@ -187,13 +187,16 @@ abstract class BaseConnectionManager {
187
187
 
188
188
  if (messages) {
189
189
  this.#pendingMessages.push(...messages);
190
+ _console.log(`appended ${messages.length} messages`);
190
191
  }
191
192
 
192
193
  if (!sendImmediately) {
194
+ _console.log("not sending immediately - waiting until later");
193
195
  return;
194
196
  }
195
197
 
196
198
  if (this.#isSendingMessages) {
199
+ console.log("already sending messages - waiting until later");
197
200
  return;
198
201
  }
199
202
  this.#isSendingMessages = true;
@@ -207,6 +210,7 @@ abstract class BaseConnectionManager {
207
210
  dataLength.setUint16(0, message.data?.byteLength || 0, true);
208
211
  return concatenateArrayBuffers(messageTypeEnum, dataLength, message.data);
209
212
  });
213
+ this.#pendingMessages.length = 0;
210
214
 
211
215
  if (this.mtu) {
212
216
  while (arrayBuffers.length > 0) {
@@ -231,7 +235,6 @@ abstract class BaseConnectionManager {
231
235
  _console.log("sending arrayBuffer", arrayBuffer);
232
236
  await this.sendTxData(arrayBuffer);
233
237
  }
234
- this.#pendingMessages.length = 0;
235
238
 
236
239
  this.#isSendingMessages = false;
237
240
  }
@@ -260,6 +263,11 @@ abstract class BaseConnectionManager {
260
263
  this.status = "notConnected";
261
264
  }
262
265
  }
266
+
267
+ clear() {
268
+ this.#isSendingMessages = false;
269
+ this.#pendingMessages.length = 0;
270
+ }
263
271
  }
264
272
 
265
273
  export default BaseConnectionManager;