@robotical/webapp-types 0.6.58
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/application-manager.ts +20 -0
- package/dist-types/src/analytics/AnalyticsManager.d.ts +28 -0
- package/dist-types/src/analytics/AnalyticsManager.js +171 -0
- package/dist-types/src/application/ApplicationManager/ApplicationManager.d.ts +117 -0
- package/dist-types/src/application/ApplicationManager/ApplicationManager.js +567 -0
- package/dist-types/src/application/RAFTs/Cog/Cog.d.ts +50 -0
- package/dist-types/src/application/RAFTs/Cog/Cog.js +223 -0
- package/dist-types/src/application/RAFTs/Cog/PublishedDataAnalyser.d.ts +120 -0
- package/dist-types/src/application/RAFTs/Cog/PublishedDataAnalyser.js +533 -0
- package/dist-types/src/application/RAFTs/Marty/Marty.d.ts +42 -0
- package/dist-types/src/application/RAFTs/Marty/Marty.js +187 -0
- package/dist-types/src/application/RAFTs/RAFT.d.ts +114 -0
- package/dist-types/src/application/RAFTs/RAFT.js +341 -0
- package/dist-types/src/application/RAFTs/RAFTInterface.d.ts +13 -0
- package/dist-types/src/application/RAFTs/RAFTInterface.js +6 -0
- package/dist-types/src/application/RAFTs/RaftObserver.d.ts +10 -0
- package/dist-types/src/application/RAFTs/RaftObserver.js +1 -0
- package/dist-types/src/application/RAFTs/raft-subscription-helpers.d.ts +63 -0
- package/dist-types/src/application/RAFTs/raft-subscription-helpers.js +355 -0
- package/dist-types/src/application/communicators/SelfdestructiveMessagePromise.d.ts +10 -0
- package/dist-types/src/application/communicators/SelfdestructiveMessagePromise.js +31 -0
- package/dist-types/src/application/communicators/WrapperCommunicator.d.ts +24 -0
- package/dist-types/src/application/communicators/WrapperCommunicator.js +137 -0
- package/dist-types/src/components/disposables/LoadingSpinner/index.d.ts +7 -0
- package/dist-types/src/components/disposables/LoadingSpinner/index.js +29 -0
- package/dist-types/src/components/disposables/buttons/SVGImageButton/index.d.ts +14 -0
- package/dist-types/src/components/disposables/buttons/SVGImageButton/index.js +19 -0
- package/dist-types/src/components/disposables/buttons/SimpleButton/index.d.ts +14 -0
- package/dist-types/src/components/disposables/buttons/SimpleButton/index.js +18 -0
- package/dist-types/src/components/modals/ SensorsDashboardModal/index.d.ts +2 -0
- package/dist-types/src/components/modals/ SensorsDashboardModal/index.js +61 -0
- package/dist-types/src/components/modals/ConnectingLoadingSpinnerModal/index.d.ts +3 -0
- package/dist-types/src/components/modals/ConnectingLoadingSpinnerModal/index.js +16 -0
- package/dist-types/src/components/modals/DetailedFeedbackModal/index.d.ts +5 -0
- package/dist-types/src/components/modals/DetailedFeedbackModal/index.js +37 -0
- package/dist-types/src/components/modals/DisconnectConfirmation/index.d.ts +1 -0
- package/dist-types/src/components/modals/DisconnectConfirmation/index.js +8 -0
- package/dist-types/src/components/modals/DisconnectConfirmation/styles.d.ts +1 -0
- package/dist-types/src/components/modals/DisconnectConfirmation/styles.js +7 -0
- package/dist-types/src/components/modals/InUnplugged/index.d.ts +1 -0
- package/dist-types/src/components/modals/InUnplugged/index.js +12 -0
- package/dist-types/src/components/modals/InUnplugged/styles.d.ts +5 -0
- package/dist-types/src/components/modals/InUnplugged/styles.js +11 -0
- package/dist-types/src/components/modals/VerificationModal/index.d.ts +6 -0
- package/dist-types/src/components/modals/VerificationModal/index.js +124 -0
- package/dist-types/src/components/modals/VerificationModalPhoneApp/index.d.ts +6 -0
- package/dist-types/src/components/modals/VerificationModalPhoneApp/index.js +195 -0
- package/dist-types/src/components/oneoffs/LEDs/index.d.ts +8 -0
- package/dist-types/src/components/oneoffs/LEDs/index.js +39 -0
- package/dist-types/src/components/oneoffs/RaftSignal/index.d.ts +7 -0
- package/dist-types/src/components/oneoffs/RaftSignal/index.js +29 -0
- package/dist-types/src/services/logger/Logger.d.ts +8 -0
- package/dist-types/src/services/logger/Logger.js +25 -0
- package/dist-types/src/state-observables/modal/DraggableModalState.d.ts +16 -0
- package/dist-types/src/state-observables/modal/DraggableModalState.js +52 -0
- package/dist-types/src/state-observables/modal/ModalObserver.d.ts +18 -0
- package/dist-types/src/state-observables/modal/ModalObserver.js +1 -0
- package/dist-types/src/state-observables/modal/ModalState.d.ts +25 -0
- package/dist-types/src/state-observables/modal/ModalState.js +71 -0
- package/dist-types/src/store/SelectedRaftContext.d.ts +19 -0
- package/dist-types/src/store/SelectedRaftContext.js +84 -0
- package/dist-types/src/styles/colors.d.ts +35 -0
- package/dist-types/src/styles/colors.js +42 -0
- package/dist-types/src/types/communication-between-apps/wrapper-communication.d.ts +48 -0
- package/dist-types/src/types/communication-between-apps/wrapper-communication.js +28 -0
- package/dist-types/src/types/events/raft-info.d.ts +10 -0
- package/dist-types/src/types/events/raft-info.js +11 -0
- package/dist-types/src/types/phone-app-communicator.d.ts +20 -0
- package/dist-types/src/types/phone-app-communicator.js +5 -0
- package/dist-types/src/types/raft.d.ts +18 -0
- package/dist-types/src/types/raft.js +14 -0
- package/dist-types/src/utils/Toaster.d.ts +13 -0
- package/dist-types/src/utils/Toaster.js +38 -0
- package/dist-types/src/utils/helpers/compare-version.d.ts +2 -0
- package/dist-types/src/utils/helpers/compare-version.js +19 -0
- package/dist-types/src/utils/helpers/randomHashGenerator.d.ts +1 -0
- package/dist-types/src/utils/helpers/randomHashGenerator.js +10 -0
- package/dist-types/src/utils/helpers/rescale-range.d.ts +2 -0
- package/dist-types/src/utils/helpers/rescale-range.js +4 -0
- package/dist-types/src/utils/helpers/wifi-configuration-subtitle-gen.d.ts +3 -0
- package/dist-types/src/utils/helpers/wifi-configuration-subtitle-gen.js +34 -0
- package/dist-types/src/utils/phone-app-communication/is-phone-app.d.ts +5 -0
- package/dist-types/src/utils/phone-app-communication/is-phone-app.js +7 -0
- package/dist-types/src/wrapper-app/WrapperAppManager.d.ts +58 -0
- package/dist-types/src/wrapper-app/WrapperAppManager.js +176 -0
- package/dist-types/src/wrapper-app/communicators/WebAppCommunicator.d.ts +24 -0
- package/dist-types/src/wrapper-app/communicators/WebAppCommunicator.js +243 -0
- package/dist-types/src/wrapper-app/connectors/CogConnector/CogConnector.d.ts +40 -0
- package/dist-types/src/wrapper-app/connectors/CogConnector/CogConnector.js +209 -0
- package/dist-types/src/wrapper-app/connectors/Connector.d.ts +72 -0
- package/dist-types/src/wrapper-app/connectors/Connector.js +314 -0
- package/dist-types/src/wrapper-app/connectors/ConnectorFactory.d.ts +15 -0
- package/dist-types/src/wrapper-app/connectors/ConnectorFactory.js +99 -0
- package/dist-types/src/wrapper-app/connectors/ConnectorInterface.d.ts +10 -0
- package/dist-types/src/wrapper-app/connectors/ConnectorInterface.js +6 -0
- package/dist-types/src/wrapper-app/connectors/MartyConnector/MartyConnector.d.ts +40 -0
- package/dist-types/src/wrapper-app/connectors/MartyConnector/MartyConnector.js +243 -0
- package/dist-types/types-package/application-manager.d.ts +17 -0
- package/dist-types/types-package/application-manager.js +5 -0
- package/package.json +13 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
26
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
27
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
28
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
29
|
+
function step(op) {
|
|
30
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
31
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
32
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
33
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
34
|
+
switch (op[0]) {
|
|
35
|
+
case 0: case 1: t = op; break;
|
|
36
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
37
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
38
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
39
|
+
default:
|
|
40
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
41
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
42
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
43
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
44
|
+
if (t[2]) _.ops.pop();
|
|
45
|
+
_.trys.pop(); continue;
|
|
46
|
+
}
|
|
47
|
+
op = body.call(thisArg, _);
|
|
48
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
import { RaftTypeE } from "../../../types/raft";
|
|
53
|
+
import RAFT from "../RAFT";
|
|
54
|
+
import { RaftPublishEvent } from "@robotical/raftjs";
|
|
55
|
+
var Marty = /** @class */ (function (_super) {
|
|
56
|
+
__extends(Marty, _super);
|
|
57
|
+
function Marty(id) {
|
|
58
|
+
var _this = _super.call(this, id) || this;
|
|
59
|
+
_this.id = id;
|
|
60
|
+
_this.type = RaftTypeE.MARTY;
|
|
61
|
+
// RAFT State Info
|
|
62
|
+
_this.raftStateInfo = null;
|
|
63
|
+
// Marty System info
|
|
64
|
+
_this.systemInfo = null;
|
|
65
|
+
// Colours to use for LED patterns
|
|
66
|
+
_this._ledLcdColours = [
|
|
67
|
+
{ led: "#202000", lcd: "#FFFF00" },
|
|
68
|
+
{ led: "#880000", lcd: "#FF0000" },
|
|
69
|
+
{ led: "#000040", lcd: "#0080FF" },
|
|
70
|
+
];
|
|
71
|
+
// // Joint names
|
|
72
|
+
// private _jointNames = {
|
|
73
|
+
// LeftHip: "LeftHip",
|
|
74
|
+
// LeftTwist: "LeftTwist",
|
|
75
|
+
// LeftKnee: "LeftKnee",
|
|
76
|
+
// RightHip: "RightHip",
|
|
77
|
+
// RightTwist: "RightTwist",
|
|
78
|
+
// RightKnee: "RightKnee",
|
|
79
|
+
// LeftArm: "LeftArm",
|
|
80
|
+
// RightArm: "RightArm",
|
|
81
|
+
// Eyes: "Eyes",
|
|
82
|
+
// };
|
|
83
|
+
_this.rssiValues = []; // Array to store recent RSSI values
|
|
84
|
+
_this.MAX_RSSI_VALUES_N = 8; // Number of values to consider for averaging
|
|
85
|
+
return _this;
|
|
86
|
+
}
|
|
87
|
+
Object.defineProperty(Marty.prototype, "ledLcdColours", {
|
|
88
|
+
get: function () {
|
|
89
|
+
return this._ledLcdColours;
|
|
90
|
+
},
|
|
91
|
+
enumerable: false,
|
|
92
|
+
configurable: true
|
|
93
|
+
});
|
|
94
|
+
/**
|
|
95
|
+
* Gets the RSSI of the RAFT
|
|
96
|
+
*/
|
|
97
|
+
Marty.prototype.getRSSI = function () {
|
|
98
|
+
var _a;
|
|
99
|
+
var newRssi = ((_a = this.raftStateInfo) === null || _a === void 0 ? void 0 : _a.robotStatus.robotStatus.bleRSSI) || -200;
|
|
100
|
+
if (this.rssiValues.length >= this.MAX_RSSI_VALUES_N) {
|
|
101
|
+
this.rssiValues.shift();
|
|
102
|
+
}
|
|
103
|
+
this.rssiValues.push(newRssi);
|
|
104
|
+
var rssiAverage = this.rssiValues.reduce(function (sum, val) { return sum + val; }, 0) / this.rssiValues.length;
|
|
105
|
+
return rssiAverage;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Gets the battery strength of the RAFT
|
|
109
|
+
*/
|
|
110
|
+
Marty.prototype.getBatteryStrength = function () {
|
|
111
|
+
var _a;
|
|
112
|
+
return ((_a = this.raftStateInfo) === null || _a === void 0 ? void 0 : _a.power.powerStatus.battRemainCapacityPercent) || 0;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Highlights Marty by flashing the LED and playing a tune
|
|
116
|
+
*/
|
|
117
|
+
Marty.prototype.highlight = function () {
|
|
118
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
119
|
+
return __generator(this, function (_a) {
|
|
120
|
+
switch (_a.label) {
|
|
121
|
+
case 0: return [4 /*yield*/, this.sendRestMessage('led/LEDeye/color/#ff8585')];
|
|
122
|
+
case 1:
|
|
123
|
+
_a.sent();
|
|
124
|
+
return [4 /*yield*/, this.sendRestMessage('filerun/arcade-beep.mp3')];
|
|
125
|
+
case 2:
|
|
126
|
+
_a.sent();
|
|
127
|
+
return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 100); })];
|
|
128
|
+
case 3:
|
|
129
|
+
_a.sent();
|
|
130
|
+
return [4 /*yield*/, this.sendRestMessage('led/LEDeye/color/#000000')];
|
|
131
|
+
case 4:
|
|
132
|
+
_a.sent();
|
|
133
|
+
return [2 /*return*/];
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* This methods handles RAFT events coming from the RICConnector of the wrapper
|
|
140
|
+
*/
|
|
141
|
+
Marty.prototype.handleRaftEvent = function (eventType, eventEnum, eventName, eventData) {
|
|
142
|
+
_super.prototype.handleRaftEvent.call(this, eventType, eventEnum, eventName, eventData);
|
|
143
|
+
switch (eventType) {
|
|
144
|
+
case "pub":
|
|
145
|
+
this.pubEventHandler(eventEnum, eventName, eventData);
|
|
146
|
+
break;
|
|
147
|
+
case "raftinfo":
|
|
148
|
+
this.raftInfoEventHandler(eventEnum, eventName, eventData);
|
|
149
|
+
break;
|
|
150
|
+
default:
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Pub Event Handler
|
|
156
|
+
*/
|
|
157
|
+
Marty.prototype.pubEventHandler = function (eventEnum, eventName, data) {
|
|
158
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
159
|
+
return __generator(this, function (_a) {
|
|
160
|
+
switch (eventEnum) {
|
|
161
|
+
case RaftPublishEvent.PUBLISH_EVENT_DATA:
|
|
162
|
+
break;
|
|
163
|
+
default:
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
return [2 /*return*/];
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Raft Info Event Handler
|
|
172
|
+
*/
|
|
173
|
+
Marty.prototype.raftInfoEventHandler = function (eventEnum, eventName, data) {
|
|
174
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
175
|
+
return __generator(this, function (_a) {
|
|
176
|
+
switch (eventEnum) {
|
|
177
|
+
default:
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
return [2 /*return*/];
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
return Marty;
|
|
185
|
+
}(RAFT));
|
|
186
|
+
export { Marty };
|
|
187
|
+
export default Marty;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { ConnectionAttemptResults, RaftConnectionMethod, RaftTypeE } from "../../types/raft";
|
|
2
|
+
import { RaftInfoEvents } from "../../types/events/raft-info";
|
|
3
|
+
import { FOUND_RAFT_ON_DISCOVERY_RESPONSE } from "../../types/phone-app-communicator";
|
|
4
|
+
import RICInterface from "./RAFTInterface";
|
|
5
|
+
import { RaftObserver } from "./RaftObserver";
|
|
6
|
+
import { RaftConnEvent, RaftUpdateEvent, RaftPublishEvent, RaftOKFail, RaftSystemInfo } from "@robotical/raftjs";
|
|
7
|
+
import { RICLedLcdColours, RICStateInfo } from "@robotical/roboticaljs";
|
|
8
|
+
import { SimplifiedCogStateInfo } from "@robotical/roboticaljs/dist/SystemTypeCog/CogTypes";
|
|
9
|
+
export default class RAFT implements RICInterface {
|
|
10
|
+
id: string;
|
|
11
|
+
type: RaftTypeE;
|
|
12
|
+
_ledLcdColours: RICLedLcdColours;
|
|
13
|
+
protected _observers: {
|
|
14
|
+
[key: string]: Array<RaftObserver>;
|
|
15
|
+
};
|
|
16
|
+
isSerialNoRegisteredInWarranty: boolean | null;
|
|
17
|
+
systemInfo: RaftSystemInfo | null;
|
|
18
|
+
raftStateInfo: RICStateInfo | SimplifiedCogStateInfo | null;
|
|
19
|
+
/**
|
|
20
|
+
* Method to get ledLcdColours, to be implemented in child classes.
|
|
21
|
+
*/
|
|
22
|
+
get ledLcdColours(): RICLedLcdColours;
|
|
23
|
+
constructor(id: string);
|
|
24
|
+
/**
|
|
25
|
+
* Check if RAFT is connected
|
|
26
|
+
* Sends a message to the Wrapper RICConnector and waits for a response
|
|
27
|
+
*/
|
|
28
|
+
getIsConnectedFresh(): Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* Connect to a RAFT
|
|
31
|
+
* We first connect, then we discover the raft type, and then we create the appopriate raft instance
|
|
32
|
+
*/
|
|
33
|
+
static connect(method: RaftConnectionMethod, uuids: string[]): Promise<ConnectionAttemptResults>;
|
|
34
|
+
/**
|
|
35
|
+
* Disconnect from a RAFT
|
|
36
|
+
*/
|
|
37
|
+
disconnect(): Promise<boolean>;
|
|
38
|
+
/**
|
|
39
|
+
* Get RAFT name
|
|
40
|
+
*/
|
|
41
|
+
getRaftName(): Promise<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Verify correct RAFT is selected for phone app
|
|
44
|
+
*/
|
|
45
|
+
verifyRaftPhoneApp(discoveredDevice: FOUND_RAFT_ON_DISCOVERY_RESPONSE['foundRIC']): Promise<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* Verify correct RAFT is selected
|
|
48
|
+
*/
|
|
49
|
+
verifyRaft(): Promise<boolean>;
|
|
50
|
+
/**
|
|
51
|
+
* Stops the verification process
|
|
52
|
+
*/
|
|
53
|
+
stopVerifyingRaft(isCorrectRIC: boolean): Promise<boolean>;
|
|
54
|
+
/**
|
|
55
|
+
* Receiveds events from the RICConnector
|
|
56
|
+
*/
|
|
57
|
+
receivedRICEvent(eventType: string, eventEnum: RaftConnEvent | RaftUpdateEvent | RaftPublishEvent | RaftInfoEvents, eventName: string, eventData: any): void;
|
|
58
|
+
/**
|
|
59
|
+
* Send a REST message to the RAFT
|
|
60
|
+
*/
|
|
61
|
+
sendRestMessage(msg: string, params?: object): Promise<RaftOKFail>;
|
|
62
|
+
/**
|
|
63
|
+
* Highlights the raft
|
|
64
|
+
*/
|
|
65
|
+
highlight(): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Publishing events to observers
|
|
68
|
+
* It could be either events we get from RAFT, or custom events related to the app
|
|
69
|
+
*/
|
|
70
|
+
publish(eventType: string, eventEnum: RaftConnEvent | RaftUpdateEvent | RaftPublishEvent | RaftInfoEvents, eventName: string, eventData: any): void;
|
|
71
|
+
subscribe(observer: RaftObserver, topics: Array<string>): void;
|
|
72
|
+
unsubscribe(observer: RaftObserver): void;
|
|
73
|
+
/**
|
|
74
|
+
* Gets the RSSI of the RAFT
|
|
75
|
+
*/
|
|
76
|
+
getRSSI(): number;
|
|
77
|
+
/**
|
|
78
|
+
* Gets the battery strength of the RAFT
|
|
79
|
+
*/
|
|
80
|
+
getBatteryStrength(): number;
|
|
81
|
+
/**
|
|
82
|
+
* Gets the version of the RAFT
|
|
83
|
+
*/
|
|
84
|
+
getRaftVersion(): string;
|
|
85
|
+
/**
|
|
86
|
+
* Gets the Serial Number of the RAFT
|
|
87
|
+
*/
|
|
88
|
+
getSerialNumber(): string;
|
|
89
|
+
/**
|
|
90
|
+
* Gets the Friendly name of the RAFT
|
|
91
|
+
*/
|
|
92
|
+
getFriendlyName(): string | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* Stream audio to the RAFT
|
|
95
|
+
*/
|
|
96
|
+
streamAudio(streamContents: Uint8Array, clearExisting: boolean, duration: number): Promise<boolean>;
|
|
97
|
+
/**
|
|
98
|
+
* Handles RAFT events
|
|
99
|
+
* (to be implemented in child classes)
|
|
100
|
+
*/
|
|
101
|
+
handleRaftEvent(eventType: string, eventEnum: RaftConnEvent | RaftUpdateEvent | RaftPublishEvent | RaftInfoEvents, eventName: string, eventData: any): void;
|
|
102
|
+
/**
|
|
103
|
+
* Connection Event Handler
|
|
104
|
+
*/
|
|
105
|
+
_connectionEventHandler(eventEnum: RaftConnEvent, eventName: string, data: any): Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* Pub Event Handler
|
|
108
|
+
*/
|
|
109
|
+
_pubEventHandler(eventEnum: RaftPublishEvent, eventName: string, data: any): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Raft Info Event Handler
|
|
112
|
+
*/
|
|
113
|
+
_raftInfoEventHandler(eventEnum: RaftInfoEvents, eventName: string, data: any): Promise<void>;
|
|
114
|
+
}
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { AppSentMessage } from "../../types/communication-between-apps/wrapper-communication";
|
|
38
|
+
import { RaftTypeE } from "../../types/raft";
|
|
39
|
+
import { RaftInfoEvents } from "../../types/events/raft-info";
|
|
40
|
+
import { RaftConnEvent, RaftPublishEvent, } from "@robotical/raftjs";
|
|
41
|
+
var RAFT = /** @class */ (function () {
|
|
42
|
+
function RAFT(id) {
|
|
43
|
+
this.id = id;
|
|
44
|
+
this.type = RaftTypeE.undefined;
|
|
45
|
+
this._ledLcdColours = [{ led: "#000000", lcd: "#000000" }];
|
|
46
|
+
// Observers
|
|
47
|
+
this._observers = {};
|
|
48
|
+
// Is the RAFT serial number registered in warranty
|
|
49
|
+
this.isSerialNoRegisteredInWarranty = null;
|
|
50
|
+
// System Info
|
|
51
|
+
this.systemInfo = null;
|
|
52
|
+
// RAFT State Info
|
|
53
|
+
this.raftStateInfo = null;
|
|
54
|
+
}
|
|
55
|
+
Object.defineProperty(RAFT.prototype, "ledLcdColours", {
|
|
56
|
+
/**
|
|
57
|
+
* Method to get ledLcdColours, to be implemented in child classes.
|
|
58
|
+
*/
|
|
59
|
+
get: function () {
|
|
60
|
+
throw new Error("RAFT.tsx: ledLcdColours: Method should be implemented in child class");
|
|
61
|
+
return this._ledLcdColours;
|
|
62
|
+
},
|
|
63
|
+
enumerable: false,
|
|
64
|
+
configurable: true
|
|
65
|
+
});
|
|
66
|
+
/**
|
|
67
|
+
* Check if RAFT is connected
|
|
68
|
+
* Sends a message to the Wrapper RICConnector and waits for a response
|
|
69
|
+
*/
|
|
70
|
+
RAFT.prototype.getIsConnectedFresh = function () {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
72
|
+
var isConnected;
|
|
73
|
+
return __generator(this, function (_a) {
|
|
74
|
+
switch (_a.label) {
|
|
75
|
+
case 0: return [4 /*yield*/, window.wrapperCommunicator.sendMessageAndWait(AppSentMessage.RAFT_IS_CONNECTED, { raftId: this.id })];
|
|
76
|
+
case 1:
|
|
77
|
+
isConnected = _a.sent();
|
|
78
|
+
return [2 /*return*/, isConnected];
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Connect to a RAFT
|
|
85
|
+
* We first connect, then we discover the raft type, and then we create the appopriate raft instance
|
|
86
|
+
*/
|
|
87
|
+
RAFT.connect = function (method, uuids) {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
89
|
+
var connectResults;
|
|
90
|
+
return __generator(this, function (_a) {
|
|
91
|
+
switch (_a.label) {
|
|
92
|
+
case 0: return [4 /*yield*/, window.wrapperCommunicator.sendMessageAndWait(AppSentMessage.RAFT_CONNECT, { method: method, uuids: uuids })];
|
|
93
|
+
case 1:
|
|
94
|
+
connectResults = _a.sent();
|
|
95
|
+
return [2 /*return*/, connectResults];
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Disconnect from a RAFT
|
|
102
|
+
*/
|
|
103
|
+
RAFT.prototype.disconnect = function () {
|
|
104
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
105
|
+
return __generator(this, function (_a) {
|
|
106
|
+
return [2 /*return*/, window.wrapperCommunicator.sendMessageAndWait(AppSentMessage.RAFT_DISCONNECT, { raftId: this.id })];
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Get RAFT name
|
|
112
|
+
*/
|
|
113
|
+
RAFT.prototype.getRaftName = function () {
|
|
114
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
115
|
+
var raftName;
|
|
116
|
+
return __generator(this, function (_a) {
|
|
117
|
+
switch (_a.label) {
|
|
118
|
+
case 0: return [4 /*yield*/, window.wrapperCommunicator.sendMessageAndWait(AppSentMessage.RAFT_GET_NAME, { raftId: this.id })];
|
|
119
|
+
case 1:
|
|
120
|
+
raftName = _a.sent();
|
|
121
|
+
return [2 /*return*/, raftName];
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Verify correct RAFT is selected for phone app
|
|
128
|
+
*/
|
|
129
|
+
RAFT.prototype.verifyRaftPhoneApp = function (discoveredDevice) {
|
|
130
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
131
|
+
return __generator(this, function (_a) {
|
|
132
|
+
return [2 /*return*/, window.wrapperCommunicator.sendMessageAndWait(AppSentMessage.RAFT_VERIFY_PHONE, { ledLcdColours: this.ledLcdColours, discoveredDevice: discoveredDevice, raftId: this.id })];
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Verify correct RAFT is selected
|
|
138
|
+
*/
|
|
139
|
+
RAFT.prototype.verifyRaft = function () {
|
|
140
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
141
|
+
return __generator(this, function (_a) {
|
|
142
|
+
return [2 /*return*/, window.wrapperCommunicator.sendMessageAndWait(AppSentMessage.RAFT_VERIFY, { ledLcdColours: this.ledLcdColours, raftId: this.id })];
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Stops the verification process
|
|
148
|
+
*/
|
|
149
|
+
RAFT.prototype.stopVerifyingRaft = function (isCorrectRIC) {
|
|
150
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
151
|
+
return __generator(this, function (_a) {
|
|
152
|
+
return [2 /*return*/, window.wrapperCommunicator.sendMessageAndWait(AppSentMessage.RAFT_STOP_VERIFY, { isCorrectRIC: isCorrectRIC, raftId: this.id })];
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Receiveds events from the RICConnector
|
|
158
|
+
*/
|
|
159
|
+
RAFT.prototype.receivedRICEvent = function (eventType, eventEnum, eventName, eventData) {
|
|
160
|
+
this.publish(eventType, eventEnum, eventName, eventData);
|
|
161
|
+
this.handleRaftEvent(eventType, eventEnum, eventName, eventData);
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Send a REST message to the RAFT
|
|
165
|
+
*/
|
|
166
|
+
RAFT.prototype.sendRestMessage = function (msg, params) {
|
|
167
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
168
|
+
return __generator(this, function (_a) {
|
|
169
|
+
return [2 /*return*/, window.wrapperCommunicator.sendMessageAndWait(AppSentMessage.RAFT_SEND_REST, { raftId: this.id, msg: msg, params: params })];
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Highlights the raft
|
|
175
|
+
*/
|
|
176
|
+
RAFT.prototype.highlight = function () {
|
|
177
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
178
|
+
return __generator(this, function (_a) {
|
|
179
|
+
throw new Error("'highlight' Method should be implemented in child class");
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Publishing events to observers
|
|
185
|
+
* It could be either events we get from RAFT, or custom events related to the app
|
|
186
|
+
*/
|
|
187
|
+
RAFT.prototype.publish = function (eventType, eventEnum, eventName, eventData) {
|
|
188
|
+
if (this._observers.hasOwnProperty(eventType)) {
|
|
189
|
+
for (var _i = 0, _a = this._observers[eventType]; _i < _a.length; _i++) {
|
|
190
|
+
var observer = _a[_i];
|
|
191
|
+
observer.notify(eventType, eventEnum, eventName, eventData);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
// RAFT observer
|
|
196
|
+
RAFT.prototype.subscribe = function (observer, topics) {
|
|
197
|
+
for (var _i = 0, topics_1 = topics; _i < topics_1.length; _i++) {
|
|
198
|
+
var topic = topics_1[_i];
|
|
199
|
+
if (!this._observers[topic]) {
|
|
200
|
+
this._observers[topic] = [];
|
|
201
|
+
}
|
|
202
|
+
if (this._observers[topic].indexOf(observer) === -1) {
|
|
203
|
+
this._observers[topic].push(observer);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
RAFT.prototype.unsubscribe = function (observer) {
|
|
208
|
+
for (var topic in this._observers) {
|
|
209
|
+
if (this._observers.hasOwnProperty(topic)) {
|
|
210
|
+
var index = this._observers[topic].indexOf(observer);
|
|
211
|
+
if (index !== -1) {
|
|
212
|
+
this._observers[topic].splice(index, 1);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* Gets the RSSI of the RAFT
|
|
219
|
+
*/
|
|
220
|
+
RAFT.prototype.getRSSI = function () {
|
|
221
|
+
throw new Error("Method will be implemented in child class");
|
|
222
|
+
return 0;
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* Gets the battery strength of the RAFT
|
|
226
|
+
*/
|
|
227
|
+
RAFT.prototype.getBatteryStrength = function () {
|
|
228
|
+
throw new Error("Method will be implemented in child class");
|
|
229
|
+
return 0;
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* Gets the version of the RAFT
|
|
233
|
+
*/
|
|
234
|
+
RAFT.prototype.getRaftVersion = function () {
|
|
235
|
+
var _a;
|
|
236
|
+
return ((_a = this.systemInfo) === null || _a === void 0 ? void 0 : _a.SystemVersion) || "";
|
|
237
|
+
};
|
|
238
|
+
/**
|
|
239
|
+
* Gets the Serial Number of the RAFT
|
|
240
|
+
*/
|
|
241
|
+
RAFT.prototype.getSerialNumber = function () {
|
|
242
|
+
var _a;
|
|
243
|
+
return ((_a = this.systemInfo) === null || _a === void 0 ? void 0 : _a.SerialNo) || "";
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* Gets the Friendly name of the RAFT
|
|
247
|
+
*/
|
|
248
|
+
RAFT.prototype.getFriendlyName = function () {
|
|
249
|
+
var _a;
|
|
250
|
+
return (_a = this.systemInfo) === null || _a === void 0 ? void 0 : _a.Friendly;
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* Stream audio to the RAFT
|
|
254
|
+
*/
|
|
255
|
+
RAFT.prototype.streamAudio = function (streamContents, clearExisting, duration) {
|
|
256
|
+
return window.wrapperCommunicator.sendMessageAndWait(AppSentMessage.RAFT_STREAM_AUDIO, { raftId: this.id, streamContents: Array.from(streamContents), clearExisting: clearExisting, duration: duration });
|
|
257
|
+
};
|
|
258
|
+
/**
|
|
259
|
+
* Handles RAFT events
|
|
260
|
+
* (to be implemented in child classes)
|
|
261
|
+
*/
|
|
262
|
+
RAFT.prototype.handleRaftEvent = function (eventType, eventEnum, eventName, eventData) {
|
|
263
|
+
switch (eventType) {
|
|
264
|
+
case "conn":
|
|
265
|
+
this._connectionEventHandler(eventEnum, eventName, eventData);
|
|
266
|
+
break;
|
|
267
|
+
case "pub":
|
|
268
|
+
this._pubEventHandler(eventEnum, eventName, eventData);
|
|
269
|
+
break;
|
|
270
|
+
case "raftinfo":
|
|
271
|
+
this._raftInfoEventHandler(eventEnum, eventName, eventData);
|
|
272
|
+
break;
|
|
273
|
+
default:
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
/**
|
|
278
|
+
* Connection Event Handler
|
|
279
|
+
*/
|
|
280
|
+
RAFT.prototype._connectionEventHandler = function (eventEnum, eventName, data) {
|
|
281
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
282
|
+
return __generator(this, function (_a) {
|
|
283
|
+
switch (eventEnum) {
|
|
284
|
+
case RaftConnEvent.CONN_VERIFIED_CORRECT:
|
|
285
|
+
window.applicationManager.analyticsManager.logEvent("connection", { raftType: this.type, systemInfo: this.systemInfo });
|
|
286
|
+
break;
|
|
287
|
+
case RaftConnEvent.CONN_DISCONNECTED:
|
|
288
|
+
window.applicationManager.analyticsManager.logEvent("disconnection", { raftType: this.type });
|
|
289
|
+
break;
|
|
290
|
+
case RaftConnEvent.CONN_ISSUE_DETECTED:
|
|
291
|
+
window.applicationManager.analyticsManager.logEvent("connection_issue", { data: data });
|
|
292
|
+
break;
|
|
293
|
+
case RaftConnEvent.CONN_ISSUE_RESOLVED:
|
|
294
|
+
window.applicationManager.analyticsManager.logEvent("connection_issue_resolved", { data: data });
|
|
295
|
+
break;
|
|
296
|
+
default:
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
299
|
+
return [2 /*return*/];
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* Pub Event Handler
|
|
305
|
+
*/
|
|
306
|
+
RAFT.prototype._pubEventHandler = function (eventEnum, eventName, data) {
|
|
307
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
308
|
+
return __generator(this, function (_a) {
|
|
309
|
+
switch (eventEnum) {
|
|
310
|
+
case RaftPublishEvent.PUBLISH_EVENT_DATA:
|
|
311
|
+
break;
|
|
312
|
+
default:
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
return [2 /*return*/];
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
};
|
|
319
|
+
/**
|
|
320
|
+
* Raft Info Event Handler
|
|
321
|
+
*/
|
|
322
|
+
RAFT.prototype._raftInfoEventHandler = function (eventEnum, eventName, data) {
|
|
323
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
324
|
+
return __generator(this, function (_a) {
|
|
325
|
+
switch (eventEnum) {
|
|
326
|
+
case RaftInfoEvents.STATE_INFO:
|
|
327
|
+
this.raftStateInfo = data.stateInfo;
|
|
328
|
+
break;
|
|
329
|
+
case RaftInfoEvents.SYSTEM_INFO:
|
|
330
|
+
this.systemInfo = data.systemInfo;
|
|
331
|
+
break;
|
|
332
|
+
default:
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
335
|
+
return [2 /*return*/];
|
|
336
|
+
});
|
|
337
|
+
});
|
|
338
|
+
};
|
|
339
|
+
return RAFT;
|
|
340
|
+
}());
|
|
341
|
+
export default RAFT;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RaftTypeE } from "../../types/raft";
|
|
2
|
+
import { RaftConnEvent, RaftPublishEvent, RaftUpdateEvent } from "@robotical/raftjs";
|
|
3
|
+
import { RaftInfoEvents } from "../../types/events/raft-info";
|
|
4
|
+
import { RICLedLcdColours } from "@robotical/roboticaljs";
|
|
5
|
+
export default abstract class RICInterface {
|
|
6
|
+
abstract type: RaftTypeE;
|
|
7
|
+
abstract _ledLcdColours: RICLedLcdColours;
|
|
8
|
+
abstract get ledLcdColours(): RICLedLcdColours;
|
|
9
|
+
abstract handleRaftEvent(eventType: string, eventEnum: RaftConnEvent | RaftUpdateEvent | RaftPublishEvent | RaftInfoEvents, eventName: string, eventData: any): void;
|
|
10
|
+
abstract getRSSI(): number;
|
|
11
|
+
abstract getBatteryStrength(): number;
|
|
12
|
+
abstract highlight(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RaftInfoEvents } from "../../types/events/raft-info";
|
|
2
|
+
import { RaftConnEvent, RaftUpdateEvent, RaftPublishEvent } from "@robotical/raftjs";
|
|
3
|
+
export interface MartyObservable {
|
|
4
|
+
subscribe(observer: RaftObserver, topics: Array<string>): void;
|
|
5
|
+
unsubscribe(observer: RaftObserver): void;
|
|
6
|
+
publish(eventType: string, eventEnum: RaftConnEvent | RaftUpdateEvent | RaftPublishEvent | RaftInfoEvents, eventName: string, eventData: any): void;
|
|
7
|
+
}
|
|
8
|
+
export interface RaftObserver {
|
|
9
|
+
notify(eventType: string, eventEnum: RaftConnEvent | RaftUpdateEvent | RaftPublishEvent | RaftInfoEvents, eventName: string, eventData: any): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|