@fatehan/tsrp 1.0.30 → 1.0.32
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/models/models.d.ts +1 -0
- package/dist/fatehan/models/models.d.ts.map +1 -1
- package/dist/fatehan/models/models.js +17 -2
- package/dist/fatehan/notifies/notify.d.ts +6 -3
- package/dist/fatehan/notifies/notify.d.ts.map +1 -1
- package/dist/fatehan/notifies/notify.js +71 -19
- package/dist/fatehan/reports/report.d.ts +10 -0
- package/dist/fatehan/reports/report.d.ts.map +1 -1
- package/dist/fatehan/reports/report.js +126 -2
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +48 -1
- package/dist/index.test.js +287 -3
- package/dist/store/system.io.d.ts +4 -0
- package/dist/store/system.io.d.ts.map +1 -0
- package/dist/store/system.io.js +11 -0
- package/dist/system.io.d.ts +5 -0
- package/dist/system.io.d.ts.map +1 -0
- package/dist/system.io.js +62 -0
- package/package.json +2 -2
- package/readme.md +3 -3
|
@@ -8,8 +8,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
8
8
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
9
|
};
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
11
|
+
exports.DashboardIndividualResponse_Environmental = exports.DashboardIndividualResponse = exports.LatestDataModelRequest = exports.TripPerformance_SpeedsEntry = exports.TripPerformance_CrashesEntry = exports.TripPerformance_HumidityEntry = exports.TripPerformance_TemperatureEntry = exports.TripPerformance_DrivingEntry = exports.TripPerformance_Average = exports.TripPerformance = exports.TripPerformanceResponse = exports.TripPerformanceRequest = exports.MaintenanceResponse_Device = exports.MaintenanceResponse_Service = exports.MaintenanceResponse_Group = exports.MaintenanceResponse_List = exports.MaintenanceResponse_Cost = exports.MaintenanceResponse = exports.MaintenanceRequest = exports.AreaSplitterResponse_Record = exports.AreaSplitterResponse_Area = exports.AreaSplitterResponse = exports.AreaSplitterRequest = exports.TripReportRequest = exports.WorkCycleResponse = exports.WorkCycleRequest = exports.CommandHistoryResponse = exports.CommandHistoryRequest = exports.ChartResponse_ChartEntry = exports.ChartResponse_Chart_IosEntry = exports.ChartResponse_Chart = exports.ChartResponse_Series = exports.ChartResponse = exports.ChartRequest = exports.SystemIoResponse = exports.SystemIoRequest = exports.TripsSummaryRequest_GroupBy = exports.AttendanceResponse_EventType = exports.TrafficResponse_Traffic_EventType = exports.AreaReviewResponse_AreaReview_AreaEventType = exports.AreaSummaryReviewResponse_trafficType = exports.AreaSummaryReviewRequest_AreaSourceEnum = exports.AreaSummaryReviewRequest_ScopeEnum = exports.Traffix_Event_Type = exports.TripPerformanceRequest_GroupBy = exports.MaintenanceRequest_GroupBy = exports.StopCalculateIo = exports.RouteStopType = exports.Source = exports.protobufPackage = void 0;
|
|
12
|
+
exports.TripsSummaryRequest = exports.TripsResponse = exports.TripsRequest = exports.AttendanceResponse_Attendance = exports.AttendanceResponse_Event = exports.AttendanceResponse = exports.AttendanceXRequest = exports.AttendanceRequest = exports.TrafficResponse_Traffic = exports.TrafficResponse = exports.TrafficRequest = exports.LogRequest = exports.LogResponse = exports.DeviceDataResponse = exports.DeviceDataRequest = exports.AreaReviewResponse_AreaReview = exports.AreaReviewResponse = exports.AreaReviewRequest = exports.RouteReviewResponse = exports.RouteReviewRequest = exports.RouteStopRequest = exports.RouteStopResponse = exports.RouteStopPoint = exports.DailyTrafficRequest = exports.DailyTrafficResponse_DailyTraffic = exports.DailyTrafficResponse_Traffic = exports.DailyTrafficResponse = exports.DeviceDataCountResponse_DeviceDataCount = exports.DeviceDataCountResponse = exports.DeviceDataCountRequest = exports.ShiftSummaryRequest = exports.ShiftResponse_Shift = exports.ShiftResponse = exports.ShiftRequest = exports.ShiftSummaryResponse_Summary = exports.ShiftSummaryResponse = exports.AreaSummaryReviewResponse_Review = exports.AreaSummaryReviewResponse = exports.AreaSummaryReviewRequest = exports.TripReportResponse = exports.TraffixRequest = exports.Traffix_STOP = exports.Traffix_Event = exports.Traffix = exports.TraffixResponse = exports.DashboardIndividualRequest = exports.DashboardIndividualResponse_SpeedsEntry = exports.DashboardIndividualResponse_GreenDrivingEntry = exports.DashboardIndividualResponse_Environmental_HumidityEntry = exports.DashboardIndividualResponse_Environmental_TemperatureEntry = void 0;
|
|
13
|
+
exports.TripsSummaryResponse = void 0;
|
|
13
14
|
exports.sourceFromJSON = sourceFromJSON;
|
|
14
15
|
exports.sourceToJSON = sourceToJSON;
|
|
15
16
|
exports.routeStopTypeFromJSON = routeStopTypeFromJSON;
|
|
@@ -41,6 +42,7 @@ const wire_1 = require("@bufbuild/protobuf/wire");
|
|
|
41
42
|
const long_1 = __importDefault(require("long"));
|
|
42
43
|
const area_1 = require("../areas/area");
|
|
43
44
|
const timestamp_1 = require("../google/protobuf/timestamp");
|
|
45
|
+
const models_1 = require("../models/models");
|
|
44
46
|
const dataModel_1 = require("../packets/dataModel");
|
|
45
47
|
const messages_1 = require("../packets/messages");
|
|
46
48
|
const trip_1 = require("../trips/trip");
|
|
@@ -532,6 +534,128 @@ function tripsSummaryRequest_GroupByToJSON(object) {
|
|
|
532
534
|
return "UNRECOGNIZED";
|
|
533
535
|
}
|
|
534
536
|
}
|
|
537
|
+
function createBaseSystemIoRequest() {
|
|
538
|
+
return {};
|
|
539
|
+
}
|
|
540
|
+
exports.SystemIoRequest = {
|
|
541
|
+
encode(_, writer = new wire_1.BinaryWriter()) {
|
|
542
|
+
return writer;
|
|
543
|
+
},
|
|
544
|
+
decode(input, length) {
|
|
545
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
546
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
547
|
+
const message = createBaseSystemIoRequest();
|
|
548
|
+
while (reader.pos < end) {
|
|
549
|
+
const tag = reader.uint32();
|
|
550
|
+
switch (tag >>> 3) {
|
|
551
|
+
}
|
|
552
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
553
|
+
break;
|
|
554
|
+
}
|
|
555
|
+
reader.skip(tag & 7);
|
|
556
|
+
}
|
|
557
|
+
return message;
|
|
558
|
+
},
|
|
559
|
+
fromJSON(_) {
|
|
560
|
+
return {};
|
|
561
|
+
},
|
|
562
|
+
toJSON(_) {
|
|
563
|
+
const obj = {};
|
|
564
|
+
return obj;
|
|
565
|
+
},
|
|
566
|
+
create(base) {
|
|
567
|
+
return exports.SystemIoRequest.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
568
|
+
},
|
|
569
|
+
fromPartial(_) {
|
|
570
|
+
const message = createBaseSystemIoRequest();
|
|
571
|
+
return message;
|
|
572
|
+
},
|
|
573
|
+
};
|
|
574
|
+
function createBaseSystemIoResponse() {
|
|
575
|
+
return { cost: 0, records: 0, ios: [] };
|
|
576
|
+
}
|
|
577
|
+
exports.SystemIoResponse = {
|
|
578
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
579
|
+
if (message.cost !== 0) {
|
|
580
|
+
writer.uint32(8).uint32(message.cost);
|
|
581
|
+
}
|
|
582
|
+
if (message.records !== 0) {
|
|
583
|
+
writer.uint32(16).uint32(message.records);
|
|
584
|
+
}
|
|
585
|
+
for (const v of message.ios) {
|
|
586
|
+
models_1.SystemIo.encode(v, writer.uint32(26).fork()).join();
|
|
587
|
+
}
|
|
588
|
+
return writer;
|
|
589
|
+
},
|
|
590
|
+
decode(input, length) {
|
|
591
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
592
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
593
|
+
const message = createBaseSystemIoResponse();
|
|
594
|
+
while (reader.pos < end) {
|
|
595
|
+
const tag = reader.uint32();
|
|
596
|
+
switch (tag >>> 3) {
|
|
597
|
+
case 1: {
|
|
598
|
+
if (tag !== 8) {
|
|
599
|
+
break;
|
|
600
|
+
}
|
|
601
|
+
message.cost = reader.uint32();
|
|
602
|
+
continue;
|
|
603
|
+
}
|
|
604
|
+
case 2: {
|
|
605
|
+
if (tag !== 16) {
|
|
606
|
+
break;
|
|
607
|
+
}
|
|
608
|
+
message.records = reader.uint32();
|
|
609
|
+
continue;
|
|
610
|
+
}
|
|
611
|
+
case 3: {
|
|
612
|
+
if (tag !== 26) {
|
|
613
|
+
break;
|
|
614
|
+
}
|
|
615
|
+
message.ios.push(models_1.SystemIo.decode(reader, reader.uint32()));
|
|
616
|
+
continue;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
620
|
+
break;
|
|
621
|
+
}
|
|
622
|
+
reader.skip(tag & 7);
|
|
623
|
+
}
|
|
624
|
+
return message;
|
|
625
|
+
},
|
|
626
|
+
fromJSON(object) {
|
|
627
|
+
return {
|
|
628
|
+
cost: isSet(object.cost) ? globalThis.Number(object.cost) : 0,
|
|
629
|
+
records: isSet(object.records) ? globalThis.Number(object.records) : 0,
|
|
630
|
+
ios: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.ios) ? object.ios.map((e) => models_1.SystemIo.fromJSON(e)) : [],
|
|
631
|
+
};
|
|
632
|
+
},
|
|
633
|
+
toJSON(message) {
|
|
634
|
+
var _a;
|
|
635
|
+
const obj = {};
|
|
636
|
+
if (message.cost !== 0) {
|
|
637
|
+
obj.cost = Math.round(message.cost);
|
|
638
|
+
}
|
|
639
|
+
if (message.records !== 0) {
|
|
640
|
+
obj.records = Math.round(message.records);
|
|
641
|
+
}
|
|
642
|
+
if ((_a = message.ios) === null || _a === void 0 ? void 0 : _a.length) {
|
|
643
|
+
obj.ios = message.ios.map((e) => models_1.SystemIo.toJSON(e));
|
|
644
|
+
}
|
|
645
|
+
return obj;
|
|
646
|
+
},
|
|
647
|
+
create(base) {
|
|
648
|
+
return exports.SystemIoResponse.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
649
|
+
},
|
|
650
|
+
fromPartial(object) {
|
|
651
|
+
var _a, _b, _c;
|
|
652
|
+
const message = createBaseSystemIoResponse();
|
|
653
|
+
message.cost = (_a = object.cost) !== null && _a !== void 0 ? _a : 0;
|
|
654
|
+
message.records = (_b = object.records) !== null && _b !== void 0 ? _b : 0;
|
|
655
|
+
message.ios = ((_c = object.ios) === null || _c === void 0 ? void 0 : _c.map((e) => models_1.SystemIo.fromPartial(e))) || [];
|
|
656
|
+
return message;
|
|
657
|
+
},
|
|
658
|
+
};
|
|
535
659
|
function createBaseChartRequest() {
|
|
536
660
|
return { deviceIds: [], ios: [], startedAt: undefined, finishedAt: undefined };
|
|
537
661
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { AreaSummaryReviewRequest, AreaSummaryReviewResponse, ChartRequest, ChartResponse, CommandHistoryRequest, CommandHistoryResponse, DashboardIndividualRequest, DashboardIndividualResponse, DeviceDataRequest, DeviceDataResponse, LogRequest, LogResponse, RouteReviewRequest, RouteReviewResponse, RouteStopRequest, RouteStopResponse, TripPerformanceRequest, TripPerformanceResponse, TripReportRequest, TripReportResponse, WorkCycleRequest, WorkCycleResponse } from "./fatehan/reports/report";
|
|
1
|
+
import { AreaSummaryReviewRequest, AreaSummaryReviewResponse, ChartRequest, ChartResponse, CommandHistoryRequest, CommandHistoryResponse, DashboardIndividualRequest, DashboardIndividualResponse, DeviceDataRequest, DeviceDataResponse, LogRequest, LogResponse, RouteReviewRequest, RouteReviewResponse, RouteStopRequest, RouteStopResponse, SystemIoRequest, SystemIoResponse, TripPerformanceRequest, TripPerformanceResponse, TripReportRequest, TripReportResponse, WorkCycleRequest, WorkCycleResponse } from "./fatehan/reports/report";
|
|
2
|
+
import { DeviceIo, ShownIo, SystemIo } from "./fatehan/models/models";
|
|
3
|
+
import { Data } from "./fatehan/packets/dataModel";
|
|
2
4
|
export declare class ReportService {
|
|
3
5
|
private readonly url;
|
|
4
6
|
private readonly namespace;
|
|
@@ -15,5 +17,8 @@ export declare class ReportService {
|
|
|
15
17
|
WorkCycleReport(request: WorkCycleRequest): Promise<WorkCycleResponse>;
|
|
16
18
|
CommandHistoryReport(request: CommandHistoryRequest): Promise<CommandHistoryResponse>;
|
|
17
19
|
ChartReport(request: ChartRequest, responses: (chunk: ChartResponse) => void): Promise<void>;
|
|
20
|
+
SystemIoReport(request: SystemIoRequest): Promise<SystemIoResponse>;
|
|
21
|
+
SystemIoCast(systemIo: SystemIo[], deviceIo: DeviceIo[], data: Data): Promise<ShownIo[]>;
|
|
22
|
+
Matin(): Promise<void>;
|
|
18
23
|
}
|
|
19
24
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,YAAY,EACZ,aAAa,EACb,qBAAqB,EACrB,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,EAC3B,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEtE,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAInD,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA+C;IACzE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;gBAE1B,GAAG,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM;IAcjE,eAAe,CACpB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC;IAyBtB,qBAAqB,CAC1B,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,uBAAuB,CAAC;IAyB5B,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAyBnE,iBAAiB,CACtB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,mBAAmB,CAAC;IAyBxB,mBAAmB,CACxB,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,2BAA2B,CAAC;IAyBhC,SAAS,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC;IAuBpD,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAyBnE,uBAAuB,CAC5B,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,yBAAyB,CAAC;IAwB9B,eAAe,CACpB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC;IAwBtB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAmB/E,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI;IAiClF,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA6B7D,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAgBxF,KAAK;CAGnB"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.ReportService = void 0;
|
|
4
7
|
const report_1 = require("./fatehan/reports/report");
|
|
8
|
+
const system_io_1 = require("./store/system.io");
|
|
9
|
+
const system_io_2 = __importDefault(require("./system.io"));
|
|
5
10
|
class ReportService {
|
|
6
11
|
constructor(url, authorization, organizationId) {
|
|
7
12
|
this.namespace = "com.fatehan.reports.ReportService";
|
|
@@ -196,6 +201,48 @@ class ReportService {
|
|
|
196
201
|
}
|
|
197
202
|
}
|
|
198
203
|
}
|
|
199
|
-
|
|
204
|
+
SystemIoReport(request) {
|
|
205
|
+
return new Promise(async (resolve, reject) => {
|
|
206
|
+
let systemIo = (0, system_io_1.getSystemIoCache)();
|
|
207
|
+
if (systemIo != null) {
|
|
208
|
+
resolve({
|
|
209
|
+
cost: 0,
|
|
210
|
+
ios: systemIo,
|
|
211
|
+
records: systemIo.length,
|
|
212
|
+
});
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
const response = await fetch(`${this.url}/${this.namespace}/SystemIoReport`, {
|
|
216
|
+
method: "POST",
|
|
217
|
+
headers: this.headers,
|
|
218
|
+
body: report_1.SystemIoRequest.encode(request).finish(),
|
|
219
|
+
});
|
|
220
|
+
if (response.ok) {
|
|
221
|
+
let systemIo = report_1.SystemIoResponse.decode(new Uint8Array(await response.arrayBuffer()));
|
|
222
|
+
(0, system_io_1.setSystemIoCache)(systemIo.ios);
|
|
223
|
+
resolve(systemIo);
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
reject(await response.text());
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
async SystemIoCast(systemIo, deviceIo, data) {
|
|
231
|
+
return new Promise(async (resolve) => {
|
|
232
|
+
if (systemIo == null) {
|
|
233
|
+
let result = await this.SystemIoReport({});
|
|
234
|
+
if (result == null || result.ios == null || result.ios.length == 0) {
|
|
235
|
+
resolve([]);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
systemIo = result.ios;
|
|
239
|
+
}
|
|
240
|
+
resolve((0, system_io_2.default)(systemIo, deviceIo, data));
|
|
241
|
+
return;
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
async Matin() {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
200
247
|
}
|
|
201
248
|
exports.ReportService = ReportService;
|
package/dist/index.test.js
CHANGED
|
@@ -7,10 +7,12 @@ const vitest_1 = require("vitest");
|
|
|
7
7
|
const index_1 = require("./index");
|
|
8
8
|
const report_1 = require("./fatehan/reports/report");
|
|
9
9
|
const long_1 = __importDefault(require("long"));
|
|
10
|
+
const models_1 = require("./fatehan/models/models");
|
|
11
|
+
const system_io_1 = __importDefault(require("./system.io"));
|
|
10
12
|
(0, vitest_1.describe)("ReportService", () => {
|
|
11
13
|
let url = "http://report.myavl.ir:1272";
|
|
12
|
-
let token = "
|
|
13
|
-
let organization = "
|
|
14
|
+
let token = "5|gvRWOzVBVN3a6Q7iajws2uV9TEVELEK81H3RCpzO85369b27";
|
|
15
|
+
let organization = "1000001";
|
|
14
16
|
let c = new index_1.ReportService(url, token, organization);
|
|
15
17
|
(0, vitest_1.it)("TripPerformanceReport", async () => {
|
|
16
18
|
let res = await c.TripPerformanceReport({
|
|
@@ -33,7 +35,7 @@ const long_1 = __importDefault(require("long"));
|
|
|
33
35
|
});
|
|
34
36
|
(0, vitest_1.it)("RouteReviewReport", async () => {
|
|
35
37
|
let res = await c.RouteReviewReport({
|
|
36
|
-
deviceId: long_1.default.fromInt(
|
|
38
|
+
deviceId: long_1.default.fromInt(7744),
|
|
37
39
|
startedAt: new Date("2025-04-01 00:00:00"),
|
|
38
40
|
finishedAt: new Date("2025-04-22 00:00:00"),
|
|
39
41
|
includeTrip: true,
|
|
@@ -73,6 +75,10 @@ const long_1 = __importDefault(require("long"));
|
|
|
73
75
|
});
|
|
74
76
|
console.log("AreaSummaryReviewReport", res);
|
|
75
77
|
});
|
|
78
|
+
(0, vitest_1.it)("SystemIoReport", async () => {
|
|
79
|
+
let res = await c.SystemIoReport({});
|
|
80
|
+
console.log("SystemIoReport", res);
|
|
81
|
+
});
|
|
76
82
|
(0, vitest_1.it)("WorkCycleReport", async () => {
|
|
77
83
|
let res = await c.WorkCycleReport({
|
|
78
84
|
areaStopSeconds: 10,
|
|
@@ -93,4 +99,282 @@ const long_1 = __importDefault(require("long"));
|
|
|
93
99
|
console.log(report_1.ChartResponse.toJSON(chunk));
|
|
94
100
|
});
|
|
95
101
|
});
|
|
102
|
+
(0, vitest_1.it)("Io", async () => {
|
|
103
|
+
let devIo = {
|
|
104
|
+
formula: "($speed / 3.6)",
|
|
105
|
+
name: "سرعت",
|
|
106
|
+
type: models_1.SystemIoType.FLOAT,
|
|
107
|
+
activeStyle: {
|
|
108
|
+
color: "#3a3a3a",
|
|
109
|
+
name: "سرعت"
|
|
110
|
+
},
|
|
111
|
+
inactiveStyle: {
|
|
112
|
+
color: '#a3a3a3',
|
|
113
|
+
name: "سرعت"
|
|
114
|
+
},
|
|
115
|
+
description: "سرعت خودرو",
|
|
116
|
+
unit: "m/h",
|
|
117
|
+
deviceId: long_1.default.fromNumber(7744),
|
|
118
|
+
organizationId: long_1.default.fromNumber(7744),
|
|
119
|
+
id: long_1.default.fromNumber(1),
|
|
120
|
+
};
|
|
121
|
+
let systemIos = await c.SystemIoReport({});
|
|
122
|
+
let result = (0, system_io_1.default)(systemIos.ios, [devIo], {
|
|
123
|
+
deviceId: long_1.default.fromNumber(7744),
|
|
124
|
+
gpsTime: new Date("2025-04-21T09:06:06.000Z"),
|
|
125
|
+
latitude: 32.61252975463867,
|
|
126
|
+
longitude: 51.60394287109375,
|
|
127
|
+
altitude: 1634,
|
|
128
|
+
angle: 319,
|
|
129
|
+
speed: 38,
|
|
130
|
+
satellite: 20,
|
|
131
|
+
ignition: true,
|
|
132
|
+
mileage: long_1.default.fromNumber(64438820),
|
|
133
|
+
compact: {
|
|
134
|
+
ioElement: {
|
|
135
|
+
gsm: 100,
|
|
136
|
+
sleepMode: 0,
|
|
137
|
+
gnss: 1,
|
|
138
|
+
pdop: undefined,
|
|
139
|
+
hdop: 6,
|
|
140
|
+
externalVoltage: 13837,
|
|
141
|
+
cellId: 27760,
|
|
142
|
+
areaCode: 12540,
|
|
143
|
+
batteryVoltage: 4097,
|
|
144
|
+
batteryCurrent: long_1.default.fromNumber(0),
|
|
145
|
+
batteryPercent: 97,
|
|
146
|
+
operatorCode: 43235,
|
|
147
|
+
tripOdometer: 10,
|
|
148
|
+
ai1: 0,
|
|
149
|
+
ai2: undefined,
|
|
150
|
+
ai3: undefined,
|
|
151
|
+
ai4: undefined,
|
|
152
|
+
di1: true,
|
|
153
|
+
di2: undefined,
|
|
154
|
+
di3: undefined,
|
|
155
|
+
di4: undefined,
|
|
156
|
+
do1: false,
|
|
157
|
+
do2: undefined,
|
|
158
|
+
do3: undefined,
|
|
159
|
+
do4: undefined,
|
|
160
|
+
fuelRateGps: 787,
|
|
161
|
+
fuelUsedGps: 2181327,
|
|
162
|
+
axisX: -192,
|
|
163
|
+
axisY: 317,
|
|
164
|
+
axisZ: -60,
|
|
165
|
+
iccId: long_1.default.fromNumber(408497408),
|
|
166
|
+
sdStatus: undefined,
|
|
167
|
+
iButton: undefined,
|
|
168
|
+
dallas: undefined,
|
|
169
|
+
lls: undefined,
|
|
170
|
+
eye: undefined,
|
|
171
|
+
ble: undefined,
|
|
172
|
+
driver: undefined,
|
|
173
|
+
msp500: undefined,
|
|
174
|
+
rfid: undefined,
|
|
175
|
+
ecoScore: undefined,
|
|
176
|
+
networkType: undefined,
|
|
177
|
+
pulseCounterDin1: undefined,
|
|
178
|
+
pulseCounterDin2: undefined,
|
|
179
|
+
btStatus: undefined,
|
|
180
|
+
barcodeId: undefined,
|
|
181
|
+
instantMovement: undefined,
|
|
182
|
+
ul20202SensorFuelLevel: undefined,
|
|
183
|
+
ul20202SensorStatus: undefined,
|
|
184
|
+
groundSense: undefined,
|
|
185
|
+
iso6709Coordinates: undefined,
|
|
186
|
+
umtsLteCellId: undefined,
|
|
187
|
+
ainSpeed: undefined,
|
|
188
|
+
wakeReason: undefined,
|
|
189
|
+
axlCalibrationStatus: undefined,
|
|
190
|
+
frequencyDin1: undefined,
|
|
191
|
+
frequencyDin2: undefined,
|
|
192
|
+
ignition: undefined,
|
|
193
|
+
idling: false,
|
|
194
|
+
towing: false,
|
|
195
|
+
unplug: false,
|
|
196
|
+
jamming: false,
|
|
197
|
+
movement: true,
|
|
198
|
+
dataMode: 1,
|
|
199
|
+
speed: 38,
|
|
200
|
+
temperature: undefined,
|
|
201
|
+
slopeX: undefined,
|
|
202
|
+
slopeY: undefined,
|
|
203
|
+
slopeZ: undefined,
|
|
204
|
+
humidity: undefined,
|
|
205
|
+
fuelFlow: undefined,
|
|
206
|
+
doorCar: undefined,
|
|
207
|
+
realtime: undefined,
|
|
208
|
+
positioning: undefined,
|
|
209
|
+
adminPhoneNumber: undefined,
|
|
210
|
+
fuelCounter: undefined,
|
|
211
|
+
impulseFrequency1: undefined,
|
|
212
|
+
impulseCounter1: undefined,
|
|
213
|
+
impulseRpm1: undefined,
|
|
214
|
+
impulseFrequency2: undefined,
|
|
215
|
+
impulseCounter2: undefined,
|
|
216
|
+
impulseRpm2: undefined,
|
|
217
|
+
impulseFrequency3: undefined,
|
|
218
|
+
impulseCounter3: undefined,
|
|
219
|
+
impulseRpm3: undefined,
|
|
220
|
+
impulseFrequency4: undefined,
|
|
221
|
+
impulseCounter4: undefined,
|
|
222
|
+
impulseRpm4: undefined,
|
|
223
|
+
numberOfData: undefined,
|
|
224
|
+
rfidCom2: undefined,
|
|
225
|
+
imsi: undefined,
|
|
226
|
+
ultrasonicFuelLevel1: undefined,
|
|
227
|
+
ultrasonicFuelLevel2: undefined,
|
|
228
|
+
ultrasonicSoftwareStatus1: undefined,
|
|
229
|
+
ultrasonicSoftwareStatus2: undefined,
|
|
230
|
+
oneWireHumidity1: undefined,
|
|
231
|
+
oneWireHumidity2: undefined,
|
|
232
|
+
oneWireHumidity3: undefined,
|
|
233
|
+
oneWireHumidity4: undefined,
|
|
234
|
+
oneWireHumidity5: undefined,
|
|
235
|
+
oneWireHumidity6: undefined,
|
|
236
|
+
imei: undefined,
|
|
237
|
+
noSimCounter: undefined,
|
|
238
|
+
connectivityQuality: undefined,
|
|
239
|
+
},
|
|
240
|
+
eventualIoElements: {
|
|
241
|
+
geoFenceZone01: undefined,
|
|
242
|
+
geoFenceZone02: undefined,
|
|
243
|
+
geoFenceZone03: undefined,
|
|
244
|
+
geoFenceZone04: undefined,
|
|
245
|
+
geoFenceZone05: undefined,
|
|
246
|
+
geoFenceZone06: undefined,
|
|
247
|
+
geoFenceZone07: undefined,
|
|
248
|
+
geoFenceZone08: undefined,
|
|
249
|
+
geoFenceZone09: undefined,
|
|
250
|
+
geoFenceZone10: undefined,
|
|
251
|
+
geoFenceZone11: undefined,
|
|
252
|
+
geoFenceZone12: undefined,
|
|
253
|
+
geoFenceZone13: undefined,
|
|
254
|
+
geoFenceZone14: undefined,
|
|
255
|
+
geoFenceZone15: undefined,
|
|
256
|
+
geoFenceZone16: undefined,
|
|
257
|
+
geoFenceZone17: undefined,
|
|
258
|
+
geoFenceZone18: undefined,
|
|
259
|
+
geoFenceZone19: undefined,
|
|
260
|
+
geoFenceZone20: undefined,
|
|
261
|
+
geoFenceZone21: undefined,
|
|
262
|
+
geoFenceZone22: undefined,
|
|
263
|
+
geoFenceZone23: undefined,
|
|
264
|
+
geoFenceZone24: undefined,
|
|
265
|
+
geoFenceZone25: undefined,
|
|
266
|
+
geoFenceZone26: undefined,
|
|
267
|
+
geoFenceZone27: undefined,
|
|
268
|
+
geoFenceZone28: undefined,
|
|
269
|
+
geoFenceZone29: undefined,
|
|
270
|
+
geoFenceZone30: undefined,
|
|
271
|
+
geoFenceZone31: undefined,
|
|
272
|
+
geoFenceZone32: undefined,
|
|
273
|
+
geoFenceZone33: undefined,
|
|
274
|
+
geoFenceZone34: undefined,
|
|
275
|
+
geoFenceZone35: undefined,
|
|
276
|
+
geoFenceZone36: undefined,
|
|
277
|
+
geoFenceZone37: undefined,
|
|
278
|
+
geoFenceZone38: undefined,
|
|
279
|
+
geoFenceZone39: undefined,
|
|
280
|
+
geoFenceZone40: undefined,
|
|
281
|
+
geoFenceZone41: undefined,
|
|
282
|
+
geoFenceZone42: undefined,
|
|
283
|
+
geoFenceZone43: undefined,
|
|
284
|
+
geoFenceZone44: undefined,
|
|
285
|
+
geoFenceZone45: undefined,
|
|
286
|
+
geoFenceZone46: undefined,
|
|
287
|
+
geoFenceZone47: undefined,
|
|
288
|
+
geoFenceZone48: undefined,
|
|
289
|
+
geoFenceZone49: undefined,
|
|
290
|
+
geoFenceZone50: undefined,
|
|
291
|
+
greenDrivingType: undefined,
|
|
292
|
+
greenDrivingValue: undefined,
|
|
293
|
+
crashDetection: undefined,
|
|
294
|
+
immobilizer: undefined,
|
|
295
|
+
iccId2: long_1.default.fromNumber(1871890036),
|
|
296
|
+
greenDrivingEventDuration: undefined,
|
|
297
|
+
alarm: undefined,
|
|
298
|
+
ecoMaximum: undefined,
|
|
299
|
+
ecoAverage: undefined,
|
|
300
|
+
ecoDuration: undefined,
|
|
301
|
+
drivingState: undefined,
|
|
302
|
+
drivingRecords: undefined,
|
|
303
|
+
crashEventCounter: undefined,
|
|
304
|
+
gnssJamming: undefined,
|
|
305
|
+
privateMode: undefined,
|
|
306
|
+
ignitionOnCounter: undefined,
|
|
307
|
+
motorcycleFallDetection: undefined,
|
|
308
|
+
trip: undefined,
|
|
309
|
+
overSpeeding: undefined,
|
|
310
|
+
crashTraceData: undefined,
|
|
311
|
+
bloodAlcoholContent: undefined,
|
|
312
|
+
autoGeoFence: undefined,
|
|
313
|
+
iccId3: undefined,
|
|
314
|
+
geoFenceZone51: undefined,
|
|
315
|
+
geoFenceZone52: undefined,
|
|
316
|
+
geoFenceZone53: undefined,
|
|
317
|
+
geoFenceZone54: undefined,
|
|
318
|
+
geoFenceZone55: undefined,
|
|
319
|
+
geoFenceZone56: undefined,
|
|
320
|
+
geoFenceZone57: undefined,
|
|
321
|
+
geoFenceZone58: undefined,
|
|
322
|
+
geoFenceZone59: undefined,
|
|
323
|
+
geoFenceZone60: undefined,
|
|
324
|
+
geoFenceZone61: undefined,
|
|
325
|
+
geoFenceZone62: undefined,
|
|
326
|
+
geoFenceZone63: undefined,
|
|
327
|
+
geoFenceZone64: undefined,
|
|
328
|
+
geoFenceZone65: undefined,
|
|
329
|
+
geoFenceZone66: undefined,
|
|
330
|
+
geoFenceZone67: undefined,
|
|
331
|
+
geoFenceZone68: undefined,
|
|
332
|
+
geoFenceZone69: undefined,
|
|
333
|
+
geoFenceZone70: undefined,
|
|
334
|
+
geoFenceZone71: undefined,
|
|
335
|
+
geoFenceZone72: undefined,
|
|
336
|
+
geoFenceZone73: undefined,
|
|
337
|
+
geoFenceZone74: undefined,
|
|
338
|
+
geoFenceZone75: undefined,
|
|
339
|
+
geoFenceZone76: undefined,
|
|
340
|
+
geoFenceZone77: undefined,
|
|
341
|
+
geoFenceZone78: undefined,
|
|
342
|
+
geoFenceZone79: undefined,
|
|
343
|
+
geoFenceZone80: undefined,
|
|
344
|
+
geoFenceZone81: undefined,
|
|
345
|
+
geoFenceZone82: undefined,
|
|
346
|
+
geoFenceZone83: undefined,
|
|
347
|
+
geoFenceZone84: undefined,
|
|
348
|
+
geoFenceZone85: undefined,
|
|
349
|
+
geoFenceZone86: undefined,
|
|
350
|
+
geoFenceZone87: undefined,
|
|
351
|
+
geoFenceZone88: undefined,
|
|
352
|
+
geoFenceZone89: undefined,
|
|
353
|
+
geoFenceZone90: undefined,
|
|
354
|
+
geoFenceZone91: undefined,
|
|
355
|
+
geoFenceZone92: undefined,
|
|
356
|
+
geoFenceZone93: undefined,
|
|
357
|
+
geoFenceZone94: undefined,
|
|
358
|
+
geoFenceZone95: undefined,
|
|
359
|
+
geoFenceZone96: undefined,
|
|
360
|
+
geoFenceZone97: undefined,
|
|
361
|
+
geoFenceZone98: undefined,
|
|
362
|
+
geoFenceZone99: undefined,
|
|
363
|
+
geoFenceZone100: undefined,
|
|
364
|
+
},
|
|
365
|
+
obdElements: undefined,
|
|
366
|
+
obdOemElements: undefined,
|
|
367
|
+
bleSensorsIoElements: undefined,
|
|
368
|
+
canAdaptersElements: undefined,
|
|
369
|
+
alerts: [
|
|
370
|
+
0,
|
|
371
|
+
],
|
|
372
|
+
alertValues: {},
|
|
373
|
+
adas: undefined,
|
|
374
|
+
fms: undefined,
|
|
375
|
+
unknownIos: {},
|
|
376
|
+
},
|
|
377
|
+
});
|
|
378
|
+
console.log(result);
|
|
379
|
+
});
|
|
96
380
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.io.d.ts","sourceRoot":"","sources":["../../src/store/system.io.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAIpD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,QAEhD;AAED,wBAAgB,gBAAgB,IAAI,QAAQ,EAAE,CAE7C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setSystemIoCache = setSystemIoCache;
|
|
4
|
+
exports.getSystemIoCache = getSystemIoCache;
|
|
5
|
+
let ios;
|
|
6
|
+
function setSystemIoCache(data) {
|
|
7
|
+
ios = data;
|
|
8
|
+
}
|
|
9
|
+
function getSystemIoCache() {
|
|
10
|
+
return ios;
|
|
11
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DeviceIo, ShownIo, SystemIo } from "./fatehan/models/models";
|
|
2
|
+
import { Data } from "./fatehan/packets/dataModel";
|
|
3
|
+
declare const SystemIoCast: (systemIo: SystemIo[], deviceIo: DeviceIo[], data: Data) => ShownIo[];
|
|
4
|
+
export default SystemIoCast;
|
|
5
|
+
//# sourceMappingURL=system.io.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.io.d.ts","sourceRoot":"","sources":["../src/system.io.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAA;AAElD,QAAA,MAAM,YAAY,GACd,UAAU,QAAQ,EAAE,EACpB,UAAU,QAAQ,EAAE,EACpB,MAAM,IAAI,KACX,OAAO,EA4CT,CAAA;AAuBD,eAAe,YAAY,CAAA"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const SystemIoCast = (systemIo, deviceIo, data) => {
|
|
4
|
+
let list = [];
|
|
5
|
+
for (let i = 0; i < systemIo.length; i++) {
|
|
6
|
+
const value = getNestedPropertyValue(data, systemIo[i].key);
|
|
7
|
+
if (value != null) {
|
|
8
|
+
list.push({
|
|
9
|
+
value: value,
|
|
10
|
+
name: systemIo[i].name,
|
|
11
|
+
unit: systemIo[i].unit,
|
|
12
|
+
style: systemIo[i].activeStyle,
|
|
13
|
+
description: systemIo[i].description,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
for (let i = 0; i < deviceIo.length; i++) {
|
|
18
|
+
let items = extractVariables(deviceIo[i].formula);
|
|
19
|
+
let formula = deviceIo[i].formula;
|
|
20
|
+
let hasIos = true;
|
|
21
|
+
for (let i = 0; i < items.length; i++) {
|
|
22
|
+
const value = getNestedPropertyValue(data, items[i]);
|
|
23
|
+
if (value == null) {
|
|
24
|
+
hasIos = false;
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
formula = formula.replace(new RegExp("\\$" + items[i], 'g'), value);
|
|
28
|
+
}
|
|
29
|
+
if (!hasIos) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
list.push({
|
|
33
|
+
value: eval(formula),
|
|
34
|
+
name: deviceIo[i].name,
|
|
35
|
+
unit: deviceIo[i].unit,
|
|
36
|
+
style: deviceIo[i].activeStyle,
|
|
37
|
+
description: deviceIo[i].description,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return list;
|
|
41
|
+
};
|
|
42
|
+
function extractVariables(str) {
|
|
43
|
+
const matches = str.match(/\$(\w+(?:\.\w+)*)/g);
|
|
44
|
+
if (!matches)
|
|
45
|
+
return [];
|
|
46
|
+
return matches.map(match => match.substring(1));
|
|
47
|
+
}
|
|
48
|
+
function getNestedPropertyValue(obj, propertyPath) {
|
|
49
|
+
const properties = propertyPath.split('.');
|
|
50
|
+
let currentObj = obj;
|
|
51
|
+
for (const property of properties) {
|
|
52
|
+
if (!Object.prototype.hasOwnProperty.call(currentObj, property)) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
currentObj = currentObj[property];
|
|
56
|
+
if (currentObj === null || currentObj === undefined) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return String(currentObj);
|
|
61
|
+
}
|
|
62
|
+
exports.default = SystemIoCast;
|