@fatehan/tsrp 1.0.10 → 1.0.12
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/fatehan/notifies/notify.d.ts +1 -0
- package/dist/fatehan/notifies/notify.d.ts.map +1 -1
- package/dist/fatehan/notifies/notify.js +6 -0
- package/dist/fatehan/packets/dataModel.d.ts +2 -18
- package/dist/fatehan/packets/dataModel.d.ts.map +1 -1
- package/dist/fatehan/packets/dataModel.js +46 -130
- package/dist/fatehan/packets/messages.d.ts +18 -19
- package/dist/fatehan/packets/messages.d.ts.map +1 -1
- package/dist/fatehan/packets/messages.js +130 -161
- package/dist/fatehan/reports/report.d.ts +92 -81
- package/dist/fatehan/reports/report.d.ts.map +1 -1
- package/dist/fatehan/reports/report.js +873 -721
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -0
- package/dist/index.test.js +15 -3
- package/package.json +3 -3
|
@@ -1,36 +1,35 @@
|
|
|
1
1
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
2
|
export declare const protobufPackage = "com.fatehan.packets";
|
|
3
|
-
export declare enum MessageType {
|
|
4
|
-
None = 0,
|
|
5
|
-
DeviceCommandMessage = 1,
|
|
6
|
-
DeviceCommandAknMessage = 2,
|
|
7
|
-
DeviceAnswerMessage = 3,
|
|
8
|
-
UNRECOGNIZED = -1
|
|
9
|
-
}
|
|
10
|
-
export declare function messageTypeFromJSON(object: any): MessageType;
|
|
11
|
-
export declare function messageTypeToJSON(object: MessageType): string;
|
|
12
3
|
export interface DeviceCommand {
|
|
13
|
-
deviceId: number;
|
|
14
4
|
command: string;
|
|
15
|
-
commandId: number;
|
|
16
5
|
}
|
|
17
6
|
export interface DeviceCommandAkn {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
message
|
|
7
|
+
status: DeviceCommandAkn_Status;
|
|
8
|
+
code?: number | undefined;
|
|
9
|
+
message?: string | undefined;
|
|
21
10
|
}
|
|
11
|
+
export declare enum DeviceCommandAkn_Status {
|
|
12
|
+
OFFLINE = 0,
|
|
13
|
+
SENT = 1,
|
|
14
|
+
ERROR = 2,
|
|
15
|
+
UNRECOGNIZED = -1
|
|
16
|
+
}
|
|
17
|
+
export declare function deviceCommandAkn_StatusFromJSON(object: any): DeviceCommandAkn_Status;
|
|
18
|
+
export declare function deviceCommandAkn_StatusToJSON(object: DeviceCommandAkn_Status): string;
|
|
22
19
|
export interface DeviceAnswer {
|
|
23
|
-
deviceId: number;
|
|
24
20
|
answer: string;
|
|
25
21
|
}
|
|
26
|
-
export interface
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
export interface DeviceMessage {
|
|
23
|
+
deviceId: number;
|
|
24
|
+
transactionId: number;
|
|
25
|
+
command?: DeviceCommand | undefined;
|
|
26
|
+
akn?: DeviceCommandAkn | undefined;
|
|
27
|
+
answer?: DeviceAnswer | undefined;
|
|
29
28
|
}
|
|
30
29
|
export declare const DeviceCommand: MessageFns<DeviceCommand>;
|
|
31
30
|
export declare const DeviceCommandAkn: MessageFns<DeviceCommandAkn>;
|
|
32
31
|
export declare const DeviceAnswer: MessageFns<DeviceAnswer>;
|
|
33
|
-
export declare const
|
|
32
|
+
export declare const DeviceMessage: MessageFns<DeviceMessage>;
|
|
34
33
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
35
34
|
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
36
35
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/fatehan/packets/messages.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAErE,eAAO,MAAM,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AE,GAAG,GAAG,CAAC,CAAC;IACzB,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;IAC5B,MAAM,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACxD,WAAW,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC;CAC/D"}
|
|
@@ -5,68 +5,56 @@
|
|
|
5
5
|
// protoc v3.21.12
|
|
6
6
|
// source: packets/messages.proto
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
8
|
+
exports.DeviceMessage = exports.DeviceAnswer = exports.DeviceCommandAkn = exports.DeviceCommand = exports.DeviceCommandAkn_Status = exports.protobufPackage = void 0;
|
|
9
|
+
exports.deviceCommandAkn_StatusFromJSON = deviceCommandAkn_StatusFromJSON;
|
|
10
|
+
exports.deviceCommandAkn_StatusToJSON = deviceCommandAkn_StatusToJSON;
|
|
11
11
|
/* eslint-disable */
|
|
12
12
|
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
13
13
|
exports.protobufPackage = "com.fatehan.packets";
|
|
14
|
-
var
|
|
15
|
-
(function (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function messageTypeFromJSON(object) {
|
|
14
|
+
var DeviceCommandAkn_Status;
|
|
15
|
+
(function (DeviceCommandAkn_Status) {
|
|
16
|
+
DeviceCommandAkn_Status[DeviceCommandAkn_Status["OFFLINE"] = 0] = "OFFLINE";
|
|
17
|
+
DeviceCommandAkn_Status[DeviceCommandAkn_Status["SENT"] = 1] = "SENT";
|
|
18
|
+
DeviceCommandAkn_Status[DeviceCommandAkn_Status["ERROR"] = 2] = "ERROR";
|
|
19
|
+
DeviceCommandAkn_Status[DeviceCommandAkn_Status["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
20
|
+
})(DeviceCommandAkn_Status || (exports.DeviceCommandAkn_Status = DeviceCommandAkn_Status = {}));
|
|
21
|
+
function deviceCommandAkn_StatusFromJSON(object) {
|
|
23
22
|
switch (object) {
|
|
24
23
|
case 0:
|
|
25
|
-
case "
|
|
26
|
-
return
|
|
24
|
+
case "OFFLINE":
|
|
25
|
+
return DeviceCommandAkn_Status.OFFLINE;
|
|
27
26
|
case 1:
|
|
28
|
-
case "
|
|
29
|
-
return
|
|
27
|
+
case "SENT":
|
|
28
|
+
return DeviceCommandAkn_Status.SENT;
|
|
30
29
|
case 2:
|
|
31
|
-
case "
|
|
32
|
-
return
|
|
33
|
-
case 3:
|
|
34
|
-
case "DeviceAnswerMessage":
|
|
35
|
-
return MessageType.DeviceAnswerMessage;
|
|
30
|
+
case "ERROR":
|
|
31
|
+
return DeviceCommandAkn_Status.ERROR;
|
|
36
32
|
case -1:
|
|
37
33
|
case "UNRECOGNIZED":
|
|
38
34
|
default:
|
|
39
|
-
return
|
|
35
|
+
return DeviceCommandAkn_Status.UNRECOGNIZED;
|
|
40
36
|
}
|
|
41
37
|
}
|
|
42
|
-
function
|
|
38
|
+
function deviceCommandAkn_StatusToJSON(object) {
|
|
43
39
|
switch (object) {
|
|
44
|
-
case
|
|
45
|
-
return "
|
|
46
|
-
case
|
|
47
|
-
return "
|
|
48
|
-
case
|
|
49
|
-
return "
|
|
50
|
-
case
|
|
51
|
-
return "DeviceAnswerMessage";
|
|
52
|
-
case MessageType.UNRECOGNIZED:
|
|
40
|
+
case DeviceCommandAkn_Status.OFFLINE:
|
|
41
|
+
return "OFFLINE";
|
|
42
|
+
case DeviceCommandAkn_Status.SENT:
|
|
43
|
+
return "SENT";
|
|
44
|
+
case DeviceCommandAkn_Status.ERROR:
|
|
45
|
+
return "ERROR";
|
|
46
|
+
case DeviceCommandAkn_Status.UNRECOGNIZED:
|
|
53
47
|
default:
|
|
54
48
|
return "UNRECOGNIZED";
|
|
55
49
|
}
|
|
56
50
|
}
|
|
57
51
|
function createBaseDeviceCommand() {
|
|
58
|
-
return {
|
|
52
|
+
return { command: "" };
|
|
59
53
|
}
|
|
60
54
|
exports.DeviceCommand = {
|
|
61
55
|
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
62
|
-
if (message.deviceId !== 0) {
|
|
63
|
-
writer.uint32(8).uint64(message.deviceId);
|
|
64
|
-
}
|
|
65
56
|
if (message.command !== "") {
|
|
66
|
-
writer.uint32(
|
|
67
|
-
}
|
|
68
|
-
if (message.commandId !== 0) {
|
|
69
|
-
writer.uint32(24).uint64(message.commandId);
|
|
57
|
+
writer.uint32(10).string(message.command);
|
|
70
58
|
}
|
|
71
59
|
return writer;
|
|
72
60
|
},
|
|
@@ -78,26 +66,12 @@ exports.DeviceCommand = {
|
|
|
78
66
|
const tag = reader.uint32();
|
|
79
67
|
switch (tag >>> 3) {
|
|
80
68
|
case 1: {
|
|
81
|
-
if (tag !==
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
message.deviceId = longToNumber(reader.uint64());
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
case 2: {
|
|
88
|
-
if (tag !== 18) {
|
|
69
|
+
if (tag !== 10) {
|
|
89
70
|
break;
|
|
90
71
|
}
|
|
91
72
|
message.command = reader.string();
|
|
92
73
|
continue;
|
|
93
74
|
}
|
|
94
|
-
case 3: {
|
|
95
|
-
if (tag !== 24) {
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
message.commandId = longToNumber(reader.uint64());
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
75
|
}
|
|
102
76
|
if ((tag & 7) === 4 || tag === 0) {
|
|
103
77
|
break;
|
|
@@ -107,49 +81,37 @@ exports.DeviceCommand = {
|
|
|
107
81
|
return message;
|
|
108
82
|
},
|
|
109
83
|
fromJSON(object) {
|
|
110
|
-
return {
|
|
111
|
-
deviceId: isSet(object.device_id) ? globalThis.Number(object.device_id) : 0,
|
|
112
|
-
command: isSet(object.command) ? globalThis.String(object.command) : "",
|
|
113
|
-
commandId: isSet(object.command_id) ? globalThis.Number(object.command_id) : 0,
|
|
114
|
-
};
|
|
84
|
+
return { command: isSet(object.command) ? globalThis.String(object.command) : "" };
|
|
115
85
|
},
|
|
116
86
|
toJSON(message) {
|
|
117
87
|
const obj = {};
|
|
118
|
-
if (message.deviceId !== 0) {
|
|
119
|
-
obj.device_id = Math.round(message.deviceId);
|
|
120
|
-
}
|
|
121
88
|
if (message.command !== "") {
|
|
122
89
|
obj.command = message.command;
|
|
123
90
|
}
|
|
124
|
-
if (message.commandId !== 0) {
|
|
125
|
-
obj.command_id = Math.round(message.commandId);
|
|
126
|
-
}
|
|
127
91
|
return obj;
|
|
128
92
|
},
|
|
129
93
|
create(base) {
|
|
130
94
|
return exports.DeviceCommand.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
131
95
|
},
|
|
132
96
|
fromPartial(object) {
|
|
133
|
-
var _a
|
|
97
|
+
var _a;
|
|
134
98
|
const message = createBaseDeviceCommand();
|
|
135
|
-
message.
|
|
136
|
-
message.command = (_b = object.command) !== null && _b !== void 0 ? _b : "";
|
|
137
|
-
message.commandId = (_c = object.commandId) !== null && _c !== void 0 ? _c : 0;
|
|
99
|
+
message.command = (_a = object.command) !== null && _a !== void 0 ? _a : "";
|
|
138
100
|
return message;
|
|
139
101
|
},
|
|
140
102
|
};
|
|
141
103
|
function createBaseDeviceCommandAkn() {
|
|
142
|
-
return {
|
|
104
|
+
return { status: 0, code: undefined, message: undefined };
|
|
143
105
|
}
|
|
144
106
|
exports.DeviceCommandAkn = {
|
|
145
107
|
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
146
|
-
if (message.command !== undefined) {
|
|
147
|
-
exports.DeviceCommand.encode(message.command, writer.uint32(10).fork()).join();
|
|
148
|
-
}
|
|
149
108
|
if (message.status !== 0) {
|
|
150
|
-
writer.uint32(
|
|
109
|
+
writer.uint32(8).int32(message.status);
|
|
110
|
+
}
|
|
111
|
+
if (message.code !== undefined) {
|
|
112
|
+
writer.uint32(16).sint64(message.code);
|
|
151
113
|
}
|
|
152
|
-
if (message.message !==
|
|
114
|
+
if (message.message !== undefined) {
|
|
153
115
|
writer.uint32(26).string(message.message);
|
|
154
116
|
}
|
|
155
117
|
return writer;
|
|
@@ -162,17 +124,17 @@ exports.DeviceCommandAkn = {
|
|
|
162
124
|
const tag = reader.uint32();
|
|
163
125
|
switch (tag >>> 3) {
|
|
164
126
|
case 1: {
|
|
165
|
-
if (tag !==
|
|
127
|
+
if (tag !== 8) {
|
|
166
128
|
break;
|
|
167
129
|
}
|
|
168
|
-
message.
|
|
130
|
+
message.status = reader.int32();
|
|
169
131
|
continue;
|
|
170
132
|
}
|
|
171
133
|
case 2: {
|
|
172
134
|
if (tag !== 16) {
|
|
173
135
|
break;
|
|
174
136
|
}
|
|
175
|
-
message.
|
|
137
|
+
message.code = longToNumber(reader.sint64());
|
|
176
138
|
continue;
|
|
177
139
|
}
|
|
178
140
|
case 3: {
|
|
@@ -192,20 +154,20 @@ exports.DeviceCommandAkn = {
|
|
|
192
154
|
},
|
|
193
155
|
fromJSON(object) {
|
|
194
156
|
return {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
message: isSet(object.message) ? globalThis.String(object.message) :
|
|
157
|
+
status: isSet(object.status) ? deviceCommandAkn_StatusFromJSON(object.status) : 0,
|
|
158
|
+
code: isSet(object.code) ? globalThis.Number(object.code) : undefined,
|
|
159
|
+
message: isSet(object.message) ? globalThis.String(object.message) : undefined,
|
|
198
160
|
};
|
|
199
161
|
},
|
|
200
162
|
toJSON(message) {
|
|
201
163
|
const obj = {};
|
|
202
|
-
if (message.command !== undefined) {
|
|
203
|
-
obj.command = exports.DeviceCommand.toJSON(message.command);
|
|
204
|
-
}
|
|
205
164
|
if (message.status !== 0) {
|
|
206
|
-
obj.status =
|
|
165
|
+
obj.status = deviceCommandAkn_StatusToJSON(message.status);
|
|
166
|
+
}
|
|
167
|
+
if (message.code !== undefined) {
|
|
168
|
+
obj.code = Math.round(message.code);
|
|
207
169
|
}
|
|
208
|
-
if (message.message !==
|
|
170
|
+
if (message.message !== undefined) {
|
|
209
171
|
obj.message = message.message;
|
|
210
172
|
}
|
|
211
173
|
return obj;
|
|
@@ -214,26 +176,21 @@ exports.DeviceCommandAkn = {
|
|
|
214
176
|
return exports.DeviceCommandAkn.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
215
177
|
},
|
|
216
178
|
fromPartial(object) {
|
|
217
|
-
var _a, _b;
|
|
179
|
+
var _a, _b, _c;
|
|
218
180
|
const message = createBaseDeviceCommandAkn();
|
|
219
|
-
message.command = (object.command !== undefined && object.command !== null)
|
|
220
|
-
? exports.DeviceCommand.fromPartial(object.command)
|
|
221
|
-
: undefined;
|
|
222
181
|
message.status = (_a = object.status) !== null && _a !== void 0 ? _a : 0;
|
|
223
|
-
message.
|
|
182
|
+
message.code = (_b = object.code) !== null && _b !== void 0 ? _b : undefined;
|
|
183
|
+
message.message = (_c = object.message) !== null && _c !== void 0 ? _c : undefined;
|
|
224
184
|
return message;
|
|
225
185
|
},
|
|
226
186
|
};
|
|
227
187
|
function createBaseDeviceAnswer() {
|
|
228
|
-
return {
|
|
188
|
+
return { answer: "" };
|
|
229
189
|
}
|
|
230
190
|
exports.DeviceAnswer = {
|
|
231
191
|
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
232
|
-
if (message.deviceId !== 0) {
|
|
233
|
-
writer.uint32(8).uint64(message.deviceId);
|
|
234
|
-
}
|
|
235
192
|
if (message.answer !== "") {
|
|
236
|
-
writer.uint32(
|
|
193
|
+
writer.uint32(10).string(message.answer);
|
|
237
194
|
}
|
|
238
195
|
return writer;
|
|
239
196
|
},
|
|
@@ -245,14 +202,7 @@ exports.DeviceAnswer = {
|
|
|
245
202
|
const tag = reader.uint32();
|
|
246
203
|
switch (tag >>> 3) {
|
|
247
204
|
case 1: {
|
|
248
|
-
if (tag !==
|
|
249
|
-
break;
|
|
250
|
-
}
|
|
251
|
-
message.deviceId = longToNumber(reader.uint64());
|
|
252
|
-
continue;
|
|
253
|
-
}
|
|
254
|
-
case 2: {
|
|
255
|
-
if (tag !== 18) {
|
|
205
|
+
if (tag !== 10) {
|
|
256
206
|
break;
|
|
257
207
|
}
|
|
258
208
|
message.answer = reader.string();
|
|
@@ -267,16 +217,10 @@ exports.DeviceAnswer = {
|
|
|
267
217
|
return message;
|
|
268
218
|
},
|
|
269
219
|
fromJSON(object) {
|
|
270
|
-
return {
|
|
271
|
-
deviceId: isSet(object.device_id) ? globalThis.Number(object.device_id) : 0,
|
|
272
|
-
answer: isSet(object.answer) ? globalThis.String(object.answer) : "",
|
|
273
|
-
};
|
|
220
|
+
return { answer: isSet(object.answer) ? globalThis.String(object.answer) : "" };
|
|
274
221
|
},
|
|
275
222
|
toJSON(message) {
|
|
276
223
|
const obj = {};
|
|
277
|
-
if (message.deviceId !== 0) {
|
|
278
|
-
obj.device_id = Math.round(message.deviceId);
|
|
279
|
-
}
|
|
280
224
|
if (message.answer !== "") {
|
|
281
225
|
obj.answer = message.answer;
|
|
282
226
|
}
|
|
@@ -286,30 +230,38 @@ exports.DeviceAnswer = {
|
|
|
286
230
|
return exports.DeviceAnswer.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
287
231
|
},
|
|
288
232
|
fromPartial(object) {
|
|
289
|
-
var _a
|
|
233
|
+
var _a;
|
|
290
234
|
const message = createBaseDeviceAnswer();
|
|
291
|
-
message.
|
|
292
|
-
message.answer = (_b = object.answer) !== null && _b !== void 0 ? _b : "";
|
|
235
|
+
message.answer = (_a = object.answer) !== null && _a !== void 0 ? _a : "";
|
|
293
236
|
return message;
|
|
294
237
|
},
|
|
295
238
|
};
|
|
296
|
-
function
|
|
297
|
-
return {
|
|
239
|
+
function createBaseDeviceMessage() {
|
|
240
|
+
return { deviceId: 0, transactionId: 0, command: undefined, akn: undefined, answer: undefined };
|
|
298
241
|
}
|
|
299
|
-
exports.
|
|
242
|
+
exports.DeviceMessage = {
|
|
300
243
|
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
301
|
-
if (message.
|
|
302
|
-
writer.uint32(8).
|
|
244
|
+
if (message.deviceId !== 0) {
|
|
245
|
+
writer.uint32(8).uint64(message.deviceId);
|
|
246
|
+
}
|
|
247
|
+
if (message.transactionId !== 0) {
|
|
248
|
+
writer.uint32(16).uint64(message.transactionId);
|
|
249
|
+
}
|
|
250
|
+
if (message.command !== undefined) {
|
|
251
|
+
exports.DeviceCommand.encode(message.command, writer.uint32(26).fork()).join();
|
|
252
|
+
}
|
|
253
|
+
if (message.akn !== undefined) {
|
|
254
|
+
exports.DeviceCommandAkn.encode(message.akn, writer.uint32(34).fork()).join();
|
|
303
255
|
}
|
|
304
|
-
if (message.
|
|
305
|
-
writer.uint32(
|
|
256
|
+
if (message.answer !== undefined) {
|
|
257
|
+
exports.DeviceAnswer.encode(message.answer, writer.uint32(42).fork()).join();
|
|
306
258
|
}
|
|
307
259
|
return writer;
|
|
308
260
|
},
|
|
309
261
|
decode(input, length) {
|
|
310
262
|
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
311
263
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
312
|
-
const message =
|
|
264
|
+
const message = createBaseDeviceMessage();
|
|
313
265
|
while (reader.pos < end) {
|
|
314
266
|
const tag = reader.uint32();
|
|
315
267
|
switch (tag >>> 3) {
|
|
@@ -317,14 +269,35 @@ exports.BrokerMessage = {
|
|
|
317
269
|
if (tag !== 8) {
|
|
318
270
|
break;
|
|
319
271
|
}
|
|
320
|
-
message.
|
|
272
|
+
message.deviceId = longToNumber(reader.uint64());
|
|
321
273
|
continue;
|
|
322
274
|
}
|
|
323
275
|
case 2: {
|
|
324
|
-
if (tag !==
|
|
276
|
+
if (tag !== 16) {
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
message.transactionId = longToNumber(reader.uint64());
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
case 3: {
|
|
283
|
+
if (tag !== 26) {
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
message.command = exports.DeviceCommand.decode(reader, reader.uint32());
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
case 4: {
|
|
290
|
+
if (tag !== 34) {
|
|
325
291
|
break;
|
|
326
292
|
}
|
|
327
|
-
message.
|
|
293
|
+
message.akn = exports.DeviceCommandAkn.decode(reader, reader.uint32());
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
case 5: {
|
|
297
|
+
if (tag !== 42) {
|
|
298
|
+
break;
|
|
299
|
+
}
|
|
300
|
+
message.answer = exports.DeviceAnswer.decode(reader, reader.uint32());
|
|
328
301
|
continue;
|
|
329
302
|
}
|
|
330
303
|
}
|
|
@@ -337,56 +310,52 @@ exports.BrokerMessage = {
|
|
|
337
310
|
},
|
|
338
311
|
fromJSON(object) {
|
|
339
312
|
return {
|
|
340
|
-
|
|
341
|
-
|
|
313
|
+
deviceId: isSet(object.device_id) ? globalThis.Number(object.device_id) : 0,
|
|
314
|
+
transactionId: isSet(object.transaction_id) ? globalThis.Number(object.transaction_id) : 0,
|
|
315
|
+
command: isSet(object.command) ? exports.DeviceCommand.fromJSON(object.command) : undefined,
|
|
316
|
+
akn: isSet(object.akn) ? exports.DeviceCommandAkn.fromJSON(object.akn) : undefined,
|
|
317
|
+
answer: isSet(object.answer) ? exports.DeviceAnswer.fromJSON(object.answer) : undefined,
|
|
342
318
|
};
|
|
343
319
|
},
|
|
344
320
|
toJSON(message) {
|
|
345
321
|
const obj = {};
|
|
346
|
-
if (message.
|
|
347
|
-
obj.
|
|
322
|
+
if (message.deviceId !== 0) {
|
|
323
|
+
obj.device_id = Math.round(message.deviceId);
|
|
324
|
+
}
|
|
325
|
+
if (message.transactionId !== 0) {
|
|
326
|
+
obj.transaction_id = Math.round(message.transactionId);
|
|
327
|
+
}
|
|
328
|
+
if (message.command !== undefined) {
|
|
329
|
+
obj.command = exports.DeviceCommand.toJSON(message.command);
|
|
330
|
+
}
|
|
331
|
+
if (message.akn !== undefined) {
|
|
332
|
+
obj.akn = exports.DeviceCommandAkn.toJSON(message.akn);
|
|
348
333
|
}
|
|
349
|
-
if (message.
|
|
350
|
-
obj.
|
|
334
|
+
if (message.answer !== undefined) {
|
|
335
|
+
obj.answer = exports.DeviceAnswer.toJSON(message.answer);
|
|
351
336
|
}
|
|
352
337
|
return obj;
|
|
353
338
|
},
|
|
354
339
|
create(base) {
|
|
355
|
-
return exports.
|
|
340
|
+
return exports.DeviceMessage.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
356
341
|
},
|
|
357
342
|
fromPartial(object) {
|
|
358
343
|
var _a, _b;
|
|
359
|
-
const message =
|
|
360
|
-
message.
|
|
361
|
-
message.
|
|
344
|
+
const message = createBaseDeviceMessage();
|
|
345
|
+
message.deviceId = (_a = object.deviceId) !== null && _a !== void 0 ? _a : 0;
|
|
346
|
+
message.transactionId = (_b = object.transactionId) !== null && _b !== void 0 ? _b : 0;
|
|
347
|
+
message.command = (object.command !== undefined && object.command !== null)
|
|
348
|
+
? exports.DeviceCommand.fromPartial(object.command)
|
|
349
|
+
: undefined;
|
|
350
|
+
message.akn = (object.akn !== undefined && object.akn !== null)
|
|
351
|
+
? exports.DeviceCommandAkn.fromPartial(object.akn)
|
|
352
|
+
: undefined;
|
|
353
|
+
message.answer = (object.answer !== undefined && object.answer !== null)
|
|
354
|
+
? exports.DeviceAnswer.fromPartial(object.answer)
|
|
355
|
+
: undefined;
|
|
362
356
|
return message;
|
|
363
357
|
},
|
|
364
358
|
};
|
|
365
|
-
function bytesFromBase64(b64) {
|
|
366
|
-
if (globalThis.Buffer) {
|
|
367
|
-
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
368
|
-
}
|
|
369
|
-
else {
|
|
370
|
-
const bin = globalThis.atob(b64);
|
|
371
|
-
const arr = new Uint8Array(bin.length);
|
|
372
|
-
for (let i = 0; i < bin.length; ++i) {
|
|
373
|
-
arr[i] = bin.charCodeAt(i);
|
|
374
|
-
}
|
|
375
|
-
return arr;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
function base64FromBytes(arr) {
|
|
379
|
-
if (globalThis.Buffer) {
|
|
380
|
-
return globalThis.Buffer.from(arr).toString("base64");
|
|
381
|
-
}
|
|
382
|
-
else {
|
|
383
|
-
const bin = [];
|
|
384
|
-
arr.forEach((byte) => {
|
|
385
|
-
bin.push(globalThis.String.fromCharCode(byte));
|
|
386
|
-
});
|
|
387
|
-
return globalThis.btoa(bin.join(""));
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
359
|
function longToNumber(int64) {
|
|
391
360
|
const num = globalThis.Number(int64.toString());
|
|
392
361
|
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|