skyeye-sdk-js 1.4.14 → 1.4.16
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/src/SkyEyeClient.d.ts +1 -1
- package/dist/src/SkyEyeClient.js +15 -7
- package/dist/test.js +8 -40
- package/package.json +5 -3
- package/src/SkyEyeClient.ts +15 -7
- package/src/proto/line_chart.proto +25 -0
- package/src/proto/line_chart_grpc_pb.js +1 -0
- package/src/proto/line_chart_pb.js +681 -0
- package/src/proto/protoc.bat +3 -3
- package/src/proto/skyeye_rpc_grpc_pb.js +99 -99
- package/src/proto/skyeye_rpc_pb.js +328 -328
- package/test.ts +9 -47
- package/dist/src/proto/protoc.bat +0 -37
- package/dist/src/proto/protoc.sh +0 -32
- package/dist/src/proto/skyeye_rpc.proto +0 -16
- package/dist/src/proto/skyeye_rpc_grpc_pb.js +0 -99
- package/dist/src/proto/skyeye_rpc_pb.d.ts +0 -47
- package/dist/src/proto/skyeye_rpc_pb.js +0 -328
- package/dist/src/proto/tsconfig.json +0 -118
|
@@ -91,7 +91,7 @@ export declare class SkyEyeClient extends JSONTransmissionClient {
|
|
|
91
91
|
getPort(): string;
|
|
92
92
|
initSkyEyeAndRun(pathSkyEye: string, fileName: string, port: string, skyeyeDir: string): void;
|
|
93
93
|
private childProcess;
|
|
94
|
-
initSkyEyeAndRun2(pathSkyEye: string, fileName: string, port: string, skyeyeDir: string): Promise<boolean>;
|
|
94
|
+
initSkyEyeAndRun2(pathSkyEye: string, fileName: string, port: string, skyeyeDir: string, disableRun?: boolean): Promise<boolean>;
|
|
95
95
|
private checkModule;
|
|
96
96
|
private checkState;
|
|
97
97
|
private startSkyEye;
|
package/dist/src/SkyEyeClient.js
CHANGED
|
@@ -59,6 +59,12 @@ const cp = __importStar(require("child_process"));
|
|
|
59
59
|
const BaseResponse_1 = require("./response/BaseResponse");
|
|
60
60
|
const GetAddressWidthResponse_1 = require("./response/GetAddressWidthResponse");
|
|
61
61
|
const GetFaultInjectListResponse2_1 = require("./response/GetFaultInjectListResponse2");
|
|
62
|
+
const JSONbig = require('json-bigint')({
|
|
63
|
+
// 建议配置此项,将大数字存储为字符串,避免后续操作中的潜在问题
|
|
64
|
+
storeAsString: true
|
|
65
|
+
// 或者使用 'strict' 模式将其解析为 BigInt 类型 (ES2020)
|
|
66
|
+
// useNativeBigInt: true
|
|
67
|
+
});
|
|
62
68
|
let client = null;
|
|
63
69
|
// ----------------------------当前运行程序的设备树----------------------------------------//
|
|
64
70
|
const boardMap = new Map();
|
|
@@ -158,7 +164,7 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
|
|
|
158
164
|
});
|
|
159
165
|
// const res = JSON.parse(response.toString());
|
|
160
166
|
// console.log("res:",res)
|
|
161
|
-
const ackObj =
|
|
167
|
+
const ackObj = JSONbig.parse(response.toString()).ack;
|
|
162
168
|
// this.printResponseLog(ackObj)
|
|
163
169
|
if (ackObj.result === 'false')
|
|
164
170
|
ackObj.result = false;
|
|
@@ -1165,7 +1171,7 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
|
|
|
1165
1171
|
});
|
|
1166
1172
|
}, 2000);
|
|
1167
1173
|
}
|
|
1168
|
-
initSkyEyeAndRun2(pathSkyEye, fileName, port, skyeyeDir) {
|
|
1174
|
+
initSkyEyeAndRun2(pathSkyEye, fileName, port, skyeyeDir, disableRun) {
|
|
1169
1175
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1170
1176
|
try {
|
|
1171
1177
|
console.log('runExample');
|
|
@@ -1180,11 +1186,13 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
|
|
|
1180
1186
|
ackObj.result = false;
|
|
1181
1187
|
throw new Error(ackObj.error);
|
|
1182
1188
|
}
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
ackObj.result
|
|
1187
|
-
|
|
1189
|
+
if (!disableRun) {
|
|
1190
|
+
response = yield this.runScript(fileName, port);
|
|
1191
|
+
ackObj = JSON.parse(response.toString()).ack;
|
|
1192
|
+
if (ackObj.result === "false") {
|
|
1193
|
+
ackObj.result = false;
|
|
1194
|
+
throw new Error(ackObj.error);
|
|
1195
|
+
}
|
|
1188
1196
|
}
|
|
1189
1197
|
return true;
|
|
1190
1198
|
}
|
package/dist/test.js
CHANGED
|
@@ -17,7 +17,6 @@ var RegisterType;
|
|
|
17
17
|
RegisterType[RegisterType["CPU"] = 0] = "CPU";
|
|
18
18
|
RegisterType[RegisterType["Device"] = 1] = "Device";
|
|
19
19
|
})(RegisterType || (RegisterType = {}));
|
|
20
|
-
let call;
|
|
21
20
|
function test() {
|
|
22
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
22
|
// console.log("Connected to SkyEye server");
|
|
@@ -46,51 +45,20 @@ function test() {
|
|
|
46
45
|
// console.log("response:", response)
|
|
47
46
|
// console.log("response:", response.boardMap)
|
|
48
47
|
// console.log("response:", response.boardMap.keys[0])
|
|
48
|
+
// await client.initSkyEyeAndRun(pathSkyEye,fileName,port,skyeyeDir);
|
|
49
49
|
// const pathSkyEye = "D:/data/case/FMQL45T900_SylixOS";
|
|
50
50
|
// const fileName = "FMQL45T900_SylixOS.skyeye";
|
|
51
51
|
// const skyeyeDir = "D:/install/SkyEye/opt/skyeye/bin/skyeye.exe"
|
|
52
52
|
// const port = "50066"
|
|
53
|
-
const pathSkyEye = "
|
|
54
|
-
const fileName = "
|
|
55
|
-
const skyeyeDir = "
|
|
56
|
-
const port = "
|
|
57
|
-
// const client = await SkyEyeClientFactory.instance.createConnectedClient('127.0.0.1', port);
|
|
53
|
+
const pathSkyEye = "D:/data/case/c6713_timer_test";
|
|
54
|
+
const fileName = "c6k.skyeye";
|
|
55
|
+
const skyeyeDir = "D:/install/SkyEye/opt/skyeye/bin/skyeye.exe";
|
|
56
|
+
const port = "50053";
|
|
58
57
|
const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', port);
|
|
59
58
|
const t = yield client.initSkyEyeAndRun2(pathSkyEye, fileName, port, skyeyeDir);
|
|
60
|
-
|
|
61
|
-
const response = yield client.
|
|
62
|
-
console.log(response);
|
|
63
|
-
// await client.registerTimeMonitor({
|
|
64
|
-
// "id": "1",
|
|
65
|
-
// "time": 50,
|
|
66
|
-
// "cpu_name": "c67x_core_0",
|
|
67
|
-
// "direction":"recv",
|
|
68
|
-
// "cycle":-1,
|
|
69
|
-
// "items": [
|
|
70
|
-
// {
|
|
71
|
-
// "id": "cc5f450b-6fbb-7bb3-4544-e761a907b46d",
|
|
72
|
-
// "cpu_name": "c67x_core_0",
|
|
73
|
-
// "var_name": "int1",
|
|
74
|
-
// "var_type": "int",
|
|
75
|
-
// "var_bytes": 4,
|
|
76
|
-
// "type": "global",
|
|
77
|
-
// "value": "111"
|
|
78
|
-
// }
|
|
79
|
-
// ],
|
|
80
|
-
// })
|
|
81
|
-
// await client.startTimeMonitor("1")
|
|
82
|
-
// // await client.getTimeMonitorConfig()
|
|
83
|
-
// console.log('bbbbbbbbbbbb')
|
|
84
|
-
// call = client.timeDataReceive("1")
|
|
85
|
-
// call.on('data',(response)=> {
|
|
86
|
-
// const ackObj = response.getResponse();
|
|
87
|
-
// console.log(ackObj)
|
|
88
|
-
// })
|
|
89
|
-
// console.log('gggggggggggggg')
|
|
90
|
-
// console.log(call)
|
|
91
|
-
// await client.stopTimeMonitor()
|
|
92
|
-
// response = client.setBitValue('c67x_core_0', '0x1000','1', 8)
|
|
93
|
-
// console.log("response:", response)
|
|
59
|
+
client.runCommand();
|
|
60
|
+
const response = yield client.runToTime("c67x_core_0", "1");
|
|
61
|
+
console.log("response:", response);
|
|
94
62
|
// const responseCpuList = await client.getCpuList()
|
|
95
63
|
// console.log("responseCpuList:", responseCpuList)
|
|
96
64
|
// const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', 50056);
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skyeye-sdk-js",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.16",
|
|
4
4
|
"description": "gRPC to SkyEye",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
9
|
"build": "tsc",
|
|
10
|
-
"dev": "tsc & node dist/test.js",
|
|
10
|
+
"dev": "tsc & node --max-old-space-size=4096 dist/test.js",
|
|
11
11
|
"release": "tsc && npm publish"
|
|
12
12
|
},
|
|
13
13
|
"keywords": [],
|
|
@@ -25,8 +25,10 @@
|
|
|
25
25
|
"@grpc/grpc-js": "^1.10.4",
|
|
26
26
|
"async": "^1.5.2",
|
|
27
27
|
"google-protobuf": "^3.21.2",
|
|
28
|
+
"json-bigint": "^1.0.0",
|
|
28
29
|
"lodash": "^4.6.1",
|
|
29
30
|
"minimist": "^1.2.0",
|
|
30
|
-
"protobufjs": "^7.2.6"
|
|
31
|
+
"protobufjs": "^7.2.6",
|
|
32
|
+
"split2": "^4.2.0"
|
|
31
33
|
}
|
|
32
34
|
}
|
package/src/SkyEyeClient.ts
CHANGED
|
@@ -28,6 +28,12 @@ import { Board } from './models/Board';
|
|
|
28
28
|
import { BaseResponse } from './response/BaseResponse';
|
|
29
29
|
import { GetAddressWidthResponse } from './response/GetAddressWidthResponse';
|
|
30
30
|
import { GetFaultInjectListResponse2 } from './response/GetFaultInjectListResponse2';
|
|
31
|
+
const JSONbig = require('json-bigint')({
|
|
32
|
+
// 建议配置此项,将大数字存储为字符串,避免后续操作中的潜在问题
|
|
33
|
+
storeAsString: true
|
|
34
|
+
// 或者使用 'strict' 模式将其解析为 BigInt 类型 (ES2020)
|
|
35
|
+
// useNativeBigInt: true
|
|
36
|
+
});
|
|
31
37
|
let client: JSONTransmissionClient | any = null;
|
|
32
38
|
|
|
33
39
|
|
|
@@ -122,7 +128,7 @@ export class SkyEyeClient extends JSONTransmissionClient {
|
|
|
122
128
|
});
|
|
123
129
|
// const res = JSON.parse(response.toString());
|
|
124
130
|
// console.log("res:",res)
|
|
125
|
-
const ackObj =
|
|
131
|
+
const ackObj = JSONbig.parse(response.toString()).ack;
|
|
126
132
|
// this.printResponseLog(ackObj)
|
|
127
133
|
if (ackObj.result === 'false') ackObj.result = false
|
|
128
134
|
return ackObj;
|
|
@@ -1074,7 +1080,7 @@ export class SkyEyeClient extends JSONTransmissionClient {
|
|
|
1074
1080
|
|
|
1075
1081
|
private childProcess: cp.ChildProcess | null = null;
|
|
1076
1082
|
|
|
1077
|
-
public async initSkyEyeAndRun2(pathSkyEye: string, fileName: string, port: string, skyeyeDir: string) {
|
|
1083
|
+
public async initSkyEyeAndRun2(pathSkyEye: string, fileName: string, port: string, skyeyeDir: string, disableRun?: boolean) {
|
|
1078
1084
|
try {
|
|
1079
1085
|
console.log('runExample');
|
|
1080
1086
|
|
|
@@ -1089,11 +1095,13 @@ export class SkyEyeClient extends JSONTransmissionClient {
|
|
|
1089
1095
|
ackObj.result = false
|
|
1090
1096
|
throw new Error(ackObj.error)
|
|
1091
1097
|
}
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
ackObj.result
|
|
1096
|
-
|
|
1098
|
+
if (!disableRun) {
|
|
1099
|
+
response = await this.runScript(fileName, port);
|
|
1100
|
+
ackObj = JSON.parse(response.toString()).ack;
|
|
1101
|
+
if (ackObj.result === "false") {
|
|
1102
|
+
ackObj.result = false
|
|
1103
|
+
throw new Error(ackObj.error)
|
|
1104
|
+
}
|
|
1097
1105
|
}
|
|
1098
1106
|
return true;
|
|
1099
1107
|
} catch (error) {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
message Value {
|
|
4
|
+
string type = 1;
|
|
5
|
+
double doubleValue = 2;
|
|
6
|
+
int64 intValue = 3;
|
|
7
|
+
string stringValue = 4;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
message TimeData {
|
|
11
|
+
Value realTime = 1;
|
|
12
|
+
Value simulationTime = 2;
|
|
13
|
+
Value customTime = 3;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
message SeriesData {
|
|
17
|
+
string id = 1;
|
|
18
|
+
string name = 2;
|
|
19
|
+
repeated Value value = 3;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
message Series {
|
|
23
|
+
repeated SeriesData series = 1;
|
|
24
|
+
repeated TimeData time = 2;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// GENERATED CODE -- NO SERVICES IN PROTO
|