@robdobsn/raftjs 1.5.9 → 1.6.1

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.
Files changed (42) hide show
  1. package/dist/react-native/RaftChannelBLE.native.d.ts +3 -1
  2. package/dist/react-native/RaftChannelBLE.native.js +34 -10
  3. package/dist/react-native/RaftChannelBLE.native.js.map +1 -1
  4. package/dist/react-native/RaftChannelBLE.web.js +2 -5
  5. package/dist/react-native/RaftChannelBLE.web.js.map +1 -1
  6. package/dist/react-native/RaftChannelBLEScanner.native.js +1 -1
  7. package/dist/react-native/RaftChannelBLEScanner.native.js.map +1 -1
  8. package/dist/react-native/RaftChannelWebSerial.js +2 -3
  9. package/dist/react-native/RaftChannelWebSerial.js.map +1 -1
  10. package/dist/react-native/RaftConnector.js +3 -1
  11. package/dist/react-native/RaftConnector.js.map +1 -1
  12. package/dist/react-native/RaftTypes.d.ts +3 -1
  13. package/dist/react-native/RaftTypes.js +6 -1
  14. package/dist/react-native/RaftTypes.js.map +1 -1
  15. package/dist/react-native/main.d.ts +1 -0
  16. package/dist/react-native/main.js.map +1 -1
  17. package/dist/web/RaftChannelBLE.web.js +2 -5
  18. package/dist/web/RaftChannelBLE.web.js.map +1 -1
  19. package/dist/web/RaftChannelWebSerial.js +2 -3
  20. package/dist/web/RaftChannelWebSerial.js.map +1 -1
  21. package/dist/web/RaftConnector.js +3 -1
  22. package/dist/web/RaftConnector.js.map +1 -1
  23. package/dist/web/RaftTypes.d.ts +3 -1
  24. package/dist/web/RaftTypes.js +6 -1
  25. package/dist/web/RaftTypes.js.map +1 -1
  26. package/dist/web/main.d.ts +1 -0
  27. package/dist/web/main.js.map +1 -1
  28. package/examples/dashboard/package.json +1 -1
  29. package/examples/dashboard/src/ConnManager.ts +86 -4
  30. package/examples/dashboard/src/Main.tsx +13 -9
  31. package/examples/dashboard/src/SystemTypeCog/CogStateInfo.ts +1 -0
  32. package/examples/dashboard/src/SystemTypeMarty/SystemTypeMarty.ts +1 -1
  33. package/examples/dashboard/src/styles.css +8 -0
  34. package/examples/dashboard/tsconfig.json +1 -1
  35. package/package.json +12 -12
  36. package/src/RaftChannelBLE.native.ts +40 -11
  37. package/src/RaftChannelBLE.web.ts +2 -5
  38. package/src/RaftChannelBLEScanner.native.ts +1 -0
  39. package/src/RaftChannelWebSerial.ts +0 -1
  40. package/src/RaftConnector.ts +4 -2
  41. package/src/RaftTypes.ts +6 -1
  42. package/src/main.ts +1 -0
@@ -13,7 +13,6 @@ import RaftMsgHandler from "./RaftMsgHandler";
13
13
  import RaftLog from "./RaftLog";
14
14
  import { RaftConnEvent, RaftConnEventFn } from "./RaftConnEvents";
15
15
  import { ConnectorOptions } from "./RaftSystemType";
16
- import { TextDecoder } from 'text-encoding';
17
16
 
18
17
  type TWebParityType = 'none' | 'even' | 'odd';
19
18
  type TWebFlowControlType = 'none' | 'hardware';
@@ -318,10 +318,12 @@ export default class RaftConnector {
318
318
  if (this._raftChannel) {
319
319
  // Check if there is a RICREST command to send before disconnecting
320
320
  const ricRestCommand = this._raftChannel.ricRestCmdBeforeDisconnect();
321
- console.log(`sending RICREST command before disconnect: ${ricRestCommand}`);
322
321
  if (ricRestCommand) {
322
+ console.log(`sending RICREST command before disconnect: ${ricRestCommand}`);
323
323
  await this.sendRICRESTMsg(ricRestCommand, {});
324
324
  }
325
+ // Pause a little before disconnecting
326
+ await new Promise(resolve => setTimeout(resolve, 1000));
325
327
  // await this.sendRICRESTMsg("bledisc", {});
326
328
  await this._raftChannel.disconnect();
327
329
  this._raftChannel = null;
@@ -653,7 +655,7 @@ export default class RaftConnector {
653
655
  // Connect
654
656
  try {
655
657
  if (this._raftChannel) {
656
- const connected = await this._raftChannel.connect(this._channelConnLocator, this._systemType ? this._systemType.connectorOptions : {});
658
+ const connected = await this._raftChannel.connect(this._channelConnLocator, this._systemType ? this._systemType.connectorOptions : { });
657
659
  if (connected) {
658
660
  this._retryIfLostIsConnected = true;
659
661
  return true;
package/src/RaftTypes.ts CHANGED
@@ -245,11 +245,13 @@ export class DiscoveredDevice {
245
245
  _name = '';
246
246
  _id = '';
247
247
  _rssi = -150;
248
- constructor(localName: string, name: string, id: string, rssi: number) {
248
+ _serviceUUIDs: string[] | null = [];
249
+ constructor(localName: string, name: string, id: string, rssi: number, serviceUUIDs: string[] | null) {
249
250
  this._localName = localName;
250
251
  this._name = name;
251
252
  this._id = id;
252
253
  this._rssi = rssi;
254
+ this._serviceUUIDs = serviceUUIDs;
253
255
  }
254
256
  get name(): string {
255
257
  if (this._localName !== null && this._localName.length > 0) {
@@ -268,6 +270,9 @@ export class DiscoveredDevice {
268
270
  if (this._rssi !== null) return this._rssi;
269
271
  return -100;
270
272
  }
273
+ get serviceUUIDs(): string[] | null {
274
+ return this._serviceUUIDs;
275
+ }
271
276
  }
272
277
 
273
278
  export type DiscoveredDevicesCB = (discoveredDevicess: DiscoveredDevice[]) => void;
package/src/main.ts CHANGED
@@ -24,6 +24,7 @@ export { default as RaftStreamHandler } from './RaftStreamHandler';
24
24
  export { default as RaftSystemUtils } from './RaftSystemUtils';
25
25
  export { default as RaftUtils } from './RaftUtils';
26
26
  export { default as RaftSysTypeManager } from './RaftSysTypeManager';
27
+ export { default as RaftDeviceMgrIF } from './RaftDeviceMgrIF';
27
28
  export { DeviceManager as RaftDeviceManager } from './RaftDeviceManager';
28
29
 
29
30
  export * from './RaftTypes';