@lazycatcloud/sdk 0.1.456 → 0.1.458
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/common/box.d.ts +542 -0
- package/dist/common/box.d.ts.map +1 -1
- package/dist/common/box.js +870 -53
- package/dist/common/box.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/localdevice/ble.d.ts +414 -0
- package/dist/localdevice/ble.d.ts.map +1 -0
- package/dist/localdevice/ble.js +859 -0
- package/dist/localdevice/ble.js.map +1 -0
- package/dist/localdevice/clipboard.d.ts +137 -0
- package/dist/localdevice/clipboard.d.ts.map +1 -0
- package/dist/localdevice/clipboard.js +433 -0
- package/dist/localdevice/clipboard.js.map +1 -0
- package/dist/localdevice/contacts.d.ts +29 -0
- package/dist/localdevice/contacts.d.ts.map +1 -1
- package/dist/localdevice/contacts.js +118 -1
- package/dist/localdevice/contacts.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/sys/OS_daemon.d.ts +133 -0
- package/dist/sys/OS_daemon.d.ts.map +1 -0
- package/dist/sys/OS_daemon.js +364 -0
- package/dist/sys/OS_daemon.js.map +1 -0
- package/dist/sys/OS_snapshot.d.ts +585 -0
- package/dist/sys/OS_snapshot.d.ts.map +1 -0
- package/dist/sys/OS_snapshot.js +1495 -0
- package/dist/sys/OS_snapshot.js.map +1 -0
- package/dist/sys/OS_upgrader.d.ts +202 -0
- package/dist/sys/OS_upgrader.d.ts.map +1 -0
- package/dist/sys/OS_upgrader.js +623 -0
- package/dist/sys/OS_upgrader.js.map +1 -0
- package/dist/sys/box-status.d.ts +603 -0
- package/dist/sys/box-status.d.ts.map +1 -0
- package/dist/sys/box-status.js +1004 -0
- package/dist/sys/box-status.js.map +1 -0
- package/dist/sys/hal.d.ts +174 -0
- package/dist/sys/hal.d.ts.map +1 -1
- package/dist/sys/hal.js +553 -1
- package/dist/sys/hal.js.map +1 -1
- package/dist/sys/hc-core/hc-core.d.ts +696 -0
- package/dist/sys/hc-core/hc-core.d.ts.map +1 -0
- package/dist/sys/hc-core/hc-core.js +1514 -0
- package/dist/sys/hc-core/hc-core.js.map +1 -0
- package/dist/sys/installer.d.ts +277 -0
- package/dist/sys/installer.d.ts.map +1 -0
- package/dist/sys/installer.js +773 -0
- package/dist/sys/installer.js.map +1 -0
- package/dist/sys/package_manager.d.ts +79 -69
- package/dist/sys/package_manager.d.ts.map +1 -1
- package/dist/sys/package_manager.js +86 -121
- package/dist/sys/package_manager.js.map +1 -1
- package/dist/sys/portal-server/portal-server.d.ts +849 -0
- package/dist/sys/portal-server/portal-server.d.ts.map +1 -0
- package/dist/sys/portal-server/portal-server.js +2350 -0
- package/dist/sys/portal-server/portal-server.js.map +1 -0
- package/dist/sys/snapd.d.ts +343 -0
- package/dist/sys/snapd.d.ts.map +1 -0
- package/dist/sys/snapd.js +776 -0
- package/dist/sys/snapd.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/test.d.mts +0 -2
- package/dist/test.d.mts.map +0 -1
- package/dist/test.mjs +0 -10
- package/dist/test.mjs.map +0 -1
|
@@ -0,0 +1,859 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.GrpcWebError = exports.GrpcWebImpl = exports.BleManagerReadDesc = exports.BleManagerWriteDesc = exports.BleManagerConnectBleDesc = exports.BleManagerScanBleDesc = exports.BleManagerDesc = exports.BleManagerClientImpl = exports.ReadReply = exports.ReadRequest = exports.WriteReply = exports.WriteRequest = exports.BluetoothGattCharacteristic = exports.BleService = exports.ConnectBleReply = exports.ConnectBleRequest = exports.BluetoothDevice = exports.ScanBleRequest = void 0;
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
const grpc_web_1 = require("@improbable-eng/grpc-web");
|
|
9
|
+
const browser_headers_1 = require("browser-headers");
|
|
10
|
+
const minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
11
|
+
const rxjs_1 = require("rxjs");
|
|
12
|
+
const operators_1 = require("rxjs/operators");
|
|
13
|
+
function createBaseScanBleRequest() {
|
|
14
|
+
return { serviceUuid: undefined };
|
|
15
|
+
}
|
|
16
|
+
exports.ScanBleRequest = {
|
|
17
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
18
|
+
if (message.serviceUuid !== undefined) {
|
|
19
|
+
writer.uint32(10).string(message.serviceUuid);
|
|
20
|
+
}
|
|
21
|
+
return writer;
|
|
22
|
+
},
|
|
23
|
+
decode(input, length) {
|
|
24
|
+
const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
|
|
25
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
26
|
+
const message = createBaseScanBleRequest();
|
|
27
|
+
while (reader.pos < end) {
|
|
28
|
+
const tag = reader.uint32();
|
|
29
|
+
switch (tag >>> 3) {
|
|
30
|
+
case 1:
|
|
31
|
+
if (tag !== 10) {
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
message.serviceUuid = reader.string();
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
reader.skipType(tag & 7);
|
|
41
|
+
}
|
|
42
|
+
return message;
|
|
43
|
+
},
|
|
44
|
+
fromJSON(object) {
|
|
45
|
+
return { serviceUuid: isSet(object.serviceUuid) ? String(object.serviceUuid) : undefined };
|
|
46
|
+
},
|
|
47
|
+
toJSON(message) {
|
|
48
|
+
const obj = {};
|
|
49
|
+
if (message.serviceUuid !== undefined) {
|
|
50
|
+
obj.serviceUuid = message.serviceUuid;
|
|
51
|
+
}
|
|
52
|
+
return obj;
|
|
53
|
+
},
|
|
54
|
+
create(base) {
|
|
55
|
+
return exports.ScanBleRequest.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
56
|
+
},
|
|
57
|
+
fromPartial(object) {
|
|
58
|
+
var _a;
|
|
59
|
+
const message = createBaseScanBleRequest();
|
|
60
|
+
message.serviceUuid = (_a = object.serviceUuid) !== null && _a !== void 0 ? _a : undefined;
|
|
61
|
+
return message;
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
function createBaseBluetoothDevice() {
|
|
65
|
+
return { deviceName: "", deviceAddress: "" };
|
|
66
|
+
}
|
|
67
|
+
exports.BluetoothDevice = {
|
|
68
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
69
|
+
if (message.deviceName !== "") {
|
|
70
|
+
writer.uint32(10).string(message.deviceName);
|
|
71
|
+
}
|
|
72
|
+
if (message.deviceAddress !== "") {
|
|
73
|
+
writer.uint32(18).string(message.deviceAddress);
|
|
74
|
+
}
|
|
75
|
+
return writer;
|
|
76
|
+
},
|
|
77
|
+
decode(input, length) {
|
|
78
|
+
const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
|
|
79
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
80
|
+
const message = createBaseBluetoothDevice();
|
|
81
|
+
while (reader.pos < end) {
|
|
82
|
+
const tag = reader.uint32();
|
|
83
|
+
switch (tag >>> 3) {
|
|
84
|
+
case 1:
|
|
85
|
+
if (tag !== 10) {
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
message.deviceName = reader.string();
|
|
89
|
+
continue;
|
|
90
|
+
case 2:
|
|
91
|
+
if (tag !== 18) {
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
message.deviceAddress = reader.string();
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
reader.skipType(tag & 7);
|
|
101
|
+
}
|
|
102
|
+
return message;
|
|
103
|
+
},
|
|
104
|
+
fromJSON(object) {
|
|
105
|
+
return {
|
|
106
|
+
deviceName: isSet(object.deviceName) ? String(object.deviceName) : "",
|
|
107
|
+
deviceAddress: isSet(object.deviceAddress) ? String(object.deviceAddress) : "",
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
toJSON(message) {
|
|
111
|
+
const obj = {};
|
|
112
|
+
if (message.deviceName !== "") {
|
|
113
|
+
obj.deviceName = message.deviceName;
|
|
114
|
+
}
|
|
115
|
+
if (message.deviceAddress !== "") {
|
|
116
|
+
obj.deviceAddress = message.deviceAddress;
|
|
117
|
+
}
|
|
118
|
+
return obj;
|
|
119
|
+
},
|
|
120
|
+
create(base) {
|
|
121
|
+
return exports.BluetoothDevice.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
122
|
+
},
|
|
123
|
+
fromPartial(object) {
|
|
124
|
+
var _a, _b;
|
|
125
|
+
const message = createBaseBluetoothDevice();
|
|
126
|
+
message.deviceName = (_a = object.deviceName) !== null && _a !== void 0 ? _a : "";
|
|
127
|
+
message.deviceAddress = (_b = object.deviceAddress) !== null && _b !== void 0 ? _b : "";
|
|
128
|
+
return message;
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
function createBaseConnectBleRequest() {
|
|
132
|
+
return { deviceAddress: "" };
|
|
133
|
+
}
|
|
134
|
+
exports.ConnectBleRequest = {
|
|
135
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
136
|
+
if (message.deviceAddress !== "") {
|
|
137
|
+
writer.uint32(10).string(message.deviceAddress);
|
|
138
|
+
}
|
|
139
|
+
return writer;
|
|
140
|
+
},
|
|
141
|
+
decode(input, length) {
|
|
142
|
+
const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
|
|
143
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
144
|
+
const message = createBaseConnectBleRequest();
|
|
145
|
+
while (reader.pos < end) {
|
|
146
|
+
const tag = reader.uint32();
|
|
147
|
+
switch (tag >>> 3) {
|
|
148
|
+
case 1:
|
|
149
|
+
if (tag !== 10) {
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
message.deviceAddress = reader.string();
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
reader.skipType(tag & 7);
|
|
159
|
+
}
|
|
160
|
+
return message;
|
|
161
|
+
},
|
|
162
|
+
fromJSON(object) {
|
|
163
|
+
return { deviceAddress: isSet(object.deviceAddress) ? String(object.deviceAddress) : "" };
|
|
164
|
+
},
|
|
165
|
+
toJSON(message) {
|
|
166
|
+
const obj = {};
|
|
167
|
+
if (message.deviceAddress !== "") {
|
|
168
|
+
obj.deviceAddress = message.deviceAddress;
|
|
169
|
+
}
|
|
170
|
+
return obj;
|
|
171
|
+
},
|
|
172
|
+
create(base) {
|
|
173
|
+
return exports.ConnectBleRequest.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
174
|
+
},
|
|
175
|
+
fromPartial(object) {
|
|
176
|
+
var _a;
|
|
177
|
+
const message = createBaseConnectBleRequest();
|
|
178
|
+
message.deviceAddress = (_a = object.deviceAddress) !== null && _a !== void 0 ? _a : "";
|
|
179
|
+
return message;
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
function createBaseConnectBleReply() {
|
|
183
|
+
return { services: [] };
|
|
184
|
+
}
|
|
185
|
+
exports.ConnectBleReply = {
|
|
186
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
187
|
+
for (const v of message.services) {
|
|
188
|
+
exports.BleService.encode(v, writer.uint32(10).fork()).ldelim();
|
|
189
|
+
}
|
|
190
|
+
return writer;
|
|
191
|
+
},
|
|
192
|
+
decode(input, length) {
|
|
193
|
+
const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
|
|
194
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
195
|
+
const message = createBaseConnectBleReply();
|
|
196
|
+
while (reader.pos < end) {
|
|
197
|
+
const tag = reader.uint32();
|
|
198
|
+
switch (tag >>> 3) {
|
|
199
|
+
case 1:
|
|
200
|
+
if (tag !== 10) {
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
message.services.push(exports.BleService.decode(reader, reader.uint32()));
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
reader.skipType(tag & 7);
|
|
210
|
+
}
|
|
211
|
+
return message;
|
|
212
|
+
},
|
|
213
|
+
fromJSON(object) {
|
|
214
|
+
return { services: Array.isArray(object === null || object === void 0 ? void 0 : object.services) ? object.services.map((e) => exports.BleService.fromJSON(e)) : [] };
|
|
215
|
+
},
|
|
216
|
+
toJSON(message) {
|
|
217
|
+
var _a;
|
|
218
|
+
const obj = {};
|
|
219
|
+
if ((_a = message.services) === null || _a === void 0 ? void 0 : _a.length) {
|
|
220
|
+
obj.services = message.services.map((e) => exports.BleService.toJSON(e));
|
|
221
|
+
}
|
|
222
|
+
return obj;
|
|
223
|
+
},
|
|
224
|
+
create(base) {
|
|
225
|
+
return exports.ConnectBleReply.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
226
|
+
},
|
|
227
|
+
fromPartial(object) {
|
|
228
|
+
var _a;
|
|
229
|
+
const message = createBaseConnectBleReply();
|
|
230
|
+
message.services = ((_a = object.services) === null || _a === void 0 ? void 0 : _a.map((e) => exports.BleService.fromPartial(e))) || [];
|
|
231
|
+
return message;
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
function createBaseBleService() {
|
|
235
|
+
return { uuid: "", serviceType: 0, gattCharacteristics: [] };
|
|
236
|
+
}
|
|
237
|
+
exports.BleService = {
|
|
238
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
239
|
+
if (message.uuid !== "") {
|
|
240
|
+
writer.uint32(10).string(message.uuid);
|
|
241
|
+
}
|
|
242
|
+
if (message.serviceType !== 0) {
|
|
243
|
+
writer.uint32(16).int32(message.serviceType);
|
|
244
|
+
}
|
|
245
|
+
for (const v of message.gattCharacteristics) {
|
|
246
|
+
exports.BluetoothGattCharacteristic.encode(v, writer.uint32(26).fork()).ldelim();
|
|
247
|
+
}
|
|
248
|
+
return writer;
|
|
249
|
+
},
|
|
250
|
+
decode(input, length) {
|
|
251
|
+
const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
|
|
252
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
253
|
+
const message = createBaseBleService();
|
|
254
|
+
while (reader.pos < end) {
|
|
255
|
+
const tag = reader.uint32();
|
|
256
|
+
switch (tag >>> 3) {
|
|
257
|
+
case 1:
|
|
258
|
+
if (tag !== 10) {
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
message.uuid = reader.string();
|
|
262
|
+
continue;
|
|
263
|
+
case 2:
|
|
264
|
+
if (tag !== 16) {
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
message.serviceType = reader.int32();
|
|
268
|
+
continue;
|
|
269
|
+
case 3:
|
|
270
|
+
if (tag !== 26) {
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
message.gattCharacteristics.push(exports.BluetoothGattCharacteristic.decode(reader, reader.uint32()));
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
reader.skipType(tag & 7);
|
|
280
|
+
}
|
|
281
|
+
return message;
|
|
282
|
+
},
|
|
283
|
+
fromJSON(object) {
|
|
284
|
+
return {
|
|
285
|
+
uuid: isSet(object.uuid) ? String(object.uuid) : "",
|
|
286
|
+
serviceType: isSet(object.serviceType) ? Number(object.serviceType) : 0,
|
|
287
|
+
gattCharacteristics: Array.isArray(object === null || object === void 0 ? void 0 : object.gattCharacteristics)
|
|
288
|
+
? object.gattCharacteristics.map((e) => exports.BluetoothGattCharacteristic.fromJSON(e))
|
|
289
|
+
: [],
|
|
290
|
+
};
|
|
291
|
+
},
|
|
292
|
+
toJSON(message) {
|
|
293
|
+
var _a;
|
|
294
|
+
const obj = {};
|
|
295
|
+
if (message.uuid !== "") {
|
|
296
|
+
obj.uuid = message.uuid;
|
|
297
|
+
}
|
|
298
|
+
if (message.serviceType !== 0) {
|
|
299
|
+
obj.serviceType = Math.round(message.serviceType);
|
|
300
|
+
}
|
|
301
|
+
if ((_a = message.gattCharacteristics) === null || _a === void 0 ? void 0 : _a.length) {
|
|
302
|
+
obj.gattCharacteristics = message.gattCharacteristics.map((e) => exports.BluetoothGattCharacteristic.toJSON(e));
|
|
303
|
+
}
|
|
304
|
+
return obj;
|
|
305
|
+
},
|
|
306
|
+
create(base) {
|
|
307
|
+
return exports.BleService.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
308
|
+
},
|
|
309
|
+
fromPartial(object) {
|
|
310
|
+
var _a, _b, _c;
|
|
311
|
+
const message = createBaseBleService();
|
|
312
|
+
message.uuid = (_a = object.uuid) !== null && _a !== void 0 ? _a : "";
|
|
313
|
+
message.serviceType = (_b = object.serviceType) !== null && _b !== void 0 ? _b : 0;
|
|
314
|
+
message.gattCharacteristics = ((_c = object.gattCharacteristics) === null || _c === void 0 ? void 0 : _c.map((e) => exports.BluetoothGattCharacteristic.fromPartial(e))) ||
|
|
315
|
+
[];
|
|
316
|
+
return message;
|
|
317
|
+
},
|
|
318
|
+
};
|
|
319
|
+
function createBaseBluetoothGattCharacteristic() {
|
|
320
|
+
return { uuid: "", properties: 0 };
|
|
321
|
+
}
|
|
322
|
+
exports.BluetoothGattCharacteristic = {
|
|
323
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
324
|
+
if (message.uuid !== "") {
|
|
325
|
+
writer.uint32(10).string(message.uuid);
|
|
326
|
+
}
|
|
327
|
+
if (message.properties !== 0) {
|
|
328
|
+
writer.uint32(16).int32(message.properties);
|
|
329
|
+
}
|
|
330
|
+
return writer;
|
|
331
|
+
},
|
|
332
|
+
decode(input, length) {
|
|
333
|
+
const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
|
|
334
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
335
|
+
const message = createBaseBluetoothGattCharacteristic();
|
|
336
|
+
while (reader.pos < end) {
|
|
337
|
+
const tag = reader.uint32();
|
|
338
|
+
switch (tag >>> 3) {
|
|
339
|
+
case 1:
|
|
340
|
+
if (tag !== 10) {
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
message.uuid = reader.string();
|
|
344
|
+
continue;
|
|
345
|
+
case 2:
|
|
346
|
+
if (tag !== 16) {
|
|
347
|
+
break;
|
|
348
|
+
}
|
|
349
|
+
message.properties = reader.int32();
|
|
350
|
+
continue;
|
|
351
|
+
}
|
|
352
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
355
|
+
reader.skipType(tag & 7);
|
|
356
|
+
}
|
|
357
|
+
return message;
|
|
358
|
+
},
|
|
359
|
+
fromJSON(object) {
|
|
360
|
+
return {
|
|
361
|
+
uuid: isSet(object.uuid) ? String(object.uuid) : "",
|
|
362
|
+
properties: isSet(object.properties) ? Number(object.properties) : 0,
|
|
363
|
+
};
|
|
364
|
+
},
|
|
365
|
+
toJSON(message) {
|
|
366
|
+
const obj = {};
|
|
367
|
+
if (message.uuid !== "") {
|
|
368
|
+
obj.uuid = message.uuid;
|
|
369
|
+
}
|
|
370
|
+
if (message.properties !== 0) {
|
|
371
|
+
obj.properties = Math.round(message.properties);
|
|
372
|
+
}
|
|
373
|
+
return obj;
|
|
374
|
+
},
|
|
375
|
+
create(base) {
|
|
376
|
+
return exports.BluetoothGattCharacteristic.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
377
|
+
},
|
|
378
|
+
fromPartial(object) {
|
|
379
|
+
var _a, _b;
|
|
380
|
+
const message = createBaseBluetoothGattCharacteristic();
|
|
381
|
+
message.uuid = (_a = object.uuid) !== null && _a !== void 0 ? _a : "";
|
|
382
|
+
message.properties = (_b = object.properties) !== null && _b !== void 0 ? _b : 0;
|
|
383
|
+
return message;
|
|
384
|
+
},
|
|
385
|
+
};
|
|
386
|
+
function createBaseWriteRequest() {
|
|
387
|
+
return { deviceAddress: "", gattCharacteristicUuid: "", message: new Uint8Array(0) };
|
|
388
|
+
}
|
|
389
|
+
exports.WriteRequest = {
|
|
390
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
391
|
+
if (message.deviceAddress !== "") {
|
|
392
|
+
writer.uint32(10).string(message.deviceAddress);
|
|
393
|
+
}
|
|
394
|
+
if (message.gattCharacteristicUuid !== "") {
|
|
395
|
+
writer.uint32(18).string(message.gattCharacteristicUuid);
|
|
396
|
+
}
|
|
397
|
+
if (message.message.length !== 0) {
|
|
398
|
+
writer.uint32(26).bytes(message.message);
|
|
399
|
+
}
|
|
400
|
+
return writer;
|
|
401
|
+
},
|
|
402
|
+
decode(input, length) {
|
|
403
|
+
const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
|
|
404
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
405
|
+
const message = createBaseWriteRequest();
|
|
406
|
+
while (reader.pos < end) {
|
|
407
|
+
const tag = reader.uint32();
|
|
408
|
+
switch (tag >>> 3) {
|
|
409
|
+
case 1:
|
|
410
|
+
if (tag !== 10) {
|
|
411
|
+
break;
|
|
412
|
+
}
|
|
413
|
+
message.deviceAddress = reader.string();
|
|
414
|
+
continue;
|
|
415
|
+
case 2:
|
|
416
|
+
if (tag !== 18) {
|
|
417
|
+
break;
|
|
418
|
+
}
|
|
419
|
+
message.gattCharacteristicUuid = reader.string();
|
|
420
|
+
continue;
|
|
421
|
+
case 3:
|
|
422
|
+
if (tag !== 26) {
|
|
423
|
+
break;
|
|
424
|
+
}
|
|
425
|
+
message.message = reader.bytes();
|
|
426
|
+
continue;
|
|
427
|
+
}
|
|
428
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
429
|
+
break;
|
|
430
|
+
}
|
|
431
|
+
reader.skipType(tag & 7);
|
|
432
|
+
}
|
|
433
|
+
return message;
|
|
434
|
+
},
|
|
435
|
+
fromJSON(object) {
|
|
436
|
+
return {
|
|
437
|
+
deviceAddress: isSet(object.deviceAddress) ? String(object.deviceAddress) : "",
|
|
438
|
+
gattCharacteristicUuid: isSet(object.gattCharacteristicUuid) ? String(object.gattCharacteristicUuid) : "",
|
|
439
|
+
message: isSet(object.message) ? bytesFromBase64(object.message) : new Uint8Array(0),
|
|
440
|
+
};
|
|
441
|
+
},
|
|
442
|
+
toJSON(message) {
|
|
443
|
+
const obj = {};
|
|
444
|
+
if (message.deviceAddress !== "") {
|
|
445
|
+
obj.deviceAddress = message.deviceAddress;
|
|
446
|
+
}
|
|
447
|
+
if (message.gattCharacteristicUuid !== "") {
|
|
448
|
+
obj.gattCharacteristicUuid = message.gattCharacteristicUuid;
|
|
449
|
+
}
|
|
450
|
+
if (message.message.length !== 0) {
|
|
451
|
+
obj.message = base64FromBytes(message.message);
|
|
452
|
+
}
|
|
453
|
+
return obj;
|
|
454
|
+
},
|
|
455
|
+
create(base) {
|
|
456
|
+
return exports.WriteRequest.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
457
|
+
},
|
|
458
|
+
fromPartial(object) {
|
|
459
|
+
var _a, _b, _c;
|
|
460
|
+
const message = createBaseWriteRequest();
|
|
461
|
+
message.deviceAddress = (_a = object.deviceAddress) !== null && _a !== void 0 ? _a : "";
|
|
462
|
+
message.gattCharacteristicUuid = (_b = object.gattCharacteristicUuid) !== null && _b !== void 0 ? _b : "";
|
|
463
|
+
message.message = (_c = object.message) !== null && _c !== void 0 ? _c : new Uint8Array(0);
|
|
464
|
+
return message;
|
|
465
|
+
},
|
|
466
|
+
};
|
|
467
|
+
function createBaseWriteReply() {
|
|
468
|
+
return { success: false };
|
|
469
|
+
}
|
|
470
|
+
exports.WriteReply = {
|
|
471
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
472
|
+
if (message.success === true) {
|
|
473
|
+
writer.uint32(8).bool(message.success);
|
|
474
|
+
}
|
|
475
|
+
return writer;
|
|
476
|
+
},
|
|
477
|
+
decode(input, length) {
|
|
478
|
+
const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
|
|
479
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
480
|
+
const message = createBaseWriteReply();
|
|
481
|
+
while (reader.pos < end) {
|
|
482
|
+
const tag = reader.uint32();
|
|
483
|
+
switch (tag >>> 3) {
|
|
484
|
+
case 1:
|
|
485
|
+
if (tag !== 8) {
|
|
486
|
+
break;
|
|
487
|
+
}
|
|
488
|
+
message.success = reader.bool();
|
|
489
|
+
continue;
|
|
490
|
+
}
|
|
491
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
492
|
+
break;
|
|
493
|
+
}
|
|
494
|
+
reader.skipType(tag & 7);
|
|
495
|
+
}
|
|
496
|
+
return message;
|
|
497
|
+
},
|
|
498
|
+
fromJSON(object) {
|
|
499
|
+
return { success: isSet(object.success) ? Boolean(object.success) : false };
|
|
500
|
+
},
|
|
501
|
+
toJSON(message) {
|
|
502
|
+
const obj = {};
|
|
503
|
+
if (message.success === true) {
|
|
504
|
+
obj.success = message.success;
|
|
505
|
+
}
|
|
506
|
+
return obj;
|
|
507
|
+
},
|
|
508
|
+
create(base) {
|
|
509
|
+
return exports.WriteReply.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
510
|
+
},
|
|
511
|
+
fromPartial(object) {
|
|
512
|
+
var _a;
|
|
513
|
+
const message = createBaseWriteReply();
|
|
514
|
+
message.success = (_a = object.success) !== null && _a !== void 0 ? _a : false;
|
|
515
|
+
return message;
|
|
516
|
+
},
|
|
517
|
+
};
|
|
518
|
+
function createBaseReadRequest() {
|
|
519
|
+
return { deviceAddress: "", gattCharacteristicUuid: "" };
|
|
520
|
+
}
|
|
521
|
+
exports.ReadRequest = {
|
|
522
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
523
|
+
if (message.deviceAddress !== "") {
|
|
524
|
+
writer.uint32(10).string(message.deviceAddress);
|
|
525
|
+
}
|
|
526
|
+
if (message.gattCharacteristicUuid !== "") {
|
|
527
|
+
writer.uint32(18).string(message.gattCharacteristicUuid);
|
|
528
|
+
}
|
|
529
|
+
return writer;
|
|
530
|
+
},
|
|
531
|
+
decode(input, length) {
|
|
532
|
+
const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
|
|
533
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
534
|
+
const message = createBaseReadRequest();
|
|
535
|
+
while (reader.pos < end) {
|
|
536
|
+
const tag = reader.uint32();
|
|
537
|
+
switch (tag >>> 3) {
|
|
538
|
+
case 1:
|
|
539
|
+
if (tag !== 10) {
|
|
540
|
+
break;
|
|
541
|
+
}
|
|
542
|
+
message.deviceAddress = reader.string();
|
|
543
|
+
continue;
|
|
544
|
+
case 2:
|
|
545
|
+
if (tag !== 18) {
|
|
546
|
+
break;
|
|
547
|
+
}
|
|
548
|
+
message.gattCharacteristicUuid = reader.string();
|
|
549
|
+
continue;
|
|
550
|
+
}
|
|
551
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
552
|
+
break;
|
|
553
|
+
}
|
|
554
|
+
reader.skipType(tag & 7);
|
|
555
|
+
}
|
|
556
|
+
return message;
|
|
557
|
+
},
|
|
558
|
+
fromJSON(object) {
|
|
559
|
+
return {
|
|
560
|
+
deviceAddress: isSet(object.deviceAddress) ? String(object.deviceAddress) : "",
|
|
561
|
+
gattCharacteristicUuid: isSet(object.gattCharacteristicUuid) ? String(object.gattCharacteristicUuid) : "",
|
|
562
|
+
};
|
|
563
|
+
},
|
|
564
|
+
toJSON(message) {
|
|
565
|
+
const obj = {};
|
|
566
|
+
if (message.deviceAddress !== "") {
|
|
567
|
+
obj.deviceAddress = message.deviceAddress;
|
|
568
|
+
}
|
|
569
|
+
if (message.gattCharacteristicUuid !== "") {
|
|
570
|
+
obj.gattCharacteristicUuid = message.gattCharacteristicUuid;
|
|
571
|
+
}
|
|
572
|
+
return obj;
|
|
573
|
+
},
|
|
574
|
+
create(base) {
|
|
575
|
+
return exports.ReadRequest.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
576
|
+
},
|
|
577
|
+
fromPartial(object) {
|
|
578
|
+
var _a, _b;
|
|
579
|
+
const message = createBaseReadRequest();
|
|
580
|
+
message.deviceAddress = (_a = object.deviceAddress) !== null && _a !== void 0 ? _a : "";
|
|
581
|
+
message.gattCharacteristicUuid = (_b = object.gattCharacteristicUuid) !== null && _b !== void 0 ? _b : "";
|
|
582
|
+
return message;
|
|
583
|
+
},
|
|
584
|
+
};
|
|
585
|
+
function createBaseReadReply() {
|
|
586
|
+
return { message: new Uint8Array(0) };
|
|
587
|
+
}
|
|
588
|
+
exports.ReadReply = {
|
|
589
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
590
|
+
if (message.message.length !== 0) {
|
|
591
|
+
writer.uint32(10).bytes(message.message);
|
|
592
|
+
}
|
|
593
|
+
return writer;
|
|
594
|
+
},
|
|
595
|
+
decode(input, length) {
|
|
596
|
+
const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
|
|
597
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
598
|
+
const message = createBaseReadReply();
|
|
599
|
+
while (reader.pos < end) {
|
|
600
|
+
const tag = reader.uint32();
|
|
601
|
+
switch (tag >>> 3) {
|
|
602
|
+
case 1:
|
|
603
|
+
if (tag !== 10) {
|
|
604
|
+
break;
|
|
605
|
+
}
|
|
606
|
+
message.message = reader.bytes();
|
|
607
|
+
continue;
|
|
608
|
+
}
|
|
609
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
610
|
+
break;
|
|
611
|
+
}
|
|
612
|
+
reader.skipType(tag & 7);
|
|
613
|
+
}
|
|
614
|
+
return message;
|
|
615
|
+
},
|
|
616
|
+
fromJSON(object) {
|
|
617
|
+
return { message: isSet(object.message) ? bytesFromBase64(object.message) : new Uint8Array(0) };
|
|
618
|
+
},
|
|
619
|
+
toJSON(message) {
|
|
620
|
+
const obj = {};
|
|
621
|
+
if (message.message.length !== 0) {
|
|
622
|
+
obj.message = base64FromBytes(message.message);
|
|
623
|
+
}
|
|
624
|
+
return obj;
|
|
625
|
+
},
|
|
626
|
+
create(base) {
|
|
627
|
+
return exports.ReadReply.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
628
|
+
},
|
|
629
|
+
fromPartial(object) {
|
|
630
|
+
var _a;
|
|
631
|
+
const message = createBaseReadReply();
|
|
632
|
+
message.message = (_a = object.message) !== null && _a !== void 0 ? _a : new Uint8Array(0);
|
|
633
|
+
return message;
|
|
634
|
+
},
|
|
635
|
+
};
|
|
636
|
+
class BleManagerClientImpl {
|
|
637
|
+
constructor(rpc) {
|
|
638
|
+
this.rpc = rpc;
|
|
639
|
+
this.ScanBle = this.ScanBle.bind(this);
|
|
640
|
+
this.ConnectBle = this.ConnectBle.bind(this);
|
|
641
|
+
this.Write = this.Write.bind(this);
|
|
642
|
+
this.Read = this.Read.bind(this);
|
|
643
|
+
}
|
|
644
|
+
ScanBle(request, metadata, abortSignal) {
|
|
645
|
+
return this.rpc.invoke(exports.BleManagerScanBleDesc, exports.ScanBleRequest.fromPartial(request), metadata, abortSignal);
|
|
646
|
+
}
|
|
647
|
+
ConnectBle(request, metadata, abortSignal) {
|
|
648
|
+
return this.rpc.unary(exports.BleManagerConnectBleDesc, exports.ConnectBleRequest.fromPartial(request), metadata, abortSignal);
|
|
649
|
+
}
|
|
650
|
+
Write(request, metadata, abortSignal) {
|
|
651
|
+
return this.rpc.unary(exports.BleManagerWriteDesc, exports.WriteRequest.fromPartial(request), metadata, abortSignal);
|
|
652
|
+
}
|
|
653
|
+
Read(request, metadata, abortSignal) {
|
|
654
|
+
return this.rpc.unary(exports.BleManagerReadDesc, exports.ReadRequest.fromPartial(request), metadata, abortSignal);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
exports.BleManagerClientImpl = BleManagerClientImpl;
|
|
658
|
+
exports.BleManagerDesc = { serviceName: "cloud.lazycat.apis.localdevice.BleManager" };
|
|
659
|
+
exports.BleManagerScanBleDesc = {
|
|
660
|
+
methodName: "ScanBle",
|
|
661
|
+
service: exports.BleManagerDesc,
|
|
662
|
+
requestStream: false,
|
|
663
|
+
responseStream: true,
|
|
664
|
+
requestType: {
|
|
665
|
+
serializeBinary() {
|
|
666
|
+
return exports.ScanBleRequest.encode(this).finish();
|
|
667
|
+
},
|
|
668
|
+
},
|
|
669
|
+
responseType: {
|
|
670
|
+
deserializeBinary(data) {
|
|
671
|
+
const value = exports.BluetoothDevice.decode(data);
|
|
672
|
+
return Object.assign(Object.assign({}, value), { toObject() {
|
|
673
|
+
return value;
|
|
674
|
+
} });
|
|
675
|
+
},
|
|
676
|
+
},
|
|
677
|
+
};
|
|
678
|
+
exports.BleManagerConnectBleDesc = {
|
|
679
|
+
methodName: "ConnectBle",
|
|
680
|
+
service: exports.BleManagerDesc,
|
|
681
|
+
requestStream: false,
|
|
682
|
+
responseStream: false,
|
|
683
|
+
requestType: {
|
|
684
|
+
serializeBinary() {
|
|
685
|
+
return exports.ConnectBleRequest.encode(this).finish();
|
|
686
|
+
},
|
|
687
|
+
},
|
|
688
|
+
responseType: {
|
|
689
|
+
deserializeBinary(data) {
|
|
690
|
+
const value = exports.ConnectBleReply.decode(data);
|
|
691
|
+
return Object.assign(Object.assign({}, value), { toObject() {
|
|
692
|
+
return value;
|
|
693
|
+
} });
|
|
694
|
+
},
|
|
695
|
+
},
|
|
696
|
+
};
|
|
697
|
+
exports.BleManagerWriteDesc = {
|
|
698
|
+
methodName: "Write",
|
|
699
|
+
service: exports.BleManagerDesc,
|
|
700
|
+
requestStream: false,
|
|
701
|
+
responseStream: false,
|
|
702
|
+
requestType: {
|
|
703
|
+
serializeBinary() {
|
|
704
|
+
return exports.WriteRequest.encode(this).finish();
|
|
705
|
+
},
|
|
706
|
+
},
|
|
707
|
+
responseType: {
|
|
708
|
+
deserializeBinary(data) {
|
|
709
|
+
const value = exports.WriteReply.decode(data);
|
|
710
|
+
return Object.assign(Object.assign({}, value), { toObject() {
|
|
711
|
+
return value;
|
|
712
|
+
} });
|
|
713
|
+
},
|
|
714
|
+
},
|
|
715
|
+
};
|
|
716
|
+
exports.BleManagerReadDesc = {
|
|
717
|
+
methodName: "Read",
|
|
718
|
+
service: exports.BleManagerDesc,
|
|
719
|
+
requestStream: false,
|
|
720
|
+
responseStream: false,
|
|
721
|
+
requestType: {
|
|
722
|
+
serializeBinary() {
|
|
723
|
+
return exports.ReadRequest.encode(this).finish();
|
|
724
|
+
},
|
|
725
|
+
},
|
|
726
|
+
responseType: {
|
|
727
|
+
deserializeBinary(data) {
|
|
728
|
+
const value = exports.ReadReply.decode(data);
|
|
729
|
+
return Object.assign(Object.assign({}, value), { toObject() {
|
|
730
|
+
return value;
|
|
731
|
+
} });
|
|
732
|
+
},
|
|
733
|
+
},
|
|
734
|
+
};
|
|
735
|
+
class GrpcWebImpl {
|
|
736
|
+
constructor(host, options) {
|
|
737
|
+
this.host = host;
|
|
738
|
+
this.options = options;
|
|
739
|
+
}
|
|
740
|
+
unary(methodDesc, _request, metadata, abortSignal) {
|
|
741
|
+
var _a;
|
|
742
|
+
const request = Object.assign(Object.assign({}, _request), methodDesc.requestType);
|
|
743
|
+
const maybeCombinedMetadata = metadata && this.options.metadata
|
|
744
|
+
? new browser_headers_1.BrowserHeaders(Object.assign(Object.assign({}, (_a = this.options) === null || _a === void 0 ? void 0 : _a.metadata.headersMap), metadata === null || metadata === void 0 ? void 0 : metadata.headersMap))
|
|
745
|
+
: metadata !== null && metadata !== void 0 ? metadata : this.options.metadata;
|
|
746
|
+
return new Promise((resolve, reject) => {
|
|
747
|
+
var _a;
|
|
748
|
+
const client = grpc_web_1.grpc.unary(methodDesc, Object.assign(Object.assign({ request, host: this.host, metadata: maybeCombinedMetadata !== null && maybeCombinedMetadata !== void 0 ? maybeCombinedMetadata : {} }, (this.options.transport !== undefined ? { transport: this.options.transport } : {})), { debug: (_a = this.options.debug) !== null && _a !== void 0 ? _a : false, onEnd: function (response) {
|
|
749
|
+
if (response.status === grpc_web_1.grpc.Code.OK) {
|
|
750
|
+
resolve(response.message.toObject());
|
|
751
|
+
}
|
|
752
|
+
else {
|
|
753
|
+
const err = new GrpcWebError(response.statusMessage, response.status, response.trailers);
|
|
754
|
+
reject(err);
|
|
755
|
+
}
|
|
756
|
+
} }));
|
|
757
|
+
if (abortSignal) {
|
|
758
|
+
abortSignal.addEventListener("abort", () => {
|
|
759
|
+
client.close();
|
|
760
|
+
reject(abortSignal.reason);
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
invoke(methodDesc, _request, metadata, abortSignal) {
|
|
766
|
+
var _a, _b, _c;
|
|
767
|
+
const upStreamCodes = (_a = this.options.upStreamRetryCodes) !== null && _a !== void 0 ? _a : [];
|
|
768
|
+
const DEFAULT_TIMEOUT_TIME = 3000;
|
|
769
|
+
const request = Object.assign(Object.assign({}, _request), methodDesc.requestType);
|
|
770
|
+
const transport = (_b = this.options.streamingTransport) !== null && _b !== void 0 ? _b : this.options.transport;
|
|
771
|
+
const maybeCombinedMetadata = metadata && this.options.metadata
|
|
772
|
+
? new browser_headers_1.BrowserHeaders(Object.assign(Object.assign({}, (_c = this.options) === null || _c === void 0 ? void 0 : _c.metadata.headersMap), metadata === null || metadata === void 0 ? void 0 : metadata.headersMap))
|
|
773
|
+
: metadata !== null && metadata !== void 0 ? metadata : this.options.metadata;
|
|
774
|
+
return new rxjs_1.Observable((observer) => {
|
|
775
|
+
const upStream = () => {
|
|
776
|
+
var _a;
|
|
777
|
+
const client = grpc_web_1.grpc.invoke(methodDesc, Object.assign(Object.assign({ host: this.host, request }, (transport !== undefined ? { transport } : {})), { metadata: maybeCombinedMetadata !== null && maybeCombinedMetadata !== void 0 ? maybeCombinedMetadata : {}, debug: (_a = this.options.debug) !== null && _a !== void 0 ? _a : false, onMessage: (next) => observer.next(next), onEnd: (code, message, trailers) => {
|
|
778
|
+
if (code === 0) {
|
|
779
|
+
observer.complete();
|
|
780
|
+
}
|
|
781
|
+
else if (upStreamCodes.includes(code)) {
|
|
782
|
+
setTimeout(upStream, DEFAULT_TIMEOUT_TIME);
|
|
783
|
+
}
|
|
784
|
+
else {
|
|
785
|
+
const err = new Error(message);
|
|
786
|
+
err.code = code;
|
|
787
|
+
err.metadata = trailers;
|
|
788
|
+
observer.error(err);
|
|
789
|
+
}
|
|
790
|
+
} }));
|
|
791
|
+
observer.add(() => {
|
|
792
|
+
if (!abortSignal || !abortSignal.aborted) {
|
|
793
|
+
return client.close();
|
|
794
|
+
}
|
|
795
|
+
});
|
|
796
|
+
if (abortSignal) {
|
|
797
|
+
abortSignal.addEventListener("abort", () => {
|
|
798
|
+
observer.error(abortSignal.reason);
|
|
799
|
+
client.close();
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
};
|
|
803
|
+
upStream();
|
|
804
|
+
}).pipe((0, operators_1.share)());
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
exports.GrpcWebImpl = GrpcWebImpl;
|
|
808
|
+
const tsProtoGlobalThis = (() => {
|
|
809
|
+
if (typeof globalThis !== "undefined") {
|
|
810
|
+
return globalThis;
|
|
811
|
+
}
|
|
812
|
+
if (typeof self !== "undefined") {
|
|
813
|
+
return self;
|
|
814
|
+
}
|
|
815
|
+
if (typeof window !== "undefined") {
|
|
816
|
+
return window;
|
|
817
|
+
}
|
|
818
|
+
if (typeof global !== "undefined") {
|
|
819
|
+
return global;
|
|
820
|
+
}
|
|
821
|
+
throw "Unable to locate global object";
|
|
822
|
+
})();
|
|
823
|
+
function bytesFromBase64(b64) {
|
|
824
|
+
if (tsProtoGlobalThis.Buffer) {
|
|
825
|
+
return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64"));
|
|
826
|
+
}
|
|
827
|
+
else {
|
|
828
|
+
const bin = tsProtoGlobalThis.atob(b64);
|
|
829
|
+
const arr = new Uint8Array(bin.length);
|
|
830
|
+
for (let i = 0; i < bin.length; ++i) {
|
|
831
|
+
arr[i] = bin.charCodeAt(i);
|
|
832
|
+
}
|
|
833
|
+
return arr;
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
function base64FromBytes(arr) {
|
|
837
|
+
if (tsProtoGlobalThis.Buffer) {
|
|
838
|
+
return tsProtoGlobalThis.Buffer.from(arr).toString("base64");
|
|
839
|
+
}
|
|
840
|
+
else {
|
|
841
|
+
const bin = [];
|
|
842
|
+
arr.forEach((byte) => {
|
|
843
|
+
bin.push(String.fromCharCode(byte));
|
|
844
|
+
});
|
|
845
|
+
return tsProtoGlobalThis.btoa(bin.join(""));
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
function isSet(value) {
|
|
849
|
+
return value !== null && value !== undefined;
|
|
850
|
+
}
|
|
851
|
+
class GrpcWebError extends tsProtoGlobalThis.Error {
|
|
852
|
+
constructor(message, code, metadata) {
|
|
853
|
+
super(message);
|
|
854
|
+
this.code = code;
|
|
855
|
+
this.metadata = metadata;
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
exports.GrpcWebError = GrpcWebError;
|
|
859
|
+
//# sourceMappingURL=ble.js.map
|