@fatehan/tsrp 1.0.2
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/areas/area.d.ts +51 -0
- package/dist/fatehan/areas/area.js +401 -0
- package/dist/fatehan/google/protobuf/timestamp.d.ts +128 -0
- package/dist/fatehan/google/protobuf/timestamp.js +93 -0
- package/dist/fatehan/models/fusion.d.ts +70 -0
- package/dist/fatehan/models/fusion.js +802 -0
- package/dist/fatehan/models/models.d.ts +65 -0
- package/dist/fatehan/models/models.js +701 -0
- package/dist/fatehan/models/operation.d.ts +81 -0
- package/dist/fatehan/models/operation.js +874 -0
- package/dist/fatehan/notifies/notify.d.ts +147 -0
- package/dist/fatehan/notifies/notify.js +1634 -0
- package/dist/fatehan/packets/dataModel.d.ts +1254 -0
- package/dist/fatehan/packets/dataModel.js +16880 -0
- package/dist/fatehan/packets/messages.d.ts +52 -0
- package/dist/fatehan/packets/messages.js +402 -0
- package/dist/fatehan/reports/ReportServiceClientPb.js +265 -0
- package/dist/fatehan/reports/report.d.ts +916 -0
- package/dist/fatehan/reports/report.js +12050 -0
- package/dist/fatehan/trips/trip.d.ts +358 -0
- package/dist/fatehan/trips/trip.js +3752 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +59 -0
- package/dist/index.test.d.ts +1 -0
- package/dist/index.test.js +38 -0
- package/package.json +32 -0
- package/readme.md +11 -0
|
@@ -0,0 +1,701 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v2.7.0
|
|
5
|
+
// protoc v3.21.12
|
|
6
|
+
// source: models/models.proto
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.SinotrackCache = exports.HeartbeatCache = exports.IoList_ItemsEntry = exports.IoList = exports.Gallery = exports.protobufPackage = void 0;
|
|
9
|
+
/* eslint-disable */
|
|
10
|
+
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
11
|
+
const timestamp_1 = require("../google/protobuf/timestamp");
|
|
12
|
+
const dataModel_1 = require("../packets/dataModel");
|
|
13
|
+
exports.protobufPackage = "fatehan";
|
|
14
|
+
function createBaseGallery() {
|
|
15
|
+
return {
|
|
16
|
+
id: 0,
|
|
17
|
+
deviceId: 0,
|
|
18
|
+
identificationNo: new Uint8Array(0),
|
|
19
|
+
type: 0,
|
|
20
|
+
storage: "",
|
|
21
|
+
path: "",
|
|
22
|
+
mime: "",
|
|
23
|
+
codec: undefined,
|
|
24
|
+
size: 0,
|
|
25
|
+
location: undefined,
|
|
26
|
+
createdAt: undefined,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
exports.Gallery = {
|
|
30
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
31
|
+
if (message.id !== 0) {
|
|
32
|
+
writer.uint32(8).uint64(message.id);
|
|
33
|
+
}
|
|
34
|
+
if (message.deviceId !== 0) {
|
|
35
|
+
writer.uint32(16).uint64(message.deviceId);
|
|
36
|
+
}
|
|
37
|
+
if (message.identificationNo.length !== 0) {
|
|
38
|
+
writer.uint32(26).bytes(message.identificationNo);
|
|
39
|
+
}
|
|
40
|
+
if (message.type !== 0) {
|
|
41
|
+
writer.uint32(32).int32(message.type);
|
|
42
|
+
}
|
|
43
|
+
if (message.storage !== "") {
|
|
44
|
+
writer.uint32(42).string(message.storage);
|
|
45
|
+
}
|
|
46
|
+
if (message.path !== "") {
|
|
47
|
+
writer.uint32(50).string(message.path);
|
|
48
|
+
}
|
|
49
|
+
if (message.mime !== "") {
|
|
50
|
+
writer.uint32(58).string(message.mime);
|
|
51
|
+
}
|
|
52
|
+
if (message.codec !== undefined) {
|
|
53
|
+
writer.uint32(66).string(message.codec);
|
|
54
|
+
}
|
|
55
|
+
if (message.size !== 0) {
|
|
56
|
+
writer.uint32(72).uint32(message.size);
|
|
57
|
+
}
|
|
58
|
+
if (message.location !== undefined) {
|
|
59
|
+
dataModel_1.Data.encode(message.location, writer.uint32(82).fork()).join();
|
|
60
|
+
}
|
|
61
|
+
if (message.createdAt !== undefined) {
|
|
62
|
+
timestamp_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(90).fork()).join();
|
|
63
|
+
}
|
|
64
|
+
return writer;
|
|
65
|
+
},
|
|
66
|
+
decode(input, length) {
|
|
67
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
68
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
69
|
+
const message = createBaseGallery();
|
|
70
|
+
while (reader.pos < end) {
|
|
71
|
+
const tag = reader.uint32();
|
|
72
|
+
switch (tag >>> 3) {
|
|
73
|
+
case 1: {
|
|
74
|
+
if (tag !== 8) {
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
message.id = longToNumber(reader.uint64());
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
case 2: {
|
|
81
|
+
if (tag !== 16) {
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
message.deviceId = longToNumber(reader.uint64());
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
case 3: {
|
|
88
|
+
if (tag !== 26) {
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
message.identificationNo = reader.bytes();
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
case 4: {
|
|
95
|
+
if (tag !== 32) {
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
message.type = reader.int32();
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
case 5: {
|
|
102
|
+
if (tag !== 42) {
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
message.storage = reader.string();
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
case 6: {
|
|
109
|
+
if (tag !== 50) {
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
message.path = reader.string();
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
case 7: {
|
|
116
|
+
if (tag !== 58) {
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
message.mime = reader.string();
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
case 8: {
|
|
123
|
+
if (tag !== 66) {
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
message.codec = reader.string();
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
case 9: {
|
|
130
|
+
if (tag !== 72) {
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
message.size = reader.uint32();
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
case 10: {
|
|
137
|
+
if (tag !== 82) {
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
message.location = dataModel_1.Data.decode(reader, reader.uint32());
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
case 11: {
|
|
144
|
+
if (tag !== 90) {
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
message.createdAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
reader.skip(tag & 7);
|
|
155
|
+
}
|
|
156
|
+
return message;
|
|
157
|
+
},
|
|
158
|
+
fromJSON(object) {
|
|
159
|
+
return {
|
|
160
|
+
id: isSet(object.id) ? globalThis.Number(object.id) : 0,
|
|
161
|
+
deviceId: isSet(object.device_id) ? globalThis.Number(object.device_id) : 0,
|
|
162
|
+
identificationNo: isSet(object.identification_no) ? bytesFromBase64(object.identification_no) : new Uint8Array(0),
|
|
163
|
+
type: isSet(object.type) ? (0, dataModel_1.fileTypeFromJSON)(object.type) : 0,
|
|
164
|
+
storage: isSet(object.storage) ? globalThis.String(object.storage) : "",
|
|
165
|
+
path: isSet(object.path) ? globalThis.String(object.path) : "",
|
|
166
|
+
mime: isSet(object.mime) ? globalThis.String(object.mime) : "",
|
|
167
|
+
codec: isSet(object.codec) ? globalThis.String(object.codec) : undefined,
|
|
168
|
+
size: isSet(object.size) ? globalThis.Number(object.size) : 0,
|
|
169
|
+
location: isSet(object.location) ? dataModel_1.Data.fromJSON(object.location) : undefined,
|
|
170
|
+
createdAt: isSet(object.created_at) ? fromJsonTimestamp(object.created_at) : undefined,
|
|
171
|
+
};
|
|
172
|
+
},
|
|
173
|
+
toJSON(message) {
|
|
174
|
+
const obj = {};
|
|
175
|
+
if (message.id !== 0) {
|
|
176
|
+
obj.id = Math.round(message.id);
|
|
177
|
+
}
|
|
178
|
+
if (message.deviceId !== 0) {
|
|
179
|
+
obj.device_id = Math.round(message.deviceId);
|
|
180
|
+
}
|
|
181
|
+
if (message.identificationNo.length !== 0) {
|
|
182
|
+
obj.identification_no = base64FromBytes(message.identificationNo);
|
|
183
|
+
}
|
|
184
|
+
if (message.type !== 0) {
|
|
185
|
+
obj.type = (0, dataModel_1.fileTypeToJSON)(message.type);
|
|
186
|
+
}
|
|
187
|
+
if (message.storage !== "") {
|
|
188
|
+
obj.storage = message.storage;
|
|
189
|
+
}
|
|
190
|
+
if (message.path !== "") {
|
|
191
|
+
obj.path = message.path;
|
|
192
|
+
}
|
|
193
|
+
if (message.mime !== "") {
|
|
194
|
+
obj.mime = message.mime;
|
|
195
|
+
}
|
|
196
|
+
if (message.codec !== undefined) {
|
|
197
|
+
obj.codec = message.codec;
|
|
198
|
+
}
|
|
199
|
+
if (message.size !== 0) {
|
|
200
|
+
obj.size = Math.round(message.size);
|
|
201
|
+
}
|
|
202
|
+
if (message.location !== undefined) {
|
|
203
|
+
obj.location = dataModel_1.Data.toJSON(message.location);
|
|
204
|
+
}
|
|
205
|
+
if (message.createdAt !== undefined) {
|
|
206
|
+
obj.created_at = message.createdAt.toISOString();
|
|
207
|
+
}
|
|
208
|
+
return obj;
|
|
209
|
+
},
|
|
210
|
+
create(base) {
|
|
211
|
+
return exports.Gallery.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
212
|
+
},
|
|
213
|
+
fromPartial(object) {
|
|
214
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
215
|
+
const message = createBaseGallery();
|
|
216
|
+
message.id = (_a = object.id) !== null && _a !== void 0 ? _a : 0;
|
|
217
|
+
message.deviceId = (_b = object.deviceId) !== null && _b !== void 0 ? _b : 0;
|
|
218
|
+
message.identificationNo = (_c = object.identificationNo) !== null && _c !== void 0 ? _c : new Uint8Array(0);
|
|
219
|
+
message.type = (_d = object.type) !== null && _d !== void 0 ? _d : 0;
|
|
220
|
+
message.storage = (_e = object.storage) !== null && _e !== void 0 ? _e : "";
|
|
221
|
+
message.path = (_f = object.path) !== null && _f !== void 0 ? _f : "";
|
|
222
|
+
message.mime = (_g = object.mime) !== null && _g !== void 0 ? _g : "";
|
|
223
|
+
message.codec = (_h = object.codec) !== null && _h !== void 0 ? _h : undefined;
|
|
224
|
+
message.size = (_j = object.size) !== null && _j !== void 0 ? _j : 0;
|
|
225
|
+
message.location = (object.location !== undefined && object.location !== null)
|
|
226
|
+
? dataModel_1.Data.fromPartial(object.location)
|
|
227
|
+
: undefined;
|
|
228
|
+
message.createdAt = (_k = object.createdAt) !== null && _k !== void 0 ? _k : undefined;
|
|
229
|
+
return message;
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
function createBaseIoList() {
|
|
233
|
+
return { items: {} };
|
|
234
|
+
}
|
|
235
|
+
exports.IoList = {
|
|
236
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
237
|
+
Object.entries(message.items).forEach(([key, value]) => {
|
|
238
|
+
exports.IoList_ItemsEntry.encode({ key: key, value }, writer.uint32(10).fork()).join();
|
|
239
|
+
});
|
|
240
|
+
return writer;
|
|
241
|
+
},
|
|
242
|
+
decode(input, length) {
|
|
243
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
244
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
245
|
+
const message = createBaseIoList();
|
|
246
|
+
while (reader.pos < end) {
|
|
247
|
+
const tag = reader.uint32();
|
|
248
|
+
switch (tag >>> 3) {
|
|
249
|
+
case 1: {
|
|
250
|
+
if (tag !== 10) {
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
const entry1 = exports.IoList_ItemsEntry.decode(reader, reader.uint32());
|
|
254
|
+
if (entry1.value !== undefined) {
|
|
255
|
+
message.items[entry1.key] = entry1.value;
|
|
256
|
+
}
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
reader.skip(tag & 7);
|
|
264
|
+
}
|
|
265
|
+
return message;
|
|
266
|
+
},
|
|
267
|
+
fromJSON(object) {
|
|
268
|
+
return {
|
|
269
|
+
items: isObject(object.items)
|
|
270
|
+
? Object.entries(object.items).reduce((acc, [key, value]) => {
|
|
271
|
+
acc[globalThis.Number(key)] = bytesFromBase64(value);
|
|
272
|
+
return acc;
|
|
273
|
+
}, {})
|
|
274
|
+
: {},
|
|
275
|
+
};
|
|
276
|
+
},
|
|
277
|
+
toJSON(message) {
|
|
278
|
+
const obj = {};
|
|
279
|
+
if (message.items) {
|
|
280
|
+
const entries = Object.entries(message.items);
|
|
281
|
+
if (entries.length > 0) {
|
|
282
|
+
obj.items = {};
|
|
283
|
+
entries.forEach(([k, v]) => {
|
|
284
|
+
obj.items[k] = base64FromBytes(v);
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return obj;
|
|
289
|
+
},
|
|
290
|
+
create(base) {
|
|
291
|
+
return exports.IoList.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
292
|
+
},
|
|
293
|
+
fromPartial(object) {
|
|
294
|
+
var _a;
|
|
295
|
+
const message = createBaseIoList();
|
|
296
|
+
message.items = Object.entries((_a = object.items) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
|
|
297
|
+
if (value !== undefined) {
|
|
298
|
+
acc[globalThis.Number(key)] = value;
|
|
299
|
+
}
|
|
300
|
+
return acc;
|
|
301
|
+
}, {});
|
|
302
|
+
return message;
|
|
303
|
+
},
|
|
304
|
+
};
|
|
305
|
+
function createBaseIoList_ItemsEntry() {
|
|
306
|
+
return { key: 0, value: new Uint8Array(0) };
|
|
307
|
+
}
|
|
308
|
+
exports.IoList_ItemsEntry = {
|
|
309
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
310
|
+
if (message.key !== 0) {
|
|
311
|
+
writer.uint32(8).uint32(message.key);
|
|
312
|
+
}
|
|
313
|
+
if (message.value.length !== 0) {
|
|
314
|
+
writer.uint32(18).bytes(message.value);
|
|
315
|
+
}
|
|
316
|
+
return writer;
|
|
317
|
+
},
|
|
318
|
+
decode(input, length) {
|
|
319
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
320
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
321
|
+
const message = createBaseIoList_ItemsEntry();
|
|
322
|
+
while (reader.pos < end) {
|
|
323
|
+
const tag = reader.uint32();
|
|
324
|
+
switch (tag >>> 3) {
|
|
325
|
+
case 1: {
|
|
326
|
+
if (tag !== 8) {
|
|
327
|
+
break;
|
|
328
|
+
}
|
|
329
|
+
message.key = reader.uint32();
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
332
|
+
case 2: {
|
|
333
|
+
if (tag !== 18) {
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
message.value = reader.bytes();
|
|
337
|
+
continue;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
reader.skip(tag & 7);
|
|
344
|
+
}
|
|
345
|
+
return message;
|
|
346
|
+
},
|
|
347
|
+
fromJSON(object) {
|
|
348
|
+
return {
|
|
349
|
+
key: isSet(object.key) ? globalThis.Number(object.key) : 0,
|
|
350
|
+
value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0),
|
|
351
|
+
};
|
|
352
|
+
},
|
|
353
|
+
toJSON(message) {
|
|
354
|
+
const obj = {};
|
|
355
|
+
if (message.key !== 0) {
|
|
356
|
+
obj.key = Math.round(message.key);
|
|
357
|
+
}
|
|
358
|
+
if (message.value.length !== 0) {
|
|
359
|
+
obj.value = base64FromBytes(message.value);
|
|
360
|
+
}
|
|
361
|
+
return obj;
|
|
362
|
+
},
|
|
363
|
+
create(base) {
|
|
364
|
+
return exports.IoList_ItemsEntry.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
365
|
+
},
|
|
366
|
+
fromPartial(object) {
|
|
367
|
+
var _a, _b;
|
|
368
|
+
const message = createBaseIoList_ItemsEntry();
|
|
369
|
+
message.key = (_a = object.key) !== null && _a !== void 0 ? _a : 0;
|
|
370
|
+
message.value = (_b = object.value) !== null && _b !== void 0 ? _b : new Uint8Array(0);
|
|
371
|
+
return message;
|
|
372
|
+
},
|
|
373
|
+
};
|
|
374
|
+
function createBaseHeartbeatCache() {
|
|
375
|
+
return {
|
|
376
|
+
ignition: undefined,
|
|
377
|
+
gsm: undefined,
|
|
378
|
+
batteryPercent: undefined,
|
|
379
|
+
externalVoltage: undefined,
|
|
380
|
+
commandId: undefined,
|
|
381
|
+
command: undefined,
|
|
382
|
+
mileage: undefined,
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
exports.HeartbeatCache = {
|
|
386
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
387
|
+
if (message.ignition !== undefined) {
|
|
388
|
+
writer.uint32(8).bool(message.ignition);
|
|
389
|
+
}
|
|
390
|
+
if (message.gsm !== undefined) {
|
|
391
|
+
writer.uint32(16).uint32(message.gsm);
|
|
392
|
+
}
|
|
393
|
+
if (message.batteryPercent !== undefined) {
|
|
394
|
+
writer.uint32(24).uint32(message.batteryPercent);
|
|
395
|
+
}
|
|
396
|
+
if (message.externalVoltage !== undefined) {
|
|
397
|
+
writer.uint32(32).uint32(message.externalVoltage);
|
|
398
|
+
}
|
|
399
|
+
if (message.commandId !== undefined) {
|
|
400
|
+
writer.uint32(40).uint64(message.commandId);
|
|
401
|
+
}
|
|
402
|
+
if (message.command !== undefined) {
|
|
403
|
+
writer.uint32(50).string(message.command);
|
|
404
|
+
}
|
|
405
|
+
if (message.mileage !== undefined) {
|
|
406
|
+
writer.uint32(56).uint64(message.mileage);
|
|
407
|
+
}
|
|
408
|
+
return writer;
|
|
409
|
+
},
|
|
410
|
+
decode(input, length) {
|
|
411
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
412
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
413
|
+
const message = createBaseHeartbeatCache();
|
|
414
|
+
while (reader.pos < end) {
|
|
415
|
+
const tag = reader.uint32();
|
|
416
|
+
switch (tag >>> 3) {
|
|
417
|
+
case 1: {
|
|
418
|
+
if (tag !== 8) {
|
|
419
|
+
break;
|
|
420
|
+
}
|
|
421
|
+
message.ignition = reader.bool();
|
|
422
|
+
continue;
|
|
423
|
+
}
|
|
424
|
+
case 2: {
|
|
425
|
+
if (tag !== 16) {
|
|
426
|
+
break;
|
|
427
|
+
}
|
|
428
|
+
message.gsm = reader.uint32();
|
|
429
|
+
continue;
|
|
430
|
+
}
|
|
431
|
+
case 3: {
|
|
432
|
+
if (tag !== 24) {
|
|
433
|
+
break;
|
|
434
|
+
}
|
|
435
|
+
message.batteryPercent = reader.uint32();
|
|
436
|
+
continue;
|
|
437
|
+
}
|
|
438
|
+
case 4: {
|
|
439
|
+
if (tag !== 32) {
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
message.externalVoltage = reader.uint32();
|
|
443
|
+
continue;
|
|
444
|
+
}
|
|
445
|
+
case 5: {
|
|
446
|
+
if (tag !== 40) {
|
|
447
|
+
break;
|
|
448
|
+
}
|
|
449
|
+
message.commandId = longToNumber(reader.uint64());
|
|
450
|
+
continue;
|
|
451
|
+
}
|
|
452
|
+
case 6: {
|
|
453
|
+
if (tag !== 50) {
|
|
454
|
+
break;
|
|
455
|
+
}
|
|
456
|
+
message.command = reader.string();
|
|
457
|
+
continue;
|
|
458
|
+
}
|
|
459
|
+
case 7: {
|
|
460
|
+
if (tag !== 56) {
|
|
461
|
+
break;
|
|
462
|
+
}
|
|
463
|
+
message.mileage = longToNumber(reader.uint64());
|
|
464
|
+
continue;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
468
|
+
break;
|
|
469
|
+
}
|
|
470
|
+
reader.skip(tag & 7);
|
|
471
|
+
}
|
|
472
|
+
return message;
|
|
473
|
+
},
|
|
474
|
+
fromJSON(object) {
|
|
475
|
+
return {
|
|
476
|
+
ignition: isSet(object.ignition) ? globalThis.Boolean(object.ignition) : undefined,
|
|
477
|
+
gsm: isSet(object.gsm) ? globalThis.Number(object.gsm) : undefined,
|
|
478
|
+
batteryPercent: isSet(object.batteryPercent) ? globalThis.Number(object.batteryPercent) : undefined,
|
|
479
|
+
externalVoltage: isSet(object.externalVoltage) ? globalThis.Number(object.externalVoltage) : undefined,
|
|
480
|
+
commandId: isSet(object.commandId) ? globalThis.Number(object.commandId) : undefined,
|
|
481
|
+
command: isSet(object.command) ? globalThis.String(object.command) : undefined,
|
|
482
|
+
mileage: isSet(object.mileage) ? globalThis.Number(object.mileage) : undefined,
|
|
483
|
+
};
|
|
484
|
+
},
|
|
485
|
+
toJSON(message) {
|
|
486
|
+
const obj = {};
|
|
487
|
+
if (message.ignition !== undefined) {
|
|
488
|
+
obj.ignition = message.ignition;
|
|
489
|
+
}
|
|
490
|
+
if (message.gsm !== undefined) {
|
|
491
|
+
obj.gsm = Math.round(message.gsm);
|
|
492
|
+
}
|
|
493
|
+
if (message.batteryPercent !== undefined) {
|
|
494
|
+
obj.batteryPercent = Math.round(message.batteryPercent);
|
|
495
|
+
}
|
|
496
|
+
if (message.externalVoltage !== undefined) {
|
|
497
|
+
obj.externalVoltage = Math.round(message.externalVoltage);
|
|
498
|
+
}
|
|
499
|
+
if (message.commandId !== undefined) {
|
|
500
|
+
obj.commandId = Math.round(message.commandId);
|
|
501
|
+
}
|
|
502
|
+
if (message.command !== undefined) {
|
|
503
|
+
obj.command = message.command;
|
|
504
|
+
}
|
|
505
|
+
if (message.mileage !== undefined) {
|
|
506
|
+
obj.mileage = Math.round(message.mileage);
|
|
507
|
+
}
|
|
508
|
+
return obj;
|
|
509
|
+
},
|
|
510
|
+
create(base) {
|
|
511
|
+
return exports.HeartbeatCache.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
512
|
+
},
|
|
513
|
+
fromPartial(object) {
|
|
514
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
515
|
+
const message = createBaseHeartbeatCache();
|
|
516
|
+
message.ignition = (_a = object.ignition) !== null && _a !== void 0 ? _a : undefined;
|
|
517
|
+
message.gsm = (_b = object.gsm) !== null && _b !== void 0 ? _b : undefined;
|
|
518
|
+
message.batteryPercent = (_c = object.batteryPercent) !== null && _c !== void 0 ? _c : undefined;
|
|
519
|
+
message.externalVoltage = (_d = object.externalVoltage) !== null && _d !== void 0 ? _d : undefined;
|
|
520
|
+
message.commandId = (_e = object.commandId) !== null && _e !== void 0 ? _e : undefined;
|
|
521
|
+
message.command = (_f = object.command) !== null && _f !== void 0 ? _f : undefined;
|
|
522
|
+
message.mileage = (_g = object.mileage) !== null && _g !== void 0 ? _g : undefined;
|
|
523
|
+
return message;
|
|
524
|
+
},
|
|
525
|
+
};
|
|
526
|
+
function createBaseSinotrackCache() {
|
|
527
|
+
return { gpsTime: 0, fuelUsedGps: undefined, ignition: undefined, commandId: undefined, command: undefined };
|
|
528
|
+
}
|
|
529
|
+
exports.SinotrackCache = {
|
|
530
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
531
|
+
if (message.gpsTime !== 0) {
|
|
532
|
+
writer.uint32(8).int64(message.gpsTime);
|
|
533
|
+
}
|
|
534
|
+
if (message.fuelUsedGps !== undefined) {
|
|
535
|
+
writer.uint32(16).uint32(message.fuelUsedGps);
|
|
536
|
+
}
|
|
537
|
+
if (message.ignition !== undefined) {
|
|
538
|
+
writer.uint32(24).bool(message.ignition);
|
|
539
|
+
}
|
|
540
|
+
if (message.commandId !== undefined) {
|
|
541
|
+
writer.uint32(40).uint64(message.commandId);
|
|
542
|
+
}
|
|
543
|
+
if (message.command !== undefined) {
|
|
544
|
+
writer.uint32(50).string(message.command);
|
|
545
|
+
}
|
|
546
|
+
return writer;
|
|
547
|
+
},
|
|
548
|
+
decode(input, length) {
|
|
549
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
550
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
551
|
+
const message = createBaseSinotrackCache();
|
|
552
|
+
while (reader.pos < end) {
|
|
553
|
+
const tag = reader.uint32();
|
|
554
|
+
switch (tag >>> 3) {
|
|
555
|
+
case 1: {
|
|
556
|
+
if (tag !== 8) {
|
|
557
|
+
break;
|
|
558
|
+
}
|
|
559
|
+
message.gpsTime = longToNumber(reader.int64());
|
|
560
|
+
continue;
|
|
561
|
+
}
|
|
562
|
+
case 2: {
|
|
563
|
+
if (tag !== 16) {
|
|
564
|
+
break;
|
|
565
|
+
}
|
|
566
|
+
message.fuelUsedGps = reader.uint32();
|
|
567
|
+
continue;
|
|
568
|
+
}
|
|
569
|
+
case 3: {
|
|
570
|
+
if (tag !== 24) {
|
|
571
|
+
break;
|
|
572
|
+
}
|
|
573
|
+
message.ignition = reader.bool();
|
|
574
|
+
continue;
|
|
575
|
+
}
|
|
576
|
+
case 5: {
|
|
577
|
+
if (tag !== 40) {
|
|
578
|
+
break;
|
|
579
|
+
}
|
|
580
|
+
message.commandId = longToNumber(reader.uint64());
|
|
581
|
+
continue;
|
|
582
|
+
}
|
|
583
|
+
case 6: {
|
|
584
|
+
if (tag !== 50) {
|
|
585
|
+
break;
|
|
586
|
+
}
|
|
587
|
+
message.command = reader.string();
|
|
588
|
+
continue;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
592
|
+
break;
|
|
593
|
+
}
|
|
594
|
+
reader.skip(tag & 7);
|
|
595
|
+
}
|
|
596
|
+
return message;
|
|
597
|
+
},
|
|
598
|
+
fromJSON(object) {
|
|
599
|
+
return {
|
|
600
|
+
gpsTime: isSet(object.gpsTime) ? globalThis.Number(object.gpsTime) : 0,
|
|
601
|
+
fuelUsedGps: isSet(object.fuelUsedGps) ? globalThis.Number(object.fuelUsedGps) : undefined,
|
|
602
|
+
ignition: isSet(object.ignition) ? globalThis.Boolean(object.ignition) : undefined,
|
|
603
|
+
commandId: isSet(object.commandId) ? globalThis.Number(object.commandId) : undefined,
|
|
604
|
+
command: isSet(object.command) ? globalThis.String(object.command) : undefined,
|
|
605
|
+
};
|
|
606
|
+
},
|
|
607
|
+
toJSON(message) {
|
|
608
|
+
const obj = {};
|
|
609
|
+
if (message.gpsTime !== 0) {
|
|
610
|
+
obj.gpsTime = Math.round(message.gpsTime);
|
|
611
|
+
}
|
|
612
|
+
if (message.fuelUsedGps !== undefined) {
|
|
613
|
+
obj.fuelUsedGps = Math.round(message.fuelUsedGps);
|
|
614
|
+
}
|
|
615
|
+
if (message.ignition !== undefined) {
|
|
616
|
+
obj.ignition = message.ignition;
|
|
617
|
+
}
|
|
618
|
+
if (message.commandId !== undefined) {
|
|
619
|
+
obj.commandId = Math.round(message.commandId);
|
|
620
|
+
}
|
|
621
|
+
if (message.command !== undefined) {
|
|
622
|
+
obj.command = message.command;
|
|
623
|
+
}
|
|
624
|
+
return obj;
|
|
625
|
+
},
|
|
626
|
+
create(base) {
|
|
627
|
+
return exports.SinotrackCache.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
628
|
+
},
|
|
629
|
+
fromPartial(object) {
|
|
630
|
+
var _a, _b, _c, _d, _e;
|
|
631
|
+
const message = createBaseSinotrackCache();
|
|
632
|
+
message.gpsTime = (_a = object.gpsTime) !== null && _a !== void 0 ? _a : 0;
|
|
633
|
+
message.fuelUsedGps = (_b = object.fuelUsedGps) !== null && _b !== void 0 ? _b : undefined;
|
|
634
|
+
message.ignition = (_c = object.ignition) !== null && _c !== void 0 ? _c : undefined;
|
|
635
|
+
message.commandId = (_d = object.commandId) !== null && _d !== void 0 ? _d : undefined;
|
|
636
|
+
message.command = (_e = object.command) !== null && _e !== void 0 ? _e : undefined;
|
|
637
|
+
return message;
|
|
638
|
+
},
|
|
639
|
+
};
|
|
640
|
+
function bytesFromBase64(b64) {
|
|
641
|
+
if (globalThis.Buffer) {
|
|
642
|
+
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
643
|
+
}
|
|
644
|
+
else {
|
|
645
|
+
const bin = globalThis.atob(b64);
|
|
646
|
+
const arr = new Uint8Array(bin.length);
|
|
647
|
+
for (let i = 0; i < bin.length; ++i) {
|
|
648
|
+
arr[i] = bin.charCodeAt(i);
|
|
649
|
+
}
|
|
650
|
+
return arr;
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
function base64FromBytes(arr) {
|
|
654
|
+
if (globalThis.Buffer) {
|
|
655
|
+
return globalThis.Buffer.from(arr).toString("base64");
|
|
656
|
+
}
|
|
657
|
+
else {
|
|
658
|
+
const bin = [];
|
|
659
|
+
arr.forEach((byte) => {
|
|
660
|
+
bin.push(globalThis.String.fromCharCode(byte));
|
|
661
|
+
});
|
|
662
|
+
return globalThis.btoa(bin.join(""));
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
function toTimestamp(date) {
|
|
666
|
+
const seconds = Math.trunc(date.getTime() / 1000);
|
|
667
|
+
const nanos = (date.getTime() % 1000) * 1000000;
|
|
668
|
+
return { seconds, nanos };
|
|
669
|
+
}
|
|
670
|
+
function fromTimestamp(t) {
|
|
671
|
+
let millis = (t.seconds || 0) * 1000;
|
|
672
|
+
millis += (t.nanos || 0) / 1000000;
|
|
673
|
+
return new globalThis.Date(millis);
|
|
674
|
+
}
|
|
675
|
+
function fromJsonTimestamp(o) {
|
|
676
|
+
if (o instanceof globalThis.Date) {
|
|
677
|
+
return o;
|
|
678
|
+
}
|
|
679
|
+
else if (typeof o === "string") {
|
|
680
|
+
return new globalThis.Date(o);
|
|
681
|
+
}
|
|
682
|
+
else {
|
|
683
|
+
return fromTimestamp(timestamp_1.Timestamp.fromJSON(o));
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
function longToNumber(int64) {
|
|
687
|
+
const num = globalThis.Number(int64.toString());
|
|
688
|
+
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
|
689
|
+
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
690
|
+
}
|
|
691
|
+
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
|
692
|
+
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
|
693
|
+
}
|
|
694
|
+
return num;
|
|
695
|
+
}
|
|
696
|
+
function isObject(value) {
|
|
697
|
+
return typeof value === "object" && value !== null;
|
|
698
|
+
}
|
|
699
|
+
function isSet(value) {
|
|
700
|
+
return value !== null && value !== undefined;
|
|
701
|
+
}
|