lavva.exalushome 1.0.0
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/build/exalushome-library-bundle.js +2 -0
- package/build/exalushome-library-bundle.js.map +1 -0
- package/build/js/Api.d.ts +15 -0
- package/build/js/Api.js +35 -0
- package/build/js/Api.js.map +1 -0
- package/build/js/CancelationTokenSource.d.ts +8 -0
- package/build/js/CancelationTokenSource.js +25 -0
- package/build/js/CancelationTokenSource.js.map +1 -0
- package/build/js/DataFrame.d.ts +41 -0
- package/build/js/DataFrame.js +38 -0
- package/build/js/DataFrame.js.map +1 -0
- package/build/js/DependencyContainer.d.ts +19 -0
- package/build/js/DependencyContainer.js +83 -0
- package/build/js/DependencyContainer.js.map +1 -0
- package/build/js/Event.d.ts +19 -0
- package/build/js/Event.js +28 -0
- package/build/js/Event.js.map +1 -0
- package/build/js/ExalusConnectionService.d.ts +35 -0
- package/build/js/ExalusConnectionService.js +316 -0
- package/build/js/ExalusConnectionService.js.map +1 -0
- package/build/js/Helpers.d.ts +3 -0
- package/build/js/Helpers.js +23 -0
- package/build/js/Helpers.js.map +1 -0
- package/build/js/IDIService.d.ts +3 -0
- package/build/js/IDIService.js +2 -0
- package/build/js/IDIService.js.map +1 -0
- package/build/js/IExalusConnector.d.ts +44 -0
- package/build/js/IExalusConnector.js +33 -0
- package/build/js/IExalusConnector.js.map +1 -0
- package/build/js/Services/Devices/Device.d.ts +33 -0
- package/build/js/Services/Devices/Device.js +130 -0
- package/build/js/Services/Devices/Device.js.map +1 -0
- package/build/js/Services/Devices/DevicesService.d.ts +23 -0
- package/build/js/Services/Devices/DevicesService.js +47 -0
- package/build/js/Services/Devices/DevicesService.js.map +1 -0
- package/build/js/Services/Devices/IDevice.d.ts +53 -0
- package/build/js/Services/Devices/IDevice.js +33 -0
- package/build/js/Services/Devices/IDevice.js.map +1 -0
- package/build/js/Services/Devices/IDeviceChannel.d.ts +28 -0
- package/build/js/Services/Devices/IDeviceChannel.js +9 -0
- package/build/js/Services/Devices/IDeviceChannel.js.map +1 -0
- package/build/js/Services/Devices/IDeviceState.d.ts +3 -0
- package/build/js/Services/Devices/IDeviceState.js +2 -0
- package/build/js/Services/Devices/IDeviceState.js.map +1 -0
- package/build/js/Services/Devices/IDeviceTask.d.ts +8 -0
- package/build/js/Services/Devices/IDeviceTask.js +2 -0
- package/build/js/Services/Devices/IDeviceTask.js.map +1 -0
- package/build/js/Services/Devices/IDevicesService.d.ts +16 -0
- package/build/js/Services/Devices/IDevicesService.js +2 -0
- package/build/js/Services/Devices/IDevicesService.js.map +1 -0
- package/build/js/Services/Devices/TaskExecutionResult.d.ts +8 -0
- package/build/js/Services/Devices/TaskExecutionResult.js +10 -0
- package/build/js/Services/Devices/TaskExecutionResult.js.map +1 -0
- package/build/js/Services/FieldChangeResult.d.ts +17 -0
- package/build/js/Services/FieldChangeResult.js +39 -0
- package/build/js/Services/FieldChangeResult.js.map +1 -0
- package/build/js/Services/ILocalStorageService.d.ts +15 -0
- package/build/js/Services/ILocalStorageService.js +2 -0
- package/build/js/Services/ILocalStorageService.js.map +1 -0
- package/build/js/Services/LocalStorageService.d.ts +9 -0
- package/build/js/Services/LocalStorageService.js +33 -0
- package/build/js/Services/LocalStorageService.js.map +1 -0
- package/build/js/Services/Logging/ILoggerService.d.ts +29 -0
- package/build/js/Services/Logging/ILoggerService.js +8 -0
- package/build/js/Services/Logging/ILoggerService.js.map +1 -0
- package/build/js/Services/Logging/LoggerService.d.ts +21 -0
- package/build/js/Services/Logging/LoggerService.js +88 -0
- package/build/js/Services/Logging/LoggerService.js.map +1 -0
- package/build/js/Services/Session/ISessionService.d.ts +10 -0
- package/build/js/Services/Session/ISessionService.js +2 -0
- package/build/js/Services/Session/ISessionService.js.map +1 -0
- package/build/js/Services/Session/SessionService.d.ts +15 -0
- package/build/js/Services/Session/SessionService.js +35 -0
- package/build/js/Services/Session/SessionService.js.map +1 -0
- package/build/js/Services/Users/IUser.d.ts +33 -0
- package/build/js/Services/Users/IUser.js +22 -0
- package/build/js/Services/Users/IUser.js.map +1 -0
- package/build/js/Services/Users/IUsersService.d.ts +9 -0
- package/build/js/Services/Users/IUsersService.js +2 -0
- package/build/js/Services/Users/IUsersService.js.map +1 -0
- package/build/js/Services/Users/User.d.ts +42 -0
- package/build/js/Services/Users/User.js +151 -0
- package/build/js/Services/Users/User.js.map +1 -0
- package/build/js/Services/Users/UsersService.d.ts +10 -0
- package/build/js/Services/Users/UsersService.js +36 -0
- package/build/js/Services/Users/UsersService.js.map +1 -0
- package/build/js/Services/WebApi/IWebApiCacheService.d.ts +8 -0
- package/build/js/Services/WebApi/IWebApiCacheService.js +2 -0
- package/build/js/Services/WebApi/IWebApiCacheService.js.map +1 -0
- package/build/js/Services/WebApi/WebApiCacheService.d.ts +13 -0
- package/build/js/Services/WebApi/WebApiCacheService.js +39 -0
- package/build/js/Services/WebApi/WebApiCacheService.js.map +1 -0
- package/build/js/TypedEvent.d.ts +19 -0
- package/build/js/TypedEvent.js +28 -0
- package/build/js/TypedEvent.js.map +1 -0
- package/build/tsconfig.tsbuildinfo +1 -0
- package/package.json +37 -0
|
@@ -0,0 +1,316 @@
|
|
|
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 (_) 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 * as signalR from "@microsoft/signalr";
|
|
38
|
+
import { nameof } from "ts-simple-nameof";
|
|
39
|
+
import { ConnectionResult, AuthorizationInfo } from "./IExalusConnector";
|
|
40
|
+
import { TypedEvent } from "./TypedEvent";
|
|
41
|
+
import { Api } from './Api';
|
|
42
|
+
import { LoggerService } from "./Services/Logging/LoggerService";
|
|
43
|
+
import { Event } from "./Event";
|
|
44
|
+
var ExalusConnectionService = (function () {
|
|
45
|
+
function ExalusConnectionService() {
|
|
46
|
+
this._defaultPacketsBrokerAddress = "http://br1.tr7.pl/broker";
|
|
47
|
+
this._serversBrokerAddress = "http://broker.tr7.pl";
|
|
48
|
+
this._address = "http://br1.tr7.pl/broker";
|
|
49
|
+
this._timeout = 5000;
|
|
50
|
+
this._dataReceivedEvent = new TypedEvent();
|
|
51
|
+
this._pongReceivedEvent = new Event();
|
|
52
|
+
this._authorizationReceivedEvent = new TypedEvent();
|
|
53
|
+
this._registrationReceivedEvent = new TypedEvent();
|
|
54
|
+
this._connectionStateChangedEvent = new TypedEvent();
|
|
55
|
+
this._errorOccuredEvent = new TypedEvent();
|
|
56
|
+
this._log = Api.Get(LoggerService);
|
|
57
|
+
}
|
|
58
|
+
ExalusConnectionService.prototype.InitializeConnection = function () {
|
|
59
|
+
this._log.Info("Initializing Exalus Cloud connection service");
|
|
60
|
+
if (this._connection)
|
|
61
|
+
throw new Error("Connection already initialized");
|
|
62
|
+
if (!this._address)
|
|
63
|
+
throw new Error("Domain is not set");
|
|
64
|
+
if (!this._serialId)
|
|
65
|
+
throw new Error("SerialId is not set");
|
|
66
|
+
if (!this._PIN)
|
|
67
|
+
throw new Error("PIN is not set");
|
|
68
|
+
this._connection = new signalR.HubConnectionBuilder()
|
|
69
|
+
.withUrl("".concat(this._address, "/broker"))
|
|
70
|
+
.build();
|
|
71
|
+
};
|
|
72
|
+
ExalusConnectionService.prototype.GetServiceName = function () {
|
|
73
|
+
return nameof(ExalusConnectionService);
|
|
74
|
+
};
|
|
75
|
+
ExalusConnectionService.prototype.SetServersBrokerAddress = function (address) {
|
|
76
|
+
this._serversBrokerAddress = address;
|
|
77
|
+
};
|
|
78
|
+
ExalusConnectionService.prototype.SetDefaultPacketsBrokerAddress = function (address) {
|
|
79
|
+
this._defaultPacketsBrokerAddress = address;
|
|
80
|
+
this._address = address;
|
|
81
|
+
};
|
|
82
|
+
ExalusConnectionService.prototype.GetServerAddressAsync = function () {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
84
|
+
var result, address, ex_1;
|
|
85
|
+
return __generator(this, function (_a) {
|
|
86
|
+
switch (_a.label) {
|
|
87
|
+
case 0:
|
|
88
|
+
_a.trys.push([0, 5, , 6]);
|
|
89
|
+
return [4, fetch("".concat(this._serversBrokerAddress, "/api/connections/broker/whichserver/").concat(this._serialId))];
|
|
90
|
+
case 1:
|
|
91
|
+
result = _a.sent();
|
|
92
|
+
if (!result.ok) return [3, 3];
|
|
93
|
+
return [4, result.text()];
|
|
94
|
+
case 2:
|
|
95
|
+
address = _a.sent();
|
|
96
|
+
this._log.Info("Got server address: ".concat(address));
|
|
97
|
+
return [2, [true, address]];
|
|
98
|
+
case 3:
|
|
99
|
+
this._log.Error("Failed to get server address, status: ".concat(result.status));
|
|
100
|
+
return [2, [false, ""]];
|
|
101
|
+
case 4: return [3, 6];
|
|
102
|
+
case 5:
|
|
103
|
+
ex_1 = _a.sent();
|
|
104
|
+
this._log.Error(ExalusConnectionService, ex_1);
|
|
105
|
+
return [2, [false, ""]];
|
|
106
|
+
case 6: return [2];
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
ExalusConnectionService.prototype.ConnectAsync = function (address) {
|
|
112
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
113
|
+
return __generator(this, function (_a) {
|
|
114
|
+
switch (_a.label) {
|
|
115
|
+
case 0:
|
|
116
|
+
this._address = address;
|
|
117
|
+
return [4, this.connectAsync()];
|
|
118
|
+
case 1: return [2, _a.sent()];
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
ExalusConnectionService.prototype.AuthorizeAsync = function (authorizationInfo) {
|
|
124
|
+
var _this = this;
|
|
125
|
+
var timeoutTime = 2000;
|
|
126
|
+
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
127
|
+
var timeoutId, sub, onTimeout;
|
|
128
|
+
var _this = this;
|
|
129
|
+
var _a;
|
|
130
|
+
return __generator(this, function (_b) {
|
|
131
|
+
switch (_b.label) {
|
|
132
|
+
case 0:
|
|
133
|
+
timeoutId = 0;
|
|
134
|
+
sub = function (result) {
|
|
135
|
+
window.clearTimeout(timeoutId);
|
|
136
|
+
_this._authorizationReceivedEvent.Unsubscribe(sub);
|
|
137
|
+
resolve(result);
|
|
138
|
+
};
|
|
139
|
+
onTimeout = function () {
|
|
140
|
+
window.clearTimeout(timeoutId);
|
|
141
|
+
_this._authorizationReceivedEvent.Unsubscribe(sub);
|
|
142
|
+
resolve(false);
|
|
143
|
+
};
|
|
144
|
+
timeoutId = window.setTimeout(onTimeout, timeoutTime);
|
|
145
|
+
this._authorizationReceivedEvent.Subscribe(sub);
|
|
146
|
+
return [4, ((_a = this._connection) === null || _a === void 0 ? void 0 : _a.send("AuthorizeTo", authorizationInfo.SerialNumber, authorizationInfo.PIN))];
|
|
147
|
+
case 1:
|
|
148
|
+
_b.sent();
|
|
149
|
+
return [2];
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}); });
|
|
153
|
+
};
|
|
154
|
+
ExalusConnectionService.prototype.ConnectAndAuthorizeAsync = function (authorizationInfo) {
|
|
155
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
156
|
+
var conResult;
|
|
157
|
+
return __generator(this, function (_a) {
|
|
158
|
+
switch (_a.label) {
|
|
159
|
+
case 0: return [4, this.connectAsync()];
|
|
160
|
+
case 1:
|
|
161
|
+
conResult = _a.sent();
|
|
162
|
+
if (conResult != ConnectionResult.Connected)
|
|
163
|
+
return [2, conResult];
|
|
164
|
+
return [4, this.AuthorizeAsync(authorizationInfo)];
|
|
165
|
+
case 2: return [2, (_a.sent())
|
|
166
|
+
? ConnectionResult.Connected : ConnectionResult.AuthorizationFailed];
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
ExalusConnectionService.prototype.connectAsync = function () {
|
|
172
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
173
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
174
|
+
var dataReceivedEvent;
|
|
175
|
+
var _this = this;
|
|
176
|
+
return __generator(this, function (_h) {
|
|
177
|
+
switch (_h.label) {
|
|
178
|
+
case 0:
|
|
179
|
+
this.InitializeConnection();
|
|
180
|
+
return [4, ((_a = this._connection) === null || _a === void 0 ? void 0 : _a.start())];
|
|
181
|
+
case 1:
|
|
182
|
+
_h.sent();
|
|
183
|
+
(_b = this._connection) === null || _b === void 0 ? void 0 : _b.on("Pong", function () {
|
|
184
|
+
_this._log.Debug("Pong received <-");
|
|
185
|
+
_this._pongReceivedEvent.Invoke();
|
|
186
|
+
});
|
|
187
|
+
(_c = this._connection) === null || _c === void 0 ? void 0 : _c.on("Registration", function (data) {
|
|
188
|
+
var _a;
|
|
189
|
+
(_a = _this._registrationReceivedEvent) === null || _a === void 0 ? void 0 : _a.Invoke(data);
|
|
190
|
+
});
|
|
191
|
+
(_d = this._connection) === null || _d === void 0 ? void 0 : _d.on("Authorization", function (data) {
|
|
192
|
+
var _a;
|
|
193
|
+
_this._log.Debug("Received authorization response: ".concat(data));
|
|
194
|
+
(_a = _this._authorizationReceivedEvent) === null || _a === void 0 ? void 0 : _a.Invoke(data);
|
|
195
|
+
});
|
|
196
|
+
(_e = this._connection) === null || _e === void 0 ? void 0 : _e.on("SendError", function (sender, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
197
|
+
return __generator(this, function (_a) {
|
|
198
|
+
switch (_a.label) {
|
|
199
|
+
case 0:
|
|
200
|
+
if (!sender.startsWith("NotAuthorized:")) return [3, 2];
|
|
201
|
+
this._log.Warning("Failed to authorize!");
|
|
202
|
+
return [4, this.AuthorizeAsync(new AuthorizationInfo(this._serialId, this._PIN))];
|
|
203
|
+
case 1:
|
|
204
|
+
_a.sent();
|
|
205
|
+
return [3, 3];
|
|
206
|
+
case 2:
|
|
207
|
+
this._log.Error("Server returned error: ".concat(sender, " ").concat(data));
|
|
208
|
+
this._errorOccuredEvent.Invoke([sender, data]);
|
|
209
|
+
_a.label = 3;
|
|
210
|
+
case 3: return [2];
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
}); });
|
|
214
|
+
dataReceivedEvent = this._dataReceivedEvent;
|
|
215
|
+
(_f = this._connection) === null || _f === void 0 ? void 0 : _f.on("Data", function (sender, data) {
|
|
216
|
+
_this._log.Debug("Received data: ".concat(data));
|
|
217
|
+
dataReceivedEvent.Invoke(JSON.parse(data));
|
|
218
|
+
});
|
|
219
|
+
switch ((_g = this._connection) === null || _g === void 0 ? void 0 : _g.state) {
|
|
220
|
+
case signalR.HubConnectionState.Connected:
|
|
221
|
+
return [2, ConnectionResult.Connected];
|
|
222
|
+
case signalR.HubConnectionState.Connecting:
|
|
223
|
+
return [2, ConnectionResult.Connected];
|
|
224
|
+
case signalR.HubConnectionState.Disconnected:
|
|
225
|
+
return [2, ConnectionResult.FailedToConnect];
|
|
226
|
+
case signalR.HubConnectionState.Disconnecting:
|
|
227
|
+
return [2, ConnectionResult.FailedToConnect];
|
|
228
|
+
case signalR.HubConnectionState.Reconnecting:
|
|
229
|
+
return [2, ConnectionResult.FailedToConnect];
|
|
230
|
+
}
|
|
231
|
+
return [2, ConnectionResult.FailedToConnect];
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
};
|
|
236
|
+
ExalusConnectionService.prototype.DisconnectAsync = function () {
|
|
237
|
+
var _a;
|
|
238
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
239
|
+
return __generator(this, function (_b) {
|
|
240
|
+
switch (_b.label) {
|
|
241
|
+
case 0: return [4, ((_a = this._connection) === null || _a === void 0 ? void 0 : _a.stop())];
|
|
242
|
+
case 1:
|
|
243
|
+
_b.sent();
|
|
244
|
+
return [2];
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
};
|
|
249
|
+
ExalusConnectionService.prototype.IsConnected = function () {
|
|
250
|
+
var _a;
|
|
251
|
+
return ((_a = this._connection) === null || _a === void 0 ? void 0 : _a.state) === signalR.HubConnectionState.Connected;
|
|
252
|
+
};
|
|
253
|
+
ExalusConnectionService.prototype.SendAndWaitForResponseAsync = function (dataFrame, timeout, useCache) {
|
|
254
|
+
var _this = this;
|
|
255
|
+
var timeoutId = 0;
|
|
256
|
+
if (!this.IsConnected())
|
|
257
|
+
throw new Error("Connection is not established");
|
|
258
|
+
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
259
|
+
var onReceivedFrame, errorMessage;
|
|
260
|
+
var _this = this;
|
|
261
|
+
return __generator(this, function (_a) {
|
|
262
|
+
switch (_a.label) {
|
|
263
|
+
case 0:
|
|
264
|
+
onReceivedFrame = function (receivedFrame) {
|
|
265
|
+
if ((receivedFrame === null || receivedFrame === void 0 ? void 0 : receivedFrame.TransactionId) == dataFrame.TransactionId) {
|
|
266
|
+
window.clearTimeout(timeoutId);
|
|
267
|
+
_this._dataReceivedEvent.Unsubscribe(onReceivedFrame);
|
|
268
|
+
resolve(receivedFrame);
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
this._dataReceivedEvent.Subscribe(onReceivedFrame);
|
|
272
|
+
return [4, this.SendAsync(dataFrame)];
|
|
273
|
+
case 1:
|
|
274
|
+
if (!(_a.sent())) {
|
|
275
|
+
errorMessage = "Failed to send request, resource: ".concat(dataFrame.Resource, " method: ").concat(dataFrame.Method, " transaction id: ").concat(dataFrame.TransactionId);
|
|
276
|
+
reject(new Error(errorMessage));
|
|
277
|
+
}
|
|
278
|
+
else
|
|
279
|
+
timeoutId = window.setTimeout(function () {
|
|
280
|
+
_this._dataReceivedEvent.Unsubscribe(onReceivedFrame);
|
|
281
|
+
var errorMessage = "Response timeout, resource: ".concat(dataFrame.Resource, " method: ").concat(dataFrame.Method, " transaction id: ").concat(dataFrame.TransactionId);
|
|
282
|
+
_this._log.Error(ExalusConnectionService, errorMessage);
|
|
283
|
+
reject(new signalR.TimeoutError(errorMessage));
|
|
284
|
+
}, timeout);
|
|
285
|
+
return [2];
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
}); });
|
|
289
|
+
};
|
|
290
|
+
ExalusConnectionService.prototype.SendAsync = function (dataFrame) {
|
|
291
|
+
var _this = this;
|
|
292
|
+
if (!this.IsConnected())
|
|
293
|
+
throw new Error("Connection is not established");
|
|
294
|
+
return new Promise(function (resolve) {
|
|
295
|
+
var _a;
|
|
296
|
+
(_a = _this._connection) === null || _a === void 0 ? void 0 : _a.invoke("SendTo", _this._serialId, dataFrame).then(function () {
|
|
297
|
+
resolve(true);
|
|
298
|
+
}).catch(function (err) {
|
|
299
|
+
_this._log.Error(ExalusConnectionService, err);
|
|
300
|
+
resolve(false);
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
};
|
|
304
|
+
ExalusConnectionService.prototype.OnDataReceivedEvent = function () {
|
|
305
|
+
return this._dataReceivedEvent;
|
|
306
|
+
};
|
|
307
|
+
ExalusConnectionService.prototype.OnConnectionStateChangedEvent = function () {
|
|
308
|
+
return this._connectionStateChangedEvent;
|
|
309
|
+
};
|
|
310
|
+
ExalusConnectionService.prototype.OnErrorOccuredEvent = function () {
|
|
311
|
+
return this._errorOccuredEvent;
|
|
312
|
+
};
|
|
313
|
+
return ExalusConnectionService;
|
|
314
|
+
}());
|
|
315
|
+
export { ExalusConnectionService };
|
|
316
|
+
//# sourceMappingURL=ExalusConnectionService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExalusConnectionService.js","sourceRoot":"","sources":["../../src/ExalusConnectionService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;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
|
4
|
+
Helpers.GenerateUUID = function () {
|
|
5
|
+
var d = new Date().getTime();
|
|
6
|
+
var d2 = ((typeof performance !== 'undefined') && performance.now && (performance.now() * 1000)) || 0;
|
|
7
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
8
|
+
var r = Math.random() * 16;
|
|
9
|
+
if (d > 0) {
|
|
10
|
+
r = (d + r) % 16 | 0;
|
|
11
|
+
d = Math.floor(d / 16);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
r = (d2 + r) % 16 | 0;
|
|
15
|
+
d2 = Math.floor(d2 / 16);
|
|
16
|
+
}
|
|
17
|
+
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
return Helpers;
|
|
21
|
+
}());
|
|
22
|
+
export { Helpers };
|
|
23
|
+
//# sourceMappingURL=Helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Helpers.js","sourceRoot":"","sources":["../../src/Helpers.ts"],"names":[],"mappings":"AAAA;IAAA;IAmBA,CAAC;IAlBU,oBAAY,GAAnB;QACI,IAAI,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;QAC7B,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,WAAW,KAAK,WAAW,CAAC,IAAI,WAAW,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QAEtG,OAAO,sCAAsC,CAAC,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC;YACtE,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC;YAE3B,IAAI,CAAC,GAAG,CAAC,EAAE;gBACP,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;gBACrB,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;aAC1B;iBACI;gBACD,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;gBACtB,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;aAC5B;YACD,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC1D,CAAC,CAAC,CAAC;IACP,CAAC;IACL,cAAC;AAAD,CAAC,AAnBD,IAmBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IDIService.js","sourceRoot":"","sources":["../../src/IDIService.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ITypedEvent } from "./TypedEvent";
|
|
2
|
+
import { IDataFrame } from "./DataFrame";
|
|
3
|
+
import { IDIService } from "./IDIService";
|
|
4
|
+
export interface IExalusConnectionService extends IDIService {
|
|
5
|
+
SetServersBrokerAddress(address: string): void;
|
|
6
|
+
SetDefaultPacketsBrokerAddress(address: string): void;
|
|
7
|
+
GetServerAddressAsync(): Promise<[IsAddressKnown: boolean, ServerUri: string]>;
|
|
8
|
+
ConnectAsync(address: string): Promise<ConnectionResult>;
|
|
9
|
+
AuthorizeAsync(authorizationInfo: AuthorizationInfo): Promise<boolean>;
|
|
10
|
+
ConnectAndAuthorizeAsync(authorizationInfo: AuthorizationInfo): Promise<ConnectionResult>;
|
|
11
|
+
DisconnectAsync(): Promise<void>;
|
|
12
|
+
IsConnected(): boolean;
|
|
13
|
+
SendAsync(dataFrame: IDataFrame<any>): Promise<boolean>;
|
|
14
|
+
SendAndWaitForResponseAsync<T>(dataFrame: IDataFrame<any>, timeout: number, useCache: boolean): Promise<IDataFrame<T>>;
|
|
15
|
+
OnDataReceivedEvent(): ITypedEvent<IDataFrame<any>>;
|
|
16
|
+
OnErrorOccuredEvent(): ITypedEvent<[sender: string, data: string]>;
|
|
17
|
+
OnConnectionStateChangedEvent(): ITypedEvent<ConnectionState>;
|
|
18
|
+
}
|
|
19
|
+
export declare class AuthorizationInfo {
|
|
20
|
+
serialNumber: string;
|
|
21
|
+
pin: string;
|
|
22
|
+
constructor(serialNumber: string, pin: string);
|
|
23
|
+
SerialNumber: string;
|
|
24
|
+
PIN: string;
|
|
25
|
+
}
|
|
26
|
+
export declare enum ConnectionType {
|
|
27
|
+
ByCloud = 0,
|
|
28
|
+
LocalNetwork = 1,
|
|
29
|
+
P2P = 2
|
|
30
|
+
}
|
|
31
|
+
export declare enum ConnectionResult {
|
|
32
|
+
FailedToConnect = 0,
|
|
33
|
+
AuthorizationFailed = 1,
|
|
34
|
+
FailedToConnectToServer = 2,
|
|
35
|
+
Connected = 3
|
|
36
|
+
}
|
|
37
|
+
export declare enum ConnectionState {
|
|
38
|
+
Disconnected = 0,
|
|
39
|
+
Connecting = 1,
|
|
40
|
+
Connected = 3,
|
|
41
|
+
Disconnecting = 4,
|
|
42
|
+
Failed = 5,
|
|
43
|
+
Reconnecting = 6
|
|
44
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var AuthorizationInfo = (function () {
|
|
2
|
+
function AuthorizationInfo(serialNumber, pin) {
|
|
3
|
+
this.serialNumber = serialNumber;
|
|
4
|
+
this.pin = pin;
|
|
5
|
+
this.SerialNumber = serialNumber;
|
|
6
|
+
this.PIN = pin;
|
|
7
|
+
}
|
|
8
|
+
return AuthorizationInfo;
|
|
9
|
+
}());
|
|
10
|
+
export { AuthorizationInfo };
|
|
11
|
+
export var ConnectionType;
|
|
12
|
+
(function (ConnectionType) {
|
|
13
|
+
ConnectionType[ConnectionType["ByCloud"] = 0] = "ByCloud";
|
|
14
|
+
ConnectionType[ConnectionType["LocalNetwork"] = 1] = "LocalNetwork";
|
|
15
|
+
ConnectionType[ConnectionType["P2P"] = 2] = "P2P";
|
|
16
|
+
})(ConnectionType || (ConnectionType = {}));
|
|
17
|
+
export var ConnectionResult;
|
|
18
|
+
(function (ConnectionResult) {
|
|
19
|
+
ConnectionResult[ConnectionResult["FailedToConnect"] = 0] = "FailedToConnect";
|
|
20
|
+
ConnectionResult[ConnectionResult["AuthorizationFailed"] = 1] = "AuthorizationFailed";
|
|
21
|
+
ConnectionResult[ConnectionResult["FailedToConnectToServer"] = 2] = "FailedToConnectToServer";
|
|
22
|
+
ConnectionResult[ConnectionResult["Connected"] = 3] = "Connected";
|
|
23
|
+
})(ConnectionResult || (ConnectionResult = {}));
|
|
24
|
+
export var ConnectionState;
|
|
25
|
+
(function (ConnectionState) {
|
|
26
|
+
ConnectionState[ConnectionState["Disconnected"] = 0] = "Disconnected";
|
|
27
|
+
ConnectionState[ConnectionState["Connecting"] = 1] = "Connecting";
|
|
28
|
+
ConnectionState[ConnectionState["Connected"] = 3] = "Connected";
|
|
29
|
+
ConnectionState[ConnectionState["Disconnecting"] = 4] = "Disconnecting";
|
|
30
|
+
ConnectionState[ConnectionState["Failed"] = 5] = "Failed";
|
|
31
|
+
ConnectionState[ConnectionState["Reconnecting"] = 6] = "Reconnecting";
|
|
32
|
+
})(ConnectionState || (ConnectionState = {}));
|
|
33
|
+
//# sourceMappingURL=IExalusConnector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IExalusConnector.js","sourceRoot":"","sources":["../../src/IExalusConnector.ts"],"names":[],"mappings":"AAoBA;IACI,2BAA0B,YAAoB,EAAS,GAAW;QAAxC,iBAAY,GAAZ,YAAY,CAAQ;QAAS,QAAG,GAAH,GAAG,CAAQ;QAC9D,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;IAIL,wBAAC;AAAD,CAAC,AARD,IAQC;;AAED,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACtB,yDAAW,CAAA;IACX,mEAAgB,CAAA;IAChB,iDAAO,CAAA;AACX,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB;AAED,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IACxB,6EAAmB,CAAA;IACnB,qFAAuB,CAAA;IACvB,6FAA2B,CAAA;IAC3B,iEAAa,CAAA;AACjB,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B;AAED,MAAM,CAAN,IAAY,eAOX;AAPD,WAAY,eAAe;IACvB,qEAAgB,CAAA;IAChB,iEAAc,CAAA;IACd,+DAAa,CAAA;IACb,uEAAiB,CAAA;IACjB,yDAAU,CAAA;IACV,qEAAgB,CAAA;AACpB,CAAC,EAPW,eAAe,KAAf,eAAe,QAO1B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ITypedEvent } from '../../TypedEvent';
|
|
2
|
+
import { FieldChangeResult } from '../FieldChangeResult';
|
|
3
|
+
import { CommunicationWay, DeviceResponseType, DeviceState, DeviceTaskType, DeviceType, IDevice } from './IDevice';
|
|
4
|
+
import { IDeviceChannel } from './IDeviceChannel';
|
|
5
|
+
import { IDeviceState } from './IDeviceState';
|
|
6
|
+
import { IDeviceTask } from './IDeviceTask';
|
|
7
|
+
import { DeviceTaskExecutionResult } from './TaskExecutionResult';
|
|
8
|
+
export declare class Device implements IDevice {
|
|
9
|
+
OnDeviceStateChangedEvent(): ITypedEvent<IDeviceState>;
|
|
10
|
+
get SerialNumber(): string;
|
|
11
|
+
get ModelGuid(): string;
|
|
12
|
+
get ManufacturerGuid(): string;
|
|
13
|
+
get IsVirtual(): boolean;
|
|
14
|
+
get IsEnabled(): boolean;
|
|
15
|
+
get DeviceState(): DeviceState;
|
|
16
|
+
get DeviceType(): DeviceType;
|
|
17
|
+
get CommunicationWay(): CommunicationWay;
|
|
18
|
+
get AvailableTasks(): string[];
|
|
19
|
+
get AvailableTaskTypes(): DeviceTaskType[];
|
|
20
|
+
get AvailableResponseTypes(): DeviceResponseType[];
|
|
21
|
+
get Channels(): IDeviceChannel[];
|
|
22
|
+
ChangeDeviceNameAsync(name: string): Promise<FieldChangeResult>;
|
|
23
|
+
ExecuteTaskAsync(task: IDeviceTask, channel: number): Promise<DeviceTaskExecutionResult>;
|
|
24
|
+
private _guid?;
|
|
25
|
+
private _name?;
|
|
26
|
+
private _channelsAmount?;
|
|
27
|
+
get Guid(): string;
|
|
28
|
+
set Guid(guid: string);
|
|
29
|
+
get Name(): string;
|
|
30
|
+
set Name(name: string);
|
|
31
|
+
get ChannelsAmount(): number;
|
|
32
|
+
set ChannelsAmount(amount: number);
|
|
33
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
var Device = (function () {
|
|
2
|
+
function Device() {
|
|
3
|
+
}
|
|
4
|
+
Device.prototype.OnDeviceStateChangedEvent = function () {
|
|
5
|
+
throw new Error('Method not implemented.');
|
|
6
|
+
};
|
|
7
|
+
Object.defineProperty(Device.prototype, "SerialNumber", {
|
|
8
|
+
get: function () {
|
|
9
|
+
throw new Error('Method not implemented.');
|
|
10
|
+
},
|
|
11
|
+
enumerable: false,
|
|
12
|
+
configurable: true
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(Device.prototype, "ModelGuid", {
|
|
15
|
+
get: function () {
|
|
16
|
+
throw new Error('Method not implemented.');
|
|
17
|
+
},
|
|
18
|
+
enumerable: false,
|
|
19
|
+
configurable: true
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(Device.prototype, "ManufacturerGuid", {
|
|
22
|
+
get: function () {
|
|
23
|
+
throw new Error('Method not implemented.');
|
|
24
|
+
},
|
|
25
|
+
enumerable: false,
|
|
26
|
+
configurable: true
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(Device.prototype, "IsVirtual", {
|
|
29
|
+
get: function () {
|
|
30
|
+
throw new Error('Method not implemented.');
|
|
31
|
+
},
|
|
32
|
+
enumerable: false,
|
|
33
|
+
configurable: true
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(Device.prototype, "IsEnabled", {
|
|
36
|
+
get: function () {
|
|
37
|
+
throw new Error('Method not implemented.');
|
|
38
|
+
},
|
|
39
|
+
enumerable: false,
|
|
40
|
+
configurable: true
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(Device.prototype, "DeviceState", {
|
|
43
|
+
get: function () {
|
|
44
|
+
throw new Error('Method not implemented.');
|
|
45
|
+
},
|
|
46
|
+
enumerable: false,
|
|
47
|
+
configurable: true
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(Device.prototype, "DeviceType", {
|
|
50
|
+
get: function () {
|
|
51
|
+
throw new Error('Method not implemented.');
|
|
52
|
+
},
|
|
53
|
+
enumerable: false,
|
|
54
|
+
configurable: true
|
|
55
|
+
});
|
|
56
|
+
Object.defineProperty(Device.prototype, "CommunicationWay", {
|
|
57
|
+
get: function () {
|
|
58
|
+
throw new Error('Method not implemented.');
|
|
59
|
+
},
|
|
60
|
+
enumerable: false,
|
|
61
|
+
configurable: true
|
|
62
|
+
});
|
|
63
|
+
Object.defineProperty(Device.prototype, "AvailableTasks", {
|
|
64
|
+
get: function () {
|
|
65
|
+
throw new Error('Method not implemented.');
|
|
66
|
+
},
|
|
67
|
+
enumerable: false,
|
|
68
|
+
configurable: true
|
|
69
|
+
});
|
|
70
|
+
Object.defineProperty(Device.prototype, "AvailableTaskTypes", {
|
|
71
|
+
get: function () {
|
|
72
|
+
throw new Error('Method not implemented.');
|
|
73
|
+
},
|
|
74
|
+
enumerable: false,
|
|
75
|
+
configurable: true
|
|
76
|
+
});
|
|
77
|
+
Object.defineProperty(Device.prototype, "AvailableResponseTypes", {
|
|
78
|
+
get: function () {
|
|
79
|
+
throw new Error('Method not implemented.');
|
|
80
|
+
},
|
|
81
|
+
enumerable: false,
|
|
82
|
+
configurable: true
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(Device.prototype, "Channels", {
|
|
85
|
+
get: function () {
|
|
86
|
+
throw new Error('Method not implemented.');
|
|
87
|
+
},
|
|
88
|
+
enumerable: false,
|
|
89
|
+
configurable: true
|
|
90
|
+
});
|
|
91
|
+
Device.prototype.ChangeDeviceNameAsync = function (name) {
|
|
92
|
+
throw new Error('Method not implemented.');
|
|
93
|
+
};
|
|
94
|
+
Device.prototype.ExecuteTaskAsync = function (task, channel) {
|
|
95
|
+
throw new Error('Method not implemented.');
|
|
96
|
+
};
|
|
97
|
+
Object.defineProperty(Device.prototype, "Guid", {
|
|
98
|
+
get: function () {
|
|
99
|
+
return this._guid == null ? "" : this._guid;
|
|
100
|
+
},
|
|
101
|
+
set: function (guid) {
|
|
102
|
+
this._guid = guid;
|
|
103
|
+
},
|
|
104
|
+
enumerable: false,
|
|
105
|
+
configurable: true
|
|
106
|
+
});
|
|
107
|
+
Object.defineProperty(Device.prototype, "Name", {
|
|
108
|
+
get: function () {
|
|
109
|
+
return this._name == null ? "" : this._name;
|
|
110
|
+
},
|
|
111
|
+
set: function (name) {
|
|
112
|
+
this._name = name;
|
|
113
|
+
},
|
|
114
|
+
enumerable: false,
|
|
115
|
+
configurable: true
|
|
116
|
+
});
|
|
117
|
+
Object.defineProperty(Device.prototype, "ChannelsAmount", {
|
|
118
|
+
get: function () {
|
|
119
|
+
return this._channelsAmount == null ? 0 : this._channelsAmount;
|
|
120
|
+
},
|
|
121
|
+
set: function (amount) {
|
|
122
|
+
this._channelsAmount = amount;
|
|
123
|
+
},
|
|
124
|
+
enumerable: false,
|
|
125
|
+
configurable: true
|
|
126
|
+
});
|
|
127
|
+
return Device;
|
|
128
|
+
}());
|
|
129
|
+
export { Device };
|
|
130
|
+
//# sourceMappingURL=Device.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Device.js","sourceRoot":"","sources":["../../../../src/Services/Devices/Device.ts"],"names":[],"mappings":"AAQA;IAAA;IAyEA,CAAC;IAxEG,0CAAyB,GAAzB;QACI,MA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qB,GAArB,UAAsB,IAAY;QAC9B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;IACD,iCAAgB,GAAhB,UAAiB,IAAiB,EAAE,OAAe;QAC/C,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;IAKD,sBAAW,wBAAI;aAAf;YACI,OAAO,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;QAChD,CAAC;aAED,UAAgB,IAAY;YACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QACtB,CAAC;;;OAJA;IAMD,sBAAW,wBAAI;aAAf;YACI,OAAO,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;QAChD,CAAC;aAED,UAAgB,IAAY;YACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QACtB,CAAC;;;OAJA;IAMD,sBAAI,kCAAc;aAAlB;YACI,OAAO,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC;QACnE,CAAC;aAED,UAA0B,MAAc;YACpC,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC;QAClC,CAAC;;;OAJA;IAKL,aAAC;AAAD,CAAC,AAzED,IAyEC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { IDIService } from '../../IDIService';
|
|
2
|
+
import { ITypedEvent } from '../../TypedEvent';
|
|
3
|
+
import { IDevice } from './IDevice';
|
|
4
|
+
import { IDevicesService } from './IDevicesService';
|
|
5
|
+
import { IDeviceState } from './IDeviceState';
|
|
6
|
+
export declare class DevicesService implements IDIService, IDevicesService {
|
|
7
|
+
private _serviceName;
|
|
8
|
+
private _onDeviceFoundEvent;
|
|
9
|
+
private _onDeviceRegisteredEvent;
|
|
10
|
+
private _onDeviceRemovedEvent;
|
|
11
|
+
private _onDeviceStateChangedEvent;
|
|
12
|
+
GetServiceName(): string;
|
|
13
|
+
SyncDevicesStatesAsync(): Promise<IDeviceState[]>;
|
|
14
|
+
OnDeviceStateChangedEvent(): ITypedEvent<[Device: IDevice, State: IDeviceState]>;
|
|
15
|
+
OnDeviceRegisteredEvent(): ITypedEvent<IDevice>;
|
|
16
|
+
OnDeviceRemovedEvent(): ITypedEvent<IDevice>;
|
|
17
|
+
OnDeviceFoundEvent(): ITypedEvent<IDevice>;
|
|
18
|
+
GetDevicesAsync(): Promise<IDevice[]>;
|
|
19
|
+
GetDevice(guid: string): Promise<IDevice>;
|
|
20
|
+
FindDevicesAsync(device: IDevice): Promise<void>;
|
|
21
|
+
RegisterDeviceAsync(device: IDevice): Promise<void>;
|
|
22
|
+
RemoveDeviceAsync(device: IDevice): Promise<void>;
|
|
23
|
+
}
|