skyeye-sdk-js 1.3.9 → 1.4.1
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/RequestFactory.d.ts +3 -0
- package/dist/src/RequestFactory.js +26 -0
- package/dist/src/SkyEyeClient.d.ts +5 -0
- package/dist/src/SkyEyeClient.js +74 -2
- package/dist/src/response/RunToTimeResponse.d.ts +4 -0
- package/dist/src/response/RunToTimeResponse.js +10 -0
- package/dist/test.js +23 -380
- package/dist/test_backup1.d.ts +1 -0
- package/dist/test_backup1.js +303 -0
- package/package.json +1 -1
- package/src/RequestFactory.ts +30 -0
- package/src/SkyEyeClient.ts +79 -4
- package/src/response/RunToTimeResponse.ts +9 -0
- package/test.ts +30 -448
- package/test_backup1.ts +365 -0
- package/skyeye-sdk-js-1.3.6.tgz +0 -0
- package/skyeye-sdk-js-1.3.7.tgz +0 -0
- package/skyeye-sdk-js-1.3.8.tgz +0 -0
|
@@ -4,6 +4,7 @@ export declare class RequestFactory {
|
|
|
4
4
|
private static _instance;
|
|
5
5
|
private constructor();
|
|
6
6
|
static getInstance(): RequestFactory;
|
|
7
|
+
getModuleStatus(): JSONRequest;
|
|
7
8
|
getRunningStatus(): JSONRequest;
|
|
8
9
|
runScriptRequest(filename: string): JSONRequest;
|
|
9
10
|
runCommand(): JSONRequest;
|
|
@@ -18,6 +19,8 @@ export declare class RequestFactory {
|
|
|
18
19
|
getRunningDeviceInfo(): JSONRequest;
|
|
19
20
|
getSimulationTime(cpuName: string): JSONRequest;
|
|
20
21
|
getCurrentSimulationTime(): JSONRequest;
|
|
22
|
+
getCpuFreq(cpuName: string): JSONRequest;
|
|
23
|
+
runToTimeRequest(cpuName: string, time: string): JSONRequest;
|
|
21
24
|
getCurrentPC(cpuName: string): JSONRequest;
|
|
22
25
|
getCpuMips(cpuName: string): JSONRequest;
|
|
23
26
|
getGlobalVarValue(cpuName: string, varName: string, bytesNum: number, valueType: GlobalVarType): JSONRequest;
|
|
@@ -11,6 +11,13 @@ class RequestFactory {
|
|
|
11
11
|
}
|
|
12
12
|
return this._instance;
|
|
13
13
|
}
|
|
14
|
+
//判断模块是否完全加载成功
|
|
15
|
+
getModuleStatus() {
|
|
16
|
+
const baseRequest = new BaseRequest_1.BaseRequest("SE_get_modules_loaded_status");
|
|
17
|
+
const request = new skyeye_rpc_pb_1.JSONRequest();
|
|
18
|
+
request.setRequest(baseRequest.toJSONString());
|
|
19
|
+
return request;
|
|
20
|
+
}
|
|
14
21
|
getRunningStatus() {
|
|
15
22
|
const baseRequest = new BaseRequest_1.BaseRequest("SE_get_running_status");
|
|
16
23
|
const request = new skyeye_rpc_pb_1.JSONRequest();
|
|
@@ -120,6 +127,25 @@ class RequestFactory {
|
|
|
120
127
|
request.setRequest(baseRequest.toJSONString());
|
|
121
128
|
return request;
|
|
122
129
|
}
|
|
130
|
+
getCpuFreq(cpuName) {
|
|
131
|
+
const baseRequest = new BaseRequest_1.BaseRequest("SE_get_cpu_freq_hz");
|
|
132
|
+
const args = {};
|
|
133
|
+
args.cpuname = cpuName;
|
|
134
|
+
baseRequest.setArgs(args);
|
|
135
|
+
const request = new skyeye_rpc_pb_1.JSONRequest();
|
|
136
|
+
request.setRequest(baseRequest.toJSONString());
|
|
137
|
+
return request;
|
|
138
|
+
}
|
|
139
|
+
runToTimeRequest(cpuName, time) {
|
|
140
|
+
const baseRequest = new BaseRequest_1.BaseRequest("SE_run_to_time");
|
|
141
|
+
const args = {};
|
|
142
|
+
args.cpu_name = cpuName;
|
|
143
|
+
args.time_s = time;
|
|
144
|
+
baseRequest.setArgs(args);
|
|
145
|
+
const request = new skyeye_rpc_pb_1.JSONRequest();
|
|
146
|
+
request.setRequest(baseRequest.toJSONString());
|
|
147
|
+
return request;
|
|
148
|
+
}
|
|
123
149
|
getCurrentPC(cpuName) {
|
|
124
150
|
const baseRequest = new BaseRequest_1.BaseRequest("SE_get_current_pc");
|
|
125
151
|
const args = {};
|
|
@@ -14,6 +14,7 @@ import { FaultInjectItem } from './models/FaultInjectItem';
|
|
|
14
14
|
import { GetFaultInjectListResponse } from './response/GetFaultInjectListResponse';
|
|
15
15
|
import { GetDisassembleInfoResponse } from './response/GetDisassembleInfoResponse';
|
|
16
16
|
import { GetCpuRegisterInfoResponse } from './response/GetCpuRegisterInfoResponse';
|
|
17
|
+
import { BaseResponse } from './response/BaseResponse';
|
|
17
18
|
export declare class SkyEyeClient extends JSONTransmissionClient {
|
|
18
19
|
private host;
|
|
19
20
|
private port;
|
|
@@ -36,6 +37,8 @@ export declare class SkyEyeClient extends JSONTransmissionClient {
|
|
|
36
37
|
getSimulationTime(cpuName: string): Promise<any>;
|
|
37
38
|
getCurrentSimulationTime(): Promise<any>;
|
|
38
39
|
getDeviceList(): Promise<GetDeviceListResponse>;
|
|
40
|
+
runToTime(cpuName: string, time: string): Promise<any>;
|
|
41
|
+
getCpuFreq(cpuName: string): Promise<any>;
|
|
39
42
|
getPC(cpuName: string): Promise<any>;
|
|
40
43
|
getCurrentPC(): Promise<any>;
|
|
41
44
|
getCpuMips(cpuName: string): Promise<any>;
|
|
@@ -56,6 +59,7 @@ export declare class SkyEyeClient extends JSONTransmissionClient {
|
|
|
56
59
|
setCpuRegisterValue(boardName: string, cpuName: string, registerName: string, value: string): Promise<any>;
|
|
57
60
|
setDeviceRegisterValue(machName: string, deviceName: string, registerName: string, value: string): Promise<any>;
|
|
58
61
|
getDeviceTree(): Promise<GetDeviceTreeResponse>;
|
|
62
|
+
getModuleStatus(): Promise<BaseResponse>;
|
|
59
63
|
getCurrentRunningState(): Promise<GetRunningStateResponse>;
|
|
60
64
|
getAllDeviceInfo(): Promise<GetAllDeviceInfoResponse>;
|
|
61
65
|
getRamAddrInfo(machName: string, addr: string): Promise<GetRamAddrInfoResponse>;
|
|
@@ -76,6 +80,7 @@ export declare class SkyEyeClient extends JSONTransmissionClient {
|
|
|
76
80
|
initSkyEyeAndRun(pathSkyEye: string, fileName: string, port: string, skyeyeDir: string): void;
|
|
77
81
|
private childProcess;
|
|
78
82
|
initSkyEyeAndRun2(pathSkyEye: string, fileName: string, port: string, skyeyeDir: string): Promise<boolean>;
|
|
83
|
+
private checkModule;
|
|
79
84
|
private checkState;
|
|
80
85
|
private startSkyEye;
|
|
81
86
|
private setWorkingDirectory;
|
package/dist/src/SkyEyeClient.js
CHANGED
|
@@ -55,6 +55,7 @@ const InstructionItem_1 = require("./models/InstructionItem");
|
|
|
55
55
|
const GetCpuRegisterInfoResponse_1 = require("./response/GetCpuRegisterInfoResponse");
|
|
56
56
|
const SkyEyeSDKException_1 = require("./exception/SkyEyeSDKException");
|
|
57
57
|
const cp = __importStar(require("child_process"));
|
|
58
|
+
const BaseResponse_1 = require("./response/BaseResponse");
|
|
58
59
|
let client = null;
|
|
59
60
|
// ----------------------------当前运行程序的设备树----------------------------------------//
|
|
60
61
|
const boardMap = new Map();
|
|
@@ -361,6 +362,28 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
|
|
|
361
362
|
return response;
|
|
362
363
|
});
|
|
363
364
|
}
|
|
365
|
+
runToTime(cpuName, time) {
|
|
366
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
367
|
+
try {
|
|
368
|
+
return yield this.call(RequestFactory_1.RequestFactory.getInstance().runToTimeRequest(cpuName, time));
|
|
369
|
+
}
|
|
370
|
+
catch (error) {
|
|
371
|
+
console.error("Error during runToTime:", error);
|
|
372
|
+
throw error;
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
getCpuFreq(cpuName) {
|
|
377
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
378
|
+
try {
|
|
379
|
+
return yield this.call(RequestFactory_1.RequestFactory.getInstance().getCpuFreq(cpuName));
|
|
380
|
+
}
|
|
381
|
+
catch (error) {
|
|
382
|
+
console.error("Error during getCpuFreq:", error);
|
|
383
|
+
throw error;
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
}
|
|
364
387
|
getPC(cpuName) {
|
|
365
388
|
return __awaiter(this, void 0, void 0, function* () {
|
|
366
389
|
try {
|
|
@@ -707,6 +730,21 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
|
|
|
707
730
|
return response;
|
|
708
731
|
});
|
|
709
732
|
}
|
|
733
|
+
getModuleStatus() {
|
|
734
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
735
|
+
const response = new BaseResponse_1.BaseResponse();
|
|
736
|
+
try {
|
|
737
|
+
const call = yield this.call(RequestFactory_1.RequestFactory.getInstance().getModuleStatus());
|
|
738
|
+
// { result: 2, error: null, name: 'SE_get_running_status' }
|
|
739
|
+
if (call != null) {
|
|
740
|
+
response.isSuccess = call.result;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
catch (error) {
|
|
744
|
+
}
|
|
745
|
+
return response;
|
|
746
|
+
});
|
|
747
|
+
}
|
|
710
748
|
getCurrentRunningState() {
|
|
711
749
|
return __awaiter(this, void 0, void 0, function* () {
|
|
712
750
|
const response = new GetRunningStateResponse_1.GetRunningStateResponse();
|
|
@@ -983,6 +1021,7 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
|
|
|
983
1021
|
console.log('runExample');
|
|
984
1022
|
this.childProcess = yield this.startSkyEye(port, skyeyeDir);
|
|
985
1023
|
yield this.checkState();
|
|
1024
|
+
yield this.checkModule();
|
|
986
1025
|
yield this.setWorkingDirectory(pathSkyEye, port);
|
|
987
1026
|
yield this.runScript(fileName, port);
|
|
988
1027
|
return true;
|
|
@@ -997,16 +1036,49 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
|
|
|
997
1036
|
}
|
|
998
1037
|
});
|
|
999
1038
|
}
|
|
1039
|
+
checkModule() {
|
|
1040
|
+
return new Promise((resolve, reject) => {
|
|
1041
|
+
let flag = true;
|
|
1042
|
+
const checkInterval = 500;
|
|
1043
|
+
const timeout = 30000;
|
|
1044
|
+
const startTime = Date.now();
|
|
1045
|
+
const check = () => {
|
|
1046
|
+
const elapsedTime = Date.now() - startTime;
|
|
1047
|
+
if (elapsedTime >= timeout) {
|
|
1048
|
+
reject(new Error("Timeout: State check exceeded 30 seconds"));
|
|
1049
|
+
return;
|
|
1050
|
+
}
|
|
1051
|
+
if (!flag) {
|
|
1052
|
+
resolve("");
|
|
1053
|
+
return;
|
|
1054
|
+
}
|
|
1055
|
+
this.getModuleStatus()
|
|
1056
|
+
.then((result) => {
|
|
1057
|
+
if (result.isSuccess) {
|
|
1058
|
+
flag = false;
|
|
1059
|
+
resolve("");
|
|
1060
|
+
}
|
|
1061
|
+
else {
|
|
1062
|
+
setTimeout(check, checkInterval);
|
|
1063
|
+
}
|
|
1064
|
+
})
|
|
1065
|
+
.catch(() => {
|
|
1066
|
+
setTimeout(check, checkInterval);
|
|
1067
|
+
});
|
|
1068
|
+
};
|
|
1069
|
+
check();
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1000
1072
|
checkState() {
|
|
1001
1073
|
return new Promise((resolve, reject) => {
|
|
1002
1074
|
let flag = true;
|
|
1003
1075
|
const checkInterval = 500;
|
|
1004
|
-
const timeout =
|
|
1076
|
+
const timeout = 30000;
|
|
1005
1077
|
const startTime = Date.now();
|
|
1006
1078
|
const check = () => {
|
|
1007
1079
|
const elapsedTime = Date.now() - startTime;
|
|
1008
1080
|
if (elapsedTime >= timeout) {
|
|
1009
|
-
reject(new Error("Timeout: State check exceeded
|
|
1081
|
+
reject(new Error("Timeout: State check exceeded 30 seconds"));
|
|
1010
1082
|
return;
|
|
1011
1083
|
}
|
|
1012
1084
|
if (!flag) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RunToTimeResponse = void 0;
|
|
4
|
+
const BaseResponse_1 = require("./BaseResponse");
|
|
5
|
+
class RunToTimeResponse extends BaseResponse_1.BaseResponse {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.RunToTimeResponse = RunToTimeResponse;
|
package/dist/test.js
CHANGED
|
@@ -12,339 +12,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
const { SkyEyeClientFactory } = require('./src/SkyEyeClientFactory');
|
|
13
13
|
const { SkyEyeClient } = require('./src/SkyEyeClient');
|
|
14
14
|
const { Cpu } = require('./src/models/Cpu');
|
|
15
|
-
const json = {
|
|
16
|
-
"id": "4a162d75-3a84-5264-992f-287624830ead",
|
|
17
|
-
"name": "鍙戦€佸唴瀛樻秷鎭祴璇?",
|
|
18
|
-
"overview": "",
|
|
19
|
-
"parentId": "8a6d70cd-bd7a-4871-d2f3-2f4fdf7b5a46",
|
|
20
|
-
"projectId": "15ffe24f-8ca6-4fcf-afe5-fe01027e2ffb",
|
|
21
|
-
"steps": [
|
|
22
|
-
{
|
|
23
|
-
"id": "35846013-6510-fd0a-a046-a98c2f24157b",
|
|
24
|
-
"sendConditions": {
|
|
25
|
-
"id": "b3c97e92-7367-63ba-6a6b-5f7ca590164c",
|
|
26
|
-
"name": "杩愯0.5s",
|
|
27
|
-
"projectId": "15ffe24f-8ca6-4fcf-afe5-fe01027e2ffb",
|
|
28
|
-
"overview": "",
|
|
29
|
-
"relationship": "A",
|
|
30
|
-
"child": [
|
|
31
|
-
{
|
|
32
|
-
"id": "5ba88de6-a224-0e80-6585-d5e417b424ce",
|
|
33
|
-
"tag": "A",
|
|
34
|
-
"condition": {
|
|
35
|
-
"type": 1,
|
|
36
|
-
"time": 0.5
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
]
|
|
40
|
-
},
|
|
41
|
-
"expectConditions": {
|
|
42
|
-
"id": "6e265328-255e-d7e3-11fd-0a4211d0d0d6",
|
|
43
|
-
"name": "杩愯0.8s",
|
|
44
|
-
"projectId": "15ffe24f-8ca6-4fcf-afe5-fe01027e2ffb",
|
|
45
|
-
"overview": "",
|
|
46
|
-
"relationship": "A",
|
|
47
|
-
"child": [
|
|
48
|
-
{
|
|
49
|
-
"id": "d9e08452-f88b-8de9-bd20-5d5288987fde",
|
|
50
|
-
"tag": "A",
|
|
51
|
-
"condition": {
|
|
52
|
-
"type": 1,
|
|
53
|
-
"time": 0.8
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
]
|
|
57
|
-
},
|
|
58
|
-
"sends": {
|
|
59
|
-
"templateId": "",
|
|
60
|
-
"name": "鍐呭瓨0x4鍙戦€?",
|
|
61
|
-
"child": [
|
|
62
|
-
{
|
|
63
|
-
"id": "0cd71a92-4e7a-dcb8-d74b-dc6ea8103d02",
|
|
64
|
-
"templdateId": "",
|
|
65
|
-
"name": "鏂扮殑鍙戦€?",
|
|
66
|
-
"target": {
|
|
67
|
-
"type": 3,
|
|
68
|
-
"globalName": "",
|
|
69
|
-
"varType": "",
|
|
70
|
-
"addr": "0x4",
|
|
71
|
-
"length": 4,
|
|
72
|
-
"name": "",
|
|
73
|
-
"deviceName": "",
|
|
74
|
-
"busType": 0,
|
|
75
|
-
"directions": 1,
|
|
76
|
-
"nodes": [
|
|
77
|
-
{
|
|
78
|
-
"name": "鑺傜偣1",
|
|
79
|
-
"rtAddr": "",
|
|
80
|
-
"subAddr": "",
|
|
81
|
-
"id": "row_253"
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
"name": "鑺傜偣2",
|
|
85
|
-
"rtAddr": "",
|
|
86
|
-
"subAddr": "",
|
|
87
|
-
"id": "row_254"
|
|
88
|
-
}
|
|
89
|
-
],
|
|
90
|
-
"fields": [
|
|
91
|
-
{
|
|
92
|
-
"name": "field1",
|
|
93
|
-
"dataType": 0,
|
|
94
|
-
"defaultValue": 4,
|
|
95
|
-
"dataRange": [],
|
|
96
|
-
"desc": "this is field1",
|
|
97
|
-
"id": "a89ee30f-ea3d-411e-9bf1-543935a003fc"
|
|
98
|
-
}
|
|
99
|
-
]
|
|
100
|
-
},
|
|
101
|
-
"dataFormat": 0,
|
|
102
|
-
"value": "4",
|
|
103
|
-
"fields": [
|
|
104
|
-
{
|
|
105
|
-
"name": "field1",
|
|
106
|
-
"dataType": 0,
|
|
107
|
-
"defaultValue": 4,
|
|
108
|
-
"dataRange": [],
|
|
109
|
-
"desc": "this is field1",
|
|
110
|
-
"id": "d4c808d1-47ba-a30e-cfbe-68c0d2772b3d"
|
|
111
|
-
}
|
|
112
|
-
],
|
|
113
|
-
"_X_ROW_KEY": "row_251"
|
|
114
|
-
}
|
|
115
|
-
]
|
|
116
|
-
},
|
|
117
|
-
"expects": {
|
|
118
|
-
"templateId": "",
|
|
119
|
-
"name": "鍐呭瓨0x14鍙戦€?",
|
|
120
|
-
"child": [
|
|
121
|
-
{
|
|
122
|
-
"id": "85276ca0-0a09-aa87-ebff-1e6dfc4e5f4f",
|
|
123
|
-
"name": "鏂扮殑棰勬湡",
|
|
124
|
-
"templateId": "",
|
|
125
|
-
"target": {
|
|
126
|
-
"type": 3,
|
|
127
|
-
"globalName": "",
|
|
128
|
-
"varType": "",
|
|
129
|
-
"addr": "0x44",
|
|
130
|
-
"length": 4,
|
|
131
|
-
"name": "",
|
|
132
|
-
"deviceName": "",
|
|
133
|
-
"busType": 0,
|
|
134
|
-
"directions": 1,
|
|
135
|
-
"nodes": [
|
|
136
|
-
{
|
|
137
|
-
"name": "鑺傜偣1",
|
|
138
|
-
"rtAddr": "",
|
|
139
|
-
"subAddr": "",
|
|
140
|
-
"id": "row_299"
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
"name": "鑺傜偣2",
|
|
144
|
-
"rtAddr": "",
|
|
145
|
-
"subAddr": "",
|
|
146
|
-
"id": "row_300"
|
|
147
|
-
}
|
|
148
|
-
],
|
|
149
|
-
"fields": [
|
|
150
|
-
{
|
|
151
|
-
"name": "field1",
|
|
152
|
-
"dataType": 0,
|
|
153
|
-
"defaultValue": 4,
|
|
154
|
-
"dataRange": [],
|
|
155
|
-
"desc": "this is field1",
|
|
156
|
-
"id": "ef2b8873-516c-a338-a8d0-5e8eda5fa08b"
|
|
157
|
-
}
|
|
158
|
-
]
|
|
159
|
-
},
|
|
160
|
-
"dataFormat": 0,
|
|
161
|
-
"value": "8",
|
|
162
|
-
"fields": [
|
|
163
|
-
{
|
|
164
|
-
"name": "field1",
|
|
165
|
-
"dataType": 0,
|
|
166
|
-
"defaultValue": 4,
|
|
167
|
-
"dataRange": [],
|
|
168
|
-
"desc": "this is field1",
|
|
169
|
-
"id": "379506c9-33d2-167d-6c22-8e0ca8559c0a"
|
|
170
|
-
}
|
|
171
|
-
],
|
|
172
|
-
"_X_ROW_KEY": "row_297"
|
|
173
|
-
}
|
|
174
|
-
]
|
|
175
|
-
},
|
|
176
|
-
"select": true
|
|
177
|
-
}
|
|
178
|
-
],
|
|
179
|
-
"settings": {
|
|
180
|
-
"timeout": ""
|
|
181
|
-
},
|
|
182
|
-
"createdAt": "2024-06-05T02:18:27.630Z",
|
|
183
|
-
"updatedAt": "2024-06-11T06:37:05.487Z",
|
|
184
|
-
"results": []
|
|
185
|
-
};
|
|
186
|
-
class RegisterItem {
|
|
187
|
-
}
|
|
188
15
|
var RegisterType;
|
|
189
16
|
(function (RegisterType) {
|
|
190
17
|
RegisterType[RegisterType["CPU"] = 0] = "CPU";
|
|
191
18
|
RegisterType[RegisterType["Device"] = 1] = "Device";
|
|
192
19
|
})(RegisterType || (RegisterType = {}));
|
|
193
|
-
function getAllRegisterList() {
|
|
194
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
195
|
-
const allRegister = [];
|
|
196
|
-
const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
|
|
197
|
-
//通过 getDeviceTree 获取板卡、设备、寄存器层级, 列出所有寄存器列表选择
|
|
198
|
-
const resultTree = yield client.getDeviceTree();
|
|
199
|
-
console.log("结果 resultTree:", JSON.stringify(resultTree));
|
|
200
|
-
console.log("结果 keys:", resultTree.boardMap.keys());
|
|
201
|
-
for (const key of resultTree.boardMap.keys()) {
|
|
202
|
-
const device = resultTree.boardMap.get(key);
|
|
203
|
-
// 在这里对获取到的键值对进行处理
|
|
204
|
-
console.log(`板卡: ${key},设备: ${device.deviceMap}`);
|
|
205
|
-
if (!device.deviceMap || device.deviceMap.keys().length == 0) {
|
|
206
|
-
continue;
|
|
207
|
-
}
|
|
208
|
-
for (const k of device.deviceMap.keys()) {
|
|
209
|
-
const register = device.deviceMap.get(k);
|
|
210
|
-
console.log(`设备: ${k}, 寄存器: ${register}`);
|
|
211
|
-
console.log("寄存器下的寄存器: ", register.registerMap);
|
|
212
|
-
if (!register.registerMap || register.registerMap.keys().length == 0) {
|
|
213
|
-
continue;
|
|
214
|
-
}
|
|
215
|
-
getRegisterMap(register, allRegister);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
console.log("allRegister2:", allRegister.length);
|
|
219
|
-
return allRegister;
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
function getRegisterMap(bean, allRegister) {
|
|
223
|
-
if (!bean.registerMap || bean.registerMap.keys().length == 0) {
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
for (const r of bean.registerMap.keys()) {
|
|
227
|
-
const result = bean.registerMap.get(r);
|
|
228
|
-
console.log(`设备: ${r}, 寄存器: ${result}`);
|
|
229
|
-
const item = new RegisterItem();
|
|
230
|
-
item.name = r.name;
|
|
231
|
-
if (bean instanceof Cpu) {
|
|
232
|
-
console.log(`寄存器类型: ${bean.className}`);
|
|
233
|
-
item.type = RegisterType.CPU;
|
|
234
|
-
}
|
|
235
|
-
else {
|
|
236
|
-
item.type = RegisterType.Device;
|
|
237
|
-
}
|
|
238
|
-
allRegister.push(item);
|
|
239
|
-
getRegisterMap(result, allRegister);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
function setRegister() {
|
|
243
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
244
|
-
const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
|
|
245
|
-
const r2 = yield client.setDeviceRegisterValue('c6713_0', 'c67x_core_0', 'A7', '34');
|
|
246
|
-
console.log("setRegister:", r2);
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
function getRegister() {
|
|
250
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
251
|
-
const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
|
|
252
|
-
const result = yield client.getCpuRegisters("");
|
|
253
|
-
console.log("setRegister:", result);
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
function getState() {
|
|
257
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
258
|
-
const client = SkyEyeClientFactory.instance.createClient('127.0.0.2', '50051');
|
|
259
|
-
const result = yield client.getCurrentRunningState();
|
|
260
|
-
console.log("getState:", result);
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
// getState()
|
|
264
|
-
function setMemoryValue() {
|
|
265
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
266
|
-
const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
|
|
267
|
-
const result = yield client.setMemoryValue('c67x_core_0', '10000', '15', 2);
|
|
268
|
-
console.log("setMemoryValue:", result);
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
// setMemoryValue()
|
|
272
|
-
function getMemoryValue() {
|
|
273
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
274
|
-
const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
|
|
275
|
-
const result = yield client.getMemoryValue('c67x_core_0', "10000", 2);
|
|
276
|
-
console.log("setMemoryValue:", result);
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
// getMemoryValue()
|
|
280
|
-
function testSocket() {
|
|
281
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
282
|
-
const json = {
|
|
283
|
-
"msgId": "0",
|
|
284
|
-
"msgTime": "2023-12-5 12:00:00",
|
|
285
|
-
"msgType": "2",
|
|
286
|
-
"msgData": {
|
|
287
|
-
"version": "10001",
|
|
288
|
-
"protocol": "0",
|
|
289
|
-
"direction": "0",
|
|
290
|
-
"bigEndian": "0",
|
|
291
|
-
"length": "0",
|
|
292
|
-
"data": "0"
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
const net = require('net');
|
|
296
|
-
const client = new net.Socket();
|
|
297
|
-
const host = '127.0.0.1';
|
|
298
|
-
const port = 8099;
|
|
299
|
-
client.connect(port, host, () => {
|
|
300
|
-
console.log('Connected');
|
|
301
|
-
// const str = JSON.stringify(json)
|
|
302
|
-
// // const str = "hhh"
|
|
303
|
-
// const strBuffer = Buffer.from(str, 'utf8'); // 将字符串转换为 Buffer
|
|
304
|
-
// const strLength = strBuffer.length; // 获取 JSON 数据的长度
|
|
305
|
-
// // 创建一个新的 Buffer 用于存储长度信息和数据
|
|
306
|
-
// const totalLength = 4 + strLength; // 4 字节长度 + 数据长度
|
|
307
|
-
// const buffer = Buffer.alloc(totalLength);
|
|
308
|
-
// // 写入前 4 个字节的长度信息
|
|
309
|
-
// buffer.writeUInt32LE(strLength, 0); // 以小端序方式写入 JSON 数据的长度
|
|
310
|
-
// // 将 JSON 数据复制到 Buffer 中
|
|
311
|
-
// strBuffer.copy(buffer, 4); // 从第 5 个字节开始复制 JSON 数据
|
|
312
|
-
// console.log("Buffer sent:", buffer);
|
|
313
|
-
// console.log("String Length:", strLength); // 打印实际的字符串长度
|
|
314
|
-
// console.log("Hex Length:", strLength.toString(16)); // 打印十六进制表示
|
|
315
|
-
// client.write(buffer); // 发送拼接后的 Buffer
|
|
316
|
-
// 发送数据
|
|
317
|
-
//第一阶段0827测试
|
|
318
|
-
// const hexString = "B90000007B0A09226D73674964223A2230222C0A09226D736754696D65223A22323032332D31322D352031323A30303A3030222C0A09226D736754797065223A2232222C0A09226D736744617461223A7B0A09092276657273696F6E223A2231222C0A09092270726F746F636F6C223A2230222C0A090922646972656374696F6E223A2230222C0A090922626967456E6469616E223A2230222C0A0909226C656E677468223A2230222C0A09092264617461223A2230220A097D0A7D0A";
|
|
319
|
-
const s1 = "12 01 AA 11 BB 22 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF 00 00 00 00 33 33 00 00 00 00 00 00 00 00 44 44 00 00 00 00 00 00 88 88 66 44 00 00 00 00 00 00 00 00 00 00 65 76";
|
|
320
|
-
const s1_1 = s1.replace(/\s+/g, '');
|
|
321
|
-
const hexString = "B90000007B0D0A09226D73674964223A2230222C0D0A09226D736754797065223A2232222C0D0A09226D736754696D65223A22323032332D31322D352031323A30303A3030222C0D0A09226D736744617461223A207B0D0A09092276657273696F6E223A223130303031222C0D0A09092270726F746F636F6C223A2230222C0D0A090922646972656374696F6E223A2230222C0D0A090922626967456E6469616E223A2230222C0D0A0909226C656E677468223A36340D0A097D0D0A7D" + s1_1;
|
|
322
|
-
//74
|
|
323
|
-
// const hexString = "B90000007B0D0A09226D73674964223A2230222C0D0A09226D736754797065223A2232222C0D0A09226D736754696D65223A22323032332D31322D352031323A30303A3030222C0D0A09226D736744617461223A207B0D0A09092276657273696F6E223A223130303031222C0D0A09092270726F746F636F6C223A2230222C0D0A090922646972656374696F6E223A2230222C0D0A090922626967456E6469616E223A2230222C0D0A0909226C656E677468223A37340D0A097D0D0A7D1201AA11BB220000000000000000000000000000FFFF000000003333000000000000000044440000000000008888664400000000000000000000006576";
|
|
324
|
-
console.log("hexString:", hexString);
|
|
325
|
-
console.log("hexString:", hexString.length);
|
|
326
|
-
const buffer2 = Buffer.from(hexString, 'hex');
|
|
327
|
-
console.log("buffer2:", buffer2.length);
|
|
328
|
-
client.write(buffer2);
|
|
329
|
-
});
|
|
330
|
-
client.on('data', (data) => {
|
|
331
|
-
console.log('Received: ' + data);
|
|
332
|
-
client.destroy();
|
|
333
|
-
});
|
|
334
|
-
client.on('close', () => {
|
|
335
|
-
console.log('Connection closed');
|
|
336
|
-
});
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
testSocket();
|
|
340
|
-
function testgetGlobalVarValue() {
|
|
341
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
342
|
-
const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50052');
|
|
343
|
-
const response = yield client.getGlobalVarValue("cx53123", "a", 16, "double");
|
|
344
|
-
console.log("testgetGlobalVarValue response:", response);
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
// testgetGlobalVarValue()
|
|
348
20
|
function test() {
|
|
349
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
350
22
|
// console.log("Connected to SkyEye server");
|
|
@@ -359,18 +31,12 @@ function test() {
|
|
|
359
31
|
// const response = await client.getMemoryValueDefault(1, 16);
|
|
360
32
|
// const response = await client.getMemoryValue("c7s",0,16);
|
|
361
33
|
// console.log("结果response:", response)
|
|
362
|
-
// await client.initSkyEyeAndRun(pathSkyEye,fileName,port,skyeyeDir);
|
|
363
|
-
// const pathSkyEye = "D:/data/case/c6713_demo";
|
|
364
|
-
// const fileName = "c6713_demo.skyeye";
|
|
365
|
-
// const skyeyeDir = "D:/install/skyeye/opt/skyeye/bin/skyeye.exe"
|
|
366
|
-
// const port = "50051"
|
|
367
|
-
// const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
|
|
368
|
-
// await client.initSkyEyeAndRun2(pathSkyEye, fileName, port, skyeyeDir)
|
|
369
34
|
// const pathSkyEye = "D:/data/case/workspace_c6713/targets/c6713_fc_1553b";
|
|
370
35
|
// const fileName = "c6713_fc_1553b.skyeye";
|
|
371
36
|
// const skyeyeDir = "D:/install/skyeye/opt/skyeye/bin/skyeye.exe"
|
|
372
|
-
// const client = SkyEyeClientFactory.instance.createClient('127.0.0.1',
|
|
37
|
+
// const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', 50061);
|
|
373
38
|
// const response =await client.getCurrentRunningState()
|
|
39
|
+
// console.log("response:", response)
|
|
374
40
|
// const response = await client.getMemoryValueDefault("128","4")
|
|
375
41
|
// const response = await client.getGlobalVarValueDefault("number_a","int")
|
|
376
42
|
// const response = await client.setGlobalVarValueDefault("number_a", "int", "12")
|
|
@@ -379,49 +45,26 @@ function test() {
|
|
|
379
45
|
// console.log("response:", response)
|
|
380
46
|
// console.log("response:", response.boardMap)
|
|
381
47
|
// console.log("response:", response.boardMap.keys[0])
|
|
48
|
+
// await client.initSkyEyeAndRun(pathSkyEye,fileName,port,skyeyeDir);
|
|
49
|
+
// const pathSkyEye = "D:/data/case/FMQL45T900_SylixOS";
|
|
50
|
+
// const fileName = "FMQL45T900_SylixOS.skyeye";
|
|
51
|
+
// const skyeyeDir = "D:/install/SkyEye/opt/skyeye/bin/skyeye.exe"
|
|
52
|
+
// const port = "50066"
|
|
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";
|
|
57
|
+
const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', port);
|
|
58
|
+
const t = yield client.initSkyEyeAndRun2(pathSkyEye, fileName, port, skyeyeDir);
|
|
59
|
+
client.runCommand();
|
|
60
|
+
const response = yield client.runToTime("c67x_core_0", "1");
|
|
61
|
+
console.log("response:", response);
|
|
62
|
+
// const responseCpuList = await client.getCpuList()
|
|
63
|
+
// console.log("responseCpuList:", responseCpuList)
|
|
64
|
+
// const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', 50056);
|
|
65
|
+
// const cpuname = "fmql45t900_0_fmql45t900_core_0";
|
|
66
|
+
// const response = await client.getCpuFreq(cpuname)
|
|
67
|
+
// { name: 'SE_get_cpu_freq_hz', result: 200000000, error: null }
|
|
382
68
|
});
|
|
383
69
|
}
|
|
384
|
-
|
|
385
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
386
|
-
const pathSkyEye = "D:/data/case/workspace_c6713/targets/c6713_fc_1553b";
|
|
387
|
-
const fileName = "c6713_fc_1553b.skyeye";
|
|
388
|
-
const skyeyeDir = "D:/install/skyeye/opt/skyeye/bin/skyeye.exe";
|
|
389
|
-
const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
|
|
390
|
-
//启动多个skyeye
|
|
391
|
-
const count = 5;
|
|
392
|
-
const map = new Map;
|
|
393
|
-
for (let i = 1; i < count; i++) {
|
|
394
|
-
const port = 50050 + i;
|
|
395
|
-
const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', port.toString());
|
|
396
|
-
yield client.initSkyEyeAndRun2(pathSkyEye, fileName, port.toString(), skyeyeDir);
|
|
397
|
-
yield client.RunTestcase(json);
|
|
398
|
-
yield client.runCommand();
|
|
399
|
-
const res = yield client.getCurrentRunningState();
|
|
400
|
-
console.log("state3:", res.state);
|
|
401
|
-
map.set(port, client);
|
|
402
|
-
}
|
|
403
|
-
for (let i = 1; i < count; i++) {
|
|
404
|
-
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
405
|
-
const port = 50050 + i;
|
|
406
|
-
const client = map.get(port);
|
|
407
|
-
yield client.quitCommand();
|
|
408
|
-
}), i * 5000);
|
|
409
|
-
}
|
|
410
|
-
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
411
|
-
// await map.get(50051).stopGrpcService("")
|
|
412
|
-
yield map.get(50051).quitCommand();
|
|
413
|
-
}), 2000);
|
|
414
|
-
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
415
|
-
// await map.get(50052).stopGrpcService("")
|
|
416
|
-
yield map.get(50052).quitCommand();
|
|
417
|
-
}), 5000);
|
|
418
|
-
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
419
|
-
// await map.get(50053).stopGrpcService("")
|
|
420
|
-
yield map.get(50053).quitCommand();
|
|
421
|
-
}), 8000);
|
|
422
|
-
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
423
|
-
// await map.get(50054).stopGrpcService("")
|
|
424
|
-
yield map.get(50054).quitCommand();
|
|
425
|
-
}), 11000);
|
|
426
|
-
});
|
|
427
|
-
}
|
|
70
|
+
test();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|