@robdobsn/raftjs 1.10.7 → 1.11.6
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.
- package/dist/react-native/RaftAttributeHandler.js +11 -9
- package/dist/react-native/RaftAttributeHandler.js.map +1 -1
- package/dist/react-native/RaftChannelSimulated.js +4 -3
- package/dist/react-native/RaftChannelSimulated.js.map +1 -1
- package/dist/react-native/RaftConnector.d.ts +10 -1
- package/dist/react-native/RaftConnector.js +23 -10
- package/dist/react-native/RaftConnector.js.map +1 -1
- package/dist/react-native/RaftDeviceManager.d.ts +14 -2
- package/dist/react-native/RaftDeviceManager.js +224 -77
- package/dist/react-native/RaftDeviceManager.js.map +1 -1
- package/dist/react-native/RaftDeviceMgrIF.d.ts +5 -1
- package/dist/react-native/RaftDeviceStates.d.ts +21 -3
- package/dist/react-native/RaftDeviceStates.js +31 -6
- package/dist/react-native/RaftDeviceStates.js.map +1 -1
- package/dist/react-native/RaftPublish.d.ts +2 -0
- package/dist/react-native/RaftPublish.js +81 -0
- package/dist/react-native/RaftPublish.js.map +1 -0
- package/dist/react-native/RaftStreamHandler.d.ts +11 -0
- package/dist/react-native/RaftStreamHandler.js +66 -0
- package/dist/react-native/RaftStreamHandler.js.map +1 -1
- package/dist/react-native/RaftStruct.d.ts +2 -2
- package/dist/react-native/RaftStruct.js +97 -26
- package/dist/react-native/RaftStruct.js.map +1 -1
- package/dist/react-native/RaftSystemUtils.d.ts +17 -1
- package/dist/react-native/RaftSystemUtils.js +51 -0
- package/dist/react-native/RaftSystemUtils.js.map +1 -1
- package/dist/react-native/RaftTypes.d.ts +21 -0
- package/dist/react-native/RaftTypes.js.map +1 -1
- package/dist/react-native/main.d.ts +1 -0
- package/dist/react-native/main.js +1 -0
- package/dist/react-native/main.js.map +1 -1
- package/dist/web/RaftAttributeHandler.js +11 -9
- package/dist/web/RaftAttributeHandler.js.map +1 -1
- package/dist/web/RaftChannelSimulated.js +4 -3
- package/dist/web/RaftChannelSimulated.js.map +1 -1
- package/dist/web/RaftConnector.d.ts +10 -1
- package/dist/web/RaftConnector.js +23 -10
- package/dist/web/RaftConnector.js.map +1 -1
- package/dist/web/RaftDeviceManager.d.ts +14 -2
- package/dist/web/RaftDeviceManager.js +224 -77
- package/dist/web/RaftDeviceManager.js.map +1 -1
- package/dist/web/RaftDeviceMgrIF.d.ts +5 -1
- package/dist/web/RaftDeviceStates.d.ts +21 -3
- package/dist/web/RaftDeviceStates.js +31 -6
- package/dist/web/RaftDeviceStates.js.map +1 -1
- package/dist/web/RaftPublish.d.ts +2 -0
- package/dist/web/RaftPublish.js +81 -0
- package/dist/web/RaftPublish.js.map +1 -0
- package/dist/web/RaftStreamHandler.d.ts +11 -0
- package/dist/web/RaftStreamHandler.js +66 -0
- package/dist/web/RaftStreamHandler.js.map +1 -1
- package/dist/web/RaftStruct.d.ts +2 -2
- package/dist/web/RaftStruct.js +97 -26
- package/dist/web/RaftStruct.js.map +1 -1
- package/dist/web/RaftSystemUtils.d.ts +17 -1
- package/dist/web/RaftSystemUtils.js +51 -0
- package/dist/web/RaftSystemUtils.js.map +1 -1
- package/dist/web/RaftTypes.d.ts +21 -0
- package/dist/web/RaftTypes.js.map +1 -1
- package/dist/web/main.d.ts +1 -0
- package/dist/web/main.js +1 -0
- package/dist/web/main.js.map +1 -1
- package/examples/dashboard/package.json +1 -1
- package/examples/dashboard/src/DeviceActionsForm.tsx +2 -2
- package/examples/dashboard/src/DeviceLineChart.tsx +16 -3
- package/examples/dashboard/src/DevicePanel.tsx +79 -3
- package/examples/dashboard/src/DeviceStatsPanel.tsx +76 -0
- package/examples/dashboard/src/DevicesPanel.tsx +11 -0
- package/examples/dashboard/src/SettingsScreen.tsx +9 -4
- package/examples/dashboard/src/SystemTypeCog/CogStateInfo.ts +10 -2
- package/examples/dashboard/src/SystemTypeCog/SystemTypeCog.ts +37 -3
- package/examples/dashboard/src/SystemTypeGeneric/StateInfoGeneric.ts +10 -2
- package/examples/dashboard/src/SystemTypeGeneric/SystemTypeGeneric.ts +38 -4
- package/examples/dashboard/src/SystemTypeMarty/RICStateInfo.ts +10 -2
- package/examples/dashboard/src/styles.css +162 -0
- package/package.json +52 -49
- package/src/RaftAttributeHandler.ts +25 -22
- package/src/RaftChannelSimulated.ts +4 -3
- package/src/RaftConnector.ts +34 -13
- package/src/RaftDeviceManager.ts +253 -83
- package/src/RaftDeviceMgrIF.ts +5 -1
- package/src/RaftDeviceStates.ts +42 -8
- package/src/RaftPublish.ts +92 -0
- package/src/RaftStreamHandler.ts +84 -1
- package/src/RaftStruct.test.ts +229 -0
- package/src/RaftStruct.ts +101 -37
- package/src/RaftSystemUtils.ts +59 -0
- package/src/RaftTypes.ts +27 -0
- package/src/main.ts +1 -0
package/src/RaftConnector.ts
CHANGED
|
@@ -14,7 +14,7 @@ import RaftChannelWebSocket from "./RaftChannelWebSocket";
|
|
|
14
14
|
import RaftChannelWebSerial from "./RaftChannelWebSerial";
|
|
15
15
|
import RaftChannelSimulated from "./RaftChannelSimulated";
|
|
16
16
|
import RaftCommsStats from "./RaftCommsStats";
|
|
17
|
-
import { RaftEventFn, RaftOKFail, RaftFileSendType, RaftFileDownloadResult, RaftProgressCBType, RaftBridgeSetupResp, RaftFileDownloadFn, RaftReportMsg } from "./RaftTypes";
|
|
17
|
+
import { RaftEventFn, RaftOKFail, RaftFileSendType, RaftFileDownloadResult, RaftProgressCBType, RaftStreamDataProgressCBType, RaftBridgeSetupResp, RaftFileDownloadFn, RaftReportMsg } from "./RaftTypes";
|
|
18
18
|
import RaftSystemUtils from "./RaftSystemUtils";
|
|
19
19
|
import RaftFileHandler from "./RaftFileHandler";
|
|
20
20
|
import RaftStreamHandler from "./RaftStreamHandler";
|
|
@@ -282,18 +282,7 @@ export default class RaftConnector {
|
|
|
282
282
|
// Store locator
|
|
283
283
|
this._channelConnLocator = locator;
|
|
284
284
|
|
|
285
|
-
//
|
|
286
|
-
if (this._getSystemTypeCB) {
|
|
287
|
-
// Get system type
|
|
288
|
-
this._systemType = await this._getSystemTypeCB(this._raftSystemUtils);
|
|
289
|
-
|
|
290
|
-
// Set defaults
|
|
291
|
-
if (this._systemType && this._systemType.defaultWiFiHostname) {
|
|
292
|
-
this._raftSystemUtils.setDefaultWiFiHostname(this._systemType.defaultWiFiHostname);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
// Connect
|
|
285
|
+
// Connect channel first (system type resolution needs a live connection)
|
|
297
286
|
let connOk = false;
|
|
298
287
|
try {
|
|
299
288
|
// Event
|
|
@@ -307,6 +296,16 @@ export default class RaftConnector {
|
|
|
307
296
|
|
|
308
297
|
if (connOk) {
|
|
309
298
|
|
|
299
|
+
// Resolve system type now that the channel is connected
|
|
300
|
+
if (this._getSystemTypeCB) {
|
|
301
|
+
this._systemType = await this._getSystemTypeCB(this._raftSystemUtils);
|
|
302
|
+
|
|
303
|
+
// Set defaults
|
|
304
|
+
if (this._systemType && this._systemType.defaultWiFiHostname) {
|
|
305
|
+
this._raftSystemUtils.setDefaultWiFiHostname(this._systemType.defaultWiFiHostname);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
310
309
|
// Setup system type
|
|
311
310
|
if (this._systemType) {
|
|
312
311
|
this._systemType.setup(this._raftSystemUtils, this._onEventFn);
|
|
@@ -478,6 +477,28 @@ export default class RaftConnector {
|
|
|
478
477
|
|
|
479
478
|
// Mark: Streaming --------------------------------------------------------------------------------
|
|
480
479
|
|
|
480
|
+
/**
|
|
481
|
+
* streamData - stream arbitrary data to a named firmware endpoint using the RT_STREAM protocol.
|
|
482
|
+
* @param streamContents data to stream
|
|
483
|
+
* @param fileName logical filename sent in ufStart (e.g. "pattern.thr")
|
|
484
|
+
* @param targetEndpoint REST API endpoint name on the firmware (e.g. "streampattern")
|
|
485
|
+
* @param progressCallback optional (sent, total, progress) callback
|
|
486
|
+
* @returns Promise<boolean> true on success
|
|
487
|
+
*/
|
|
488
|
+
async streamData(
|
|
489
|
+
streamContents: Uint8Array,
|
|
490
|
+
fileName: string,
|
|
491
|
+
targetEndpoint: string,
|
|
492
|
+
progressCallback?: RaftStreamDataProgressCBType,
|
|
493
|
+
): Promise<boolean> {
|
|
494
|
+
if (this._raftStreamHandler && this.isConnected()) {
|
|
495
|
+
return this._raftStreamHandler.streamData(
|
|
496
|
+
streamContents, fileName, targetEndpoint, progressCallback,
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
return false;
|
|
500
|
+
}
|
|
501
|
+
|
|
481
502
|
/**
|
|
482
503
|
* streamAudio - stream audio
|
|
483
504
|
* @param streamContents audio data
|