@robdobsn/raftjs 1.5.0 → 1.5.9
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 +6 -1
- package/dist/react-native/RaftAttributeHandler.js.map +1 -1
- package/dist/react-native/RaftChannelBLE.native.js +1 -1
- package/dist/react-native/RaftChannelBLE.native.js.map +1 -1
- package/dist/react-native/RaftConnector.js +1 -1
- package/dist/react-native/RaftConnector.js.map +1 -1
- package/dist/react-native/RaftDeviceInfo.d.ts +3 -0
- package/dist/react-native/RaftDeviceManager.d.ts +12 -7
- package/dist/react-native/RaftDeviceManager.js +185 -41
- package/dist/react-native/RaftDeviceManager.js.map +1 -1
- package/dist/react-native/RaftDeviceMgrIF.d.ts +7 -3
- package/dist/react-native/RaftDeviceStates.d.ts +5 -1
- package/dist/react-native/RaftDeviceStates.js +2 -2
- package/dist/react-native/RaftDeviceStates.js.map +1 -1
- package/dist/react-native/RaftMsgHandler.d.ts +1 -1
- package/dist/react-native/RaftStruct.js +2 -1
- package/dist/react-native/RaftStruct.js.map +1 -1
- package/dist/react-native/RaftTypes.d.ts +9 -12
- package/dist/react-native/RaftTypes.js +5 -47
- package/dist/react-native/RaftTypes.js.map +1 -1
- package/dist/web/RaftAttributeHandler.js +6 -1
- package/dist/web/RaftAttributeHandler.js.map +1 -1
- package/dist/web/RaftConnector.js +1 -1
- package/dist/web/RaftConnector.js.map +1 -1
- package/dist/web/RaftDeviceInfo.d.ts +3 -0
- package/dist/web/RaftDeviceManager.d.ts +12 -7
- package/dist/web/RaftDeviceManager.js +185 -41
- package/dist/web/RaftDeviceManager.js.map +1 -1
- package/dist/web/RaftDeviceMgrIF.d.ts +7 -3
- package/dist/web/RaftDeviceStates.d.ts +5 -1
- package/dist/web/RaftDeviceStates.js +2 -2
- package/dist/web/RaftDeviceStates.js.map +1 -1
- package/dist/web/RaftMsgHandler.d.ts +1 -1
- package/dist/web/RaftStruct.js +2 -1
- package/dist/web/RaftStruct.js.map +1 -1
- package/dist/web/RaftTypes.d.ts +9 -12
- package/dist/web/RaftTypes.js +5 -47
- package/dist/web/RaftTypes.js.map +1 -1
- package/examples/dashboard/package.json +6 -3
- package/examples/dashboard/src/ConnManager.ts +5 -1
- package/examples/dashboard/src/DeviceActionsForm.tsx +49 -49
- package/examples/dashboard/src/DeviceLineChart.tsx +44 -20
- package/examples/dashboard/src/DevicePanel.tsx +33 -2
- package/examples/dashboard/src/DevicesPanel.tsx +5 -4
- package/examples/dashboard/src/LatencyTest.ts +130 -0
- package/examples/dashboard/src/LatencyTestPanel.tsx +92 -0
- package/examples/dashboard/src/Main.tsx +192 -76
- package/examples/dashboard/src/SettingsManager.ts +67 -0
- package/examples/dashboard/src/SettingsScreen.tsx +174 -0
- package/examples/dashboard/src/SystemTypeCog/CogStateInfo.ts +13 -8
- package/examples/dashboard/src/SystemTypeCog/SystemTypeCog.ts +9 -5
- package/examples/dashboard/src/SystemTypeGeneric/StateInfoGeneric.ts +12 -6
- package/examples/dashboard/src/SystemTypeGeneric/SystemTypeGeneric.ts +9 -5
- package/examples/dashboard/src/SystemTypeMarty/RICStateInfo.ts +23 -4
- package/examples/dashboard/src/SystemTypeMarty/RICSystemUtils.ts +1 -1
- package/examples/dashboard/src/SystemTypeMarty/SystemTypeMarty.ts +1 -1
- package/examples/dashboard/src/index.html +2 -2
- package/examples/dashboard/src/styles.css +14 -0
- package/package.json +5 -4
- package/src/RaftAttributeHandler.ts +7 -1
- package/src/RaftChannelBLE.native.ts +1 -1
- package/src/RaftConnector.ts +1 -1
- package/src/RaftDeviceInfo.ts +3 -0
- package/src/RaftDeviceManager.ts +220 -50
- package/src/RaftDeviceMgrIF.ts +9 -3
- package/src/RaftDeviceStates.ts +6 -2
- package/src/RaftStruct.ts +2 -1
- package/src/RaftTypes.ts +22 -30
package/src/RaftDeviceMgrIF.ts
CHANGED
|
@@ -16,10 +16,16 @@ export default interface RaftDeviceMgrIF {
|
|
|
16
16
|
getDevicesState(): DevicesState;
|
|
17
17
|
getDeviceState(deviceKey: string): DeviceState;
|
|
18
18
|
|
|
19
|
+
// Settings
|
|
20
|
+
setMaxDataPointsToStore(maxDataPointsToStore: number): void;
|
|
21
|
+
|
|
19
22
|
// Callbacks
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
addNewDeviceCallback(callback: (deviceKey: string, state: DeviceState) => void): void;
|
|
24
|
+
removeNewDeviceCallback(callback: (deviceKey: string, state: DeviceState) => void): void;
|
|
25
|
+
addNewAttributeCallback(callback: (deviceKey: string, attrState: DeviceAttributeState) => void): void;
|
|
26
|
+
removeNewAttributeCallback(callback: (deviceKey: string, attrState: DeviceAttributeState) => void): void;
|
|
27
|
+
addAttributeDataCallback(callback: (deviceKey: string, attrState: DeviceAttributeState) => void): void;
|
|
28
|
+
removeAttributeDataCallback(callback: (deviceKey: string, attrState: DeviceAttributeState) => void): void;
|
|
23
29
|
|
|
24
30
|
// Send action to device
|
|
25
31
|
sendAction(deviceKey: string, action: DeviceTypeAction, data: number[]): void;
|
package/src/RaftDeviceStates.ts
CHANGED
|
@@ -51,6 +51,7 @@ export interface DeviceAttributeState {
|
|
|
51
51
|
name: string;
|
|
52
52
|
newAttribute: boolean;
|
|
53
53
|
newData: boolean;
|
|
54
|
+
numNewValues: number;
|
|
54
55
|
values: number[];
|
|
55
56
|
units: string;
|
|
56
57
|
range: number[];
|
|
@@ -76,6 +77,9 @@ export interface DeviceState {
|
|
|
76
77
|
deviceIsNew: boolean;
|
|
77
78
|
stateChanged: boolean;
|
|
78
79
|
isOnline: boolean;
|
|
80
|
+
deviceAddress: string;
|
|
81
|
+
deviceType: string;
|
|
82
|
+
busName: string;
|
|
79
83
|
}
|
|
80
84
|
|
|
81
85
|
export class DevicesState {
|
|
@@ -83,6 +87,6 @@ export class DevicesState {
|
|
|
83
87
|
}
|
|
84
88
|
|
|
85
89
|
// Add the getDeviceKey method to generate a composite key
|
|
86
|
-
export function getDeviceKey(busName: string, devAddr: string): string {
|
|
87
|
-
return `${busName}_${devAddr}`;
|
|
90
|
+
export function getDeviceKey(busName: string, devAddr: string, devType: string): string {
|
|
91
|
+
return `${busName}_${devAddr}_${devType}`;
|
|
88
92
|
}
|
package/src/RaftStruct.ts
CHANGED
|
@@ -134,9 +134,10 @@ export function structPack(format: string, values: number[]): Uint8Array {
|
|
|
134
134
|
let offset = 0;
|
|
135
135
|
let littleEndian = false;
|
|
136
136
|
|
|
137
|
+
let valIdx = 0;
|
|
137
138
|
for (let i = 0; i < format.length; i++) {
|
|
138
139
|
const char = format[i];
|
|
139
|
-
const value = values[
|
|
140
|
+
const value = values[valIdx];
|
|
140
141
|
switch (char) {
|
|
141
142
|
case "<":
|
|
142
143
|
littleEndian = true;
|
package/src/RaftTypes.ts
CHANGED
|
@@ -32,7 +32,7 @@ export type RaftEventFn = (
|
|
|
32
32
|
eventType: string,
|
|
33
33
|
eventEnum: RaftConnEvent | RaftUpdateEvent | RaftPublishEvent,
|
|
34
34
|
eventName: string,
|
|
35
|
-
data?: object | string | null
|
|
35
|
+
data?: object | string | null
|
|
36
36
|
) => void;
|
|
37
37
|
|
|
38
38
|
export interface RaftSubscription {
|
|
@@ -59,30 +59,22 @@ export class RaftSystemInfo {
|
|
|
59
59
|
Friendly? = "";
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
export
|
|
63
|
-
rslt
|
|
64
|
-
calDone
|
|
65
|
-
validMs?
|
|
62
|
+
export type RaftCalibInfo = {
|
|
63
|
+
rslt: string;
|
|
64
|
+
calDone: number;
|
|
65
|
+
validMs? : number;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
// NOTE: Do not put any methods in any of the response classes as they
|
|
69
|
+
// are simply wrappers around JSON and will not necessarily be constructed
|
|
70
|
+
// as objects
|
|
68
71
|
export class RaftOKFail {
|
|
69
|
-
|
|
70
|
-
set(rsltFlag: boolean) {
|
|
71
|
-
if (rsltFlag) {
|
|
72
|
-
this.rslt = this.RAFT_OK;
|
|
73
|
-
} else {
|
|
74
|
-
this.rslt = 'fail';
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
rslt = 'commsFail';
|
|
78
|
-
isOk() {
|
|
79
|
-
return this.rslt === this.RAFT_OK;
|
|
80
|
-
}
|
|
72
|
+
rslt = 'failComms';
|
|
81
73
|
}
|
|
82
74
|
|
|
83
|
-
export
|
|
75
|
+
export type RaftReportMsg = {
|
|
84
76
|
msgType?: string;
|
|
85
|
-
rslt
|
|
77
|
+
rslt: string;
|
|
86
78
|
timeReceived?: number;
|
|
87
79
|
hexRd?: string;
|
|
88
80
|
elemName?: string;
|
|
@@ -92,19 +84,19 @@ export class RaftReportMsg {
|
|
|
92
84
|
msgBody?: string;
|
|
93
85
|
}
|
|
94
86
|
|
|
95
|
-
export
|
|
96
|
-
s
|
|
97
|
-
m
|
|
98
|
-
v
|
|
99
|
-
n
|
|
100
|
-
p
|
|
101
|
-
i
|
|
87
|
+
export type RaftHWFWStat = {
|
|
88
|
+
s: string;
|
|
89
|
+
m: string;
|
|
90
|
+
v: string;
|
|
91
|
+
n: string;
|
|
92
|
+
p: number;
|
|
93
|
+
i: number;
|
|
102
94
|
}
|
|
103
95
|
|
|
104
|
-
export
|
|
105
|
-
req
|
|
106
|
-
rslt
|
|
107
|
-
st: RaftHWFWStat
|
|
96
|
+
export type RaftHWFWUpdRslt = {
|
|
97
|
+
req: string;
|
|
98
|
+
rslt: string;
|
|
99
|
+
st: RaftHWFWStat;
|
|
108
100
|
}
|
|
109
101
|
|
|
110
102
|
export type RaftFWInfo = {
|