skyeye-sdk-js 1.3.4 → 1.3.6
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 +2 -1
- package/dist/src/RequestFactory.js +21 -10
- package/dist/src/SkyEyeClient.d.ts +4 -2
- package/dist/src/SkyEyeClient.js +43 -14
- package/dist/test.js +118 -40
- package/package.json +3 -2
- package/src/RequestFactory.ts +34 -21
- package/src/SkyEyeClient.ts +42 -22
- package/test.ts +148 -52
|
@@ -11,6 +11,7 @@ export declare class RequestFactory {
|
|
|
11
11
|
quitCommand(): JSONRequest;
|
|
12
12
|
getCpuList(): JSONRequest;
|
|
13
13
|
getMemoryValue(cpuName: string, baseAddr: string, length: string): JSONRequest;
|
|
14
|
+
setMemoryValue(cpuName: string, baseAddr: string, value: string, length: string): JSONRequest;
|
|
14
15
|
enableDeviceWork(deviceName: string): JSONRequest;
|
|
15
16
|
disableDeviceWork(deviceName: string): JSONRequest;
|
|
16
17
|
changeDir(path: string): JSONRequest;
|
|
@@ -20,7 +21,7 @@ export declare class RequestFactory {
|
|
|
20
21
|
getCurrentPC(cpuName: string): JSONRequest;
|
|
21
22
|
getCpuMips(cpuName: string): JSONRequest;
|
|
22
23
|
getGlobalVarValue(cpuName: string, varName: string, bytesNum: number, valueType: GlobalVarType): JSONRequest;
|
|
23
|
-
setGlobalVarValue(cpuName: string, varName: string, bytesNum:
|
|
24
|
+
setGlobalVarValue(cpuName: string, varName: string, bytesNum: number, valueType: GlobalVarType, value: string): JSONRequest;
|
|
24
25
|
getDeviceList(): JSONRequest;
|
|
25
26
|
getDeviceTree(): JSONRequest;
|
|
26
27
|
setRegisterValue(machName: string, deviceName: string, regName: string, value: string): JSONRequest;
|
|
@@ -60,6 +60,18 @@ class RequestFactory {
|
|
|
60
60
|
request.setRequest(baseRequest.toJSONString());
|
|
61
61
|
return request;
|
|
62
62
|
}
|
|
63
|
+
setMemoryValue(cpuName, baseAddr, value, length) {
|
|
64
|
+
const baseRequest = new BaseRequest_1.BaseRequest("SE_set_memory_value");
|
|
65
|
+
const args = {};
|
|
66
|
+
args.cpuname = cpuName;
|
|
67
|
+
args.baseaddr = "0x" + baseAddr;
|
|
68
|
+
args.value = value;
|
|
69
|
+
args.length = length;
|
|
70
|
+
baseRequest.setArgs(args);
|
|
71
|
+
const request = new skyeye_rpc_pb_1.JSONRequest();
|
|
72
|
+
request.setRequest(baseRequest.toJSONString());
|
|
73
|
+
return request;
|
|
74
|
+
}
|
|
63
75
|
enableDeviceWork(deviceName) {
|
|
64
76
|
const baseRequest = new BaseRequest_1.BaseRequest("SE_enable_device_work");
|
|
65
77
|
const args = {};
|
|
@@ -137,7 +149,6 @@ class RequestFactory {
|
|
|
137
149
|
baseRequest.setArgs(args);
|
|
138
150
|
const request = new skyeye_rpc_pb_1.JSONRequest();
|
|
139
151
|
request.setRequest(baseRequest.toJSONString());
|
|
140
|
-
console.log("request:", request);
|
|
141
152
|
return request;
|
|
142
153
|
}
|
|
143
154
|
setGlobalVarValue(cpuName, varName, bytesNum, valueType, value) {
|
|
@@ -145,7 +156,7 @@ class RequestFactory {
|
|
|
145
156
|
const args = {};
|
|
146
157
|
args.cpu_name = cpuName;
|
|
147
158
|
args.var_name = varName;
|
|
148
|
-
args.value_bytes_number =
|
|
159
|
+
args.value_bytes_number = bytesNum;
|
|
149
160
|
args.value_type = valueType;
|
|
150
161
|
args.value = value;
|
|
151
162
|
baseRequest.setArgs(args);
|
|
@@ -168,9 +179,9 @@ class RequestFactory {
|
|
|
168
179
|
setRegisterValue(machName, deviceName, regName, value) {
|
|
169
180
|
const baseRequest = new BaseRequest_1.BaseRequest("SE_set_device_register_value");
|
|
170
181
|
const args = {};
|
|
171
|
-
args.
|
|
172
|
-
args.
|
|
173
|
-
args.
|
|
182
|
+
args.machname = machName;
|
|
183
|
+
args.devname = deviceName;
|
|
184
|
+
args.regname = regName;
|
|
174
185
|
args.value = String(value);
|
|
175
186
|
baseRequest.setArgs(args);
|
|
176
187
|
const request = new skyeye_rpc_pb_1.JSONRequest();
|
|
@@ -186,7 +197,7 @@ class RequestFactory {
|
|
|
186
197
|
getRamAddrInfo(machName, addr) {
|
|
187
198
|
const baseRequest = new BaseRequest_1.BaseRequest("SE_get_mem_device_addr_info");
|
|
188
199
|
const args = {};
|
|
189
|
-
args.
|
|
200
|
+
args.machname = machName;
|
|
190
201
|
args.addr = addr;
|
|
191
202
|
baseRequest.setArgs(args);
|
|
192
203
|
const request = new skyeye_rpc_pb_1.JSONRequest();
|
|
@@ -196,8 +207,8 @@ class RequestFactory {
|
|
|
196
207
|
setFaultInject(machName, deviceName, addr, bit, mode) {
|
|
197
208
|
const baseRequest = new BaseRequest_1.BaseRequest("SE_set_fault_inject");
|
|
198
209
|
const args = {};
|
|
199
|
-
args.
|
|
200
|
-
args.
|
|
210
|
+
args.machname = machName;
|
|
211
|
+
args.devicename = deviceName;
|
|
201
212
|
args.addr = addr;
|
|
202
213
|
args.bit = bit;
|
|
203
214
|
args.mode = mode;
|
|
@@ -209,8 +220,8 @@ class RequestFactory {
|
|
|
209
220
|
deleteFaultInject(machName, deviceName, addr, bit, mode) {
|
|
210
221
|
const baseRequest = new BaseRequest_1.BaseRequest("SE_delete_fault");
|
|
211
222
|
const args = {};
|
|
212
|
-
args.
|
|
213
|
-
args.
|
|
223
|
+
args.machname = machName;
|
|
224
|
+
args.devicename = deviceName;
|
|
214
225
|
args.addr = addr;
|
|
215
226
|
args.bit = bit;
|
|
216
227
|
args.mode = mode;
|
|
@@ -42,12 +42,14 @@ export declare class SkyEyeClient extends JSONTransmissionClient {
|
|
|
42
42
|
getCurrentCpuMips(): Promise<any>;
|
|
43
43
|
getGlobalVarValue(cpuName: string, varName: string, bytesNum: number, valueType: GlobalVarType): Promise<any>;
|
|
44
44
|
getGlobalVarValueDefault(varName: string, valueType: GlobalVarType): Promise<any>;
|
|
45
|
-
setGlobalVarValue(cpuName: string, varName: string, bytesNum:
|
|
45
|
+
setGlobalVarValue(cpuName: string, varName: string, bytesNum: number, valueType: GlobalVarType, value: string): Promise<any>;
|
|
46
46
|
setGlobalVarValueDefault(varName: string, valueType: GlobalVarType, value: string): Promise<any>;
|
|
47
|
-
getMemoryValue(cpuName: string, baseAddr: string, length: string): Promise<any>;
|
|
48
47
|
getAddressingSpace(cpuName: string, baseAddr: string, length: string): Promise<any>;
|
|
48
|
+
getMemoryValue(cpuName: string, baseAddr: string, length: string): Promise<any>;
|
|
49
49
|
getMemoryValueDefault(baseAddr: string, length: string): Promise<any>;
|
|
50
50
|
getAddressingSpaceDefault(baseAddr: string, length: string): Promise<any>;
|
|
51
|
+
setMemoryValue(cpuName: string, baseAddr: string, value: string, length: string): Promise<any>;
|
|
52
|
+
setMemoryValueDefault(baseAddr: string, value: string, length: string): Promise<any>;
|
|
51
53
|
getCpuRegisters(cpuName: string): Promise<GetCpuRegisterInfoResponse>;
|
|
52
54
|
getCpuRegistersDefault(): Promise<GetCpuRegisterInfoResponse>;
|
|
53
55
|
setCpuRegisterValueDefault(register: Register, value: string): Promise<any>;
|
package/dist/src/SkyEyeClient.js
CHANGED
|
@@ -465,7 +465,7 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
|
|
|
465
465
|
const cpuList = (yield this.getCpuList()).getCpuList();
|
|
466
466
|
if (cpuList != null && cpuList.length > 0) {
|
|
467
467
|
try {
|
|
468
|
-
return yield this.call(RequestFactory_1.RequestFactory.getInstance().setGlobalVarValue(cpuList[0].getName(), varName,
|
|
468
|
+
return yield this.call(RequestFactory_1.RequestFactory.getInstance().setGlobalVarValue(cpuList[0].getName(), varName, 8, valueType, value));
|
|
469
469
|
}
|
|
470
470
|
catch (error) {
|
|
471
471
|
console.error("Error during setGlobalVarValueDefault:", error);
|
|
@@ -478,24 +478,24 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
|
|
|
478
478
|
}
|
|
479
479
|
});
|
|
480
480
|
}
|
|
481
|
-
|
|
481
|
+
getAddressingSpace(cpuName, baseAddr, length) {
|
|
482
482
|
return __awaiter(this, void 0, void 0, function* () {
|
|
483
483
|
try {
|
|
484
|
-
return this.
|
|
484
|
+
return yield this.call(RequestFactory_1.RequestFactory.getInstance().getMemoryValue(cpuName, baseAddr, length));
|
|
485
485
|
}
|
|
486
486
|
catch (error) {
|
|
487
|
-
console.error("Error during
|
|
487
|
+
console.error("Error during getAddressingSpace:", error);
|
|
488
488
|
throw error;
|
|
489
489
|
}
|
|
490
490
|
});
|
|
491
491
|
}
|
|
492
|
-
|
|
492
|
+
getMemoryValue(cpuName, baseAddr, length) {
|
|
493
493
|
return __awaiter(this, void 0, void 0, function* () {
|
|
494
494
|
try {
|
|
495
|
-
return
|
|
495
|
+
return this.getAddressingSpace(cpuName, baseAddr, length);
|
|
496
496
|
}
|
|
497
497
|
catch (error) {
|
|
498
|
-
console.error("Error during
|
|
498
|
+
console.error("Error during getMemoryValue:", error);
|
|
499
499
|
throw error;
|
|
500
500
|
}
|
|
501
501
|
});
|
|
@@ -529,6 +529,35 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
|
|
|
529
529
|
}
|
|
530
530
|
});
|
|
531
531
|
}
|
|
532
|
+
setMemoryValue(cpuName, baseAddr, value, length) {
|
|
533
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
534
|
+
try {
|
|
535
|
+
return yield this.call(RequestFactory_1.RequestFactory.getInstance().setMemoryValue(cpuName, baseAddr, value, length));
|
|
536
|
+
}
|
|
537
|
+
catch (error) {
|
|
538
|
+
console.error("Error during getAddressingSpaceDefault:", error);
|
|
539
|
+
throw error;
|
|
540
|
+
}
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
setMemoryValueDefault(baseAddr, value, length) {
|
|
544
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
545
|
+
const cpuList = (yield this.getCpuList()).getCpuList();
|
|
546
|
+
if (cpuList != null && cpuList.length > 0) {
|
|
547
|
+
try {
|
|
548
|
+
return yield this.setMemoryValue(cpuList[0].getName(), baseAddr, value, length);
|
|
549
|
+
}
|
|
550
|
+
catch (error) {
|
|
551
|
+
console.error("Error during getAddressingSpaceDefault:", error);
|
|
552
|
+
throw error;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
else {
|
|
556
|
+
console.error("无法获取cpu,请确认cpu是否存在:");
|
|
557
|
+
throw new SkyEyeSDKException_1.SkyEyeSDKException("无法获取cpu,请确认cpu是否存在:");
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
}
|
|
532
561
|
getCpuRegisters(cpuName) {
|
|
533
562
|
return __awaiter(this, void 0, void 0, function* () {
|
|
534
563
|
const response = new GetCpuRegisterInfoResponse_1.GetCpuRegisterInfoResponse();
|
|
@@ -616,14 +645,14 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
|
|
|
616
645
|
if (!deviceTree.boardMap.has(boardName)) {
|
|
617
646
|
throw new SkyEyeSDKException_1.SkyEyeSDKException("未能找到该板卡");
|
|
618
647
|
}
|
|
619
|
-
const board = boardMap.get(boardName);
|
|
620
|
-
const deviceMap = board.
|
|
621
|
-
if (!deviceMap.has(cpuName) || !(deviceMap.get(cpuName) instanceof
|
|
622
|
-
|
|
623
|
-
}
|
|
624
|
-
const cpu = deviceMap.get(cpuName);
|
|
648
|
+
// const board: Board = boardMap.get(boardName);
|
|
649
|
+
// const deviceMap = board.deviceMap;
|
|
650
|
+
// if (!deviceMap.has(cpuName) || !(deviceMap.get(cpuName) instanceof Cpu)) {
|
|
651
|
+
// throw new SkyEyeSDKException("未能找到该设备");
|
|
652
|
+
// }
|
|
653
|
+
// const cpu = deviceMap.get(cpuName);
|
|
625
654
|
try {
|
|
626
|
-
return yield this.call(RequestFactory_1.RequestFactory.getInstance().setRegisterValue(
|
|
655
|
+
return yield this.call(RequestFactory_1.RequestFactory.getInstance().setRegisterValue(boardName, cpuName, registerName, value));
|
|
627
656
|
}
|
|
628
657
|
catch (error) {
|
|
629
658
|
console.error("Error during getAddressingSpace:", error);
|
package/dist/test.js
CHANGED
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const { SkyEyeClientFactory } = require('./src/SkyEyeClientFactory');
|
|
13
13
|
const { SkyEyeClient } = require('./src/SkyEyeClient');
|
|
14
|
+
const { Cpu } = require('./src/models/Cpu');
|
|
14
15
|
const json = {
|
|
15
16
|
"id": "4a162d75-3a84-5264-992f-287624830ead",
|
|
16
17
|
"name": "鍙戦€佸唴瀛樻秷鎭祴璇?",
|
|
@@ -182,6 +183,71 @@ const json = {
|
|
|
182
183
|
"updatedAt": "2024-06-11T06:37:05.487Z",
|
|
183
184
|
"results": []
|
|
184
185
|
};
|
|
186
|
+
class RegisterItem {
|
|
187
|
+
}
|
|
188
|
+
var RegisterType;
|
|
189
|
+
(function (RegisterType) {
|
|
190
|
+
RegisterType[RegisterType["CPU"] = 0] = "CPU";
|
|
191
|
+
RegisterType[RegisterType["Device"] = 1] = "Device";
|
|
192
|
+
})(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 result = yield client.setCpuRegisterValue('c6713_0', 'c67x_core_0', 'FADCR_REG', '3');
|
|
246
|
+
console.log("setRegister:", result);
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
// getAllRegisterList()
|
|
250
|
+
setRegister();
|
|
185
251
|
function test() {
|
|
186
252
|
return __awaiter(this, void 0, void 0, function* () {
|
|
187
253
|
// console.log("Connected to SkyEye server");
|
|
@@ -203,50 +269,62 @@ function test() {
|
|
|
203
269
|
// const port = "50051"
|
|
204
270
|
// const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
|
|
205
271
|
// await client.initSkyEyeAndRun2(pathSkyEye, fileName, port, skyeyeDir)
|
|
272
|
+
// const pathSkyEye = "D:/data/case/workspace_c6713/targets/c6713_fc_1553b";
|
|
273
|
+
// const fileName = "c6713_fc_1553b.skyeye";
|
|
274
|
+
// const skyeyeDir = "D:/install/skyeye/opt/skyeye/bin/skyeye.exe"
|
|
275
|
+
// const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
|
|
276
|
+
// const response =await client.getCurrentRunningState()
|
|
277
|
+
// const response = await client.getMemoryValueDefault("128","4")
|
|
278
|
+
// const response = await client.getGlobalVarValueDefault("number_a","int")
|
|
279
|
+
// const response = await client.setGlobalVarValueDefault("number_a", "int", "12")
|
|
280
|
+
// const response = await client.getDeviceTree()
|
|
281
|
+
// const response = await client.getMemoryValueDefault("10001", "1")
|
|
282
|
+
// console.log("response:", response)
|
|
283
|
+
// console.log("response:", response.boardMap)
|
|
284
|
+
// console.log("response:", response.boardMap.keys[0])
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
function testMutil() {
|
|
288
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
206
289
|
const pathSkyEye = "D:/data/case/workspace_c6713/targets/c6713_fc_1553b";
|
|
207
290
|
const fileName = "c6713_fc_1553b.skyeye";
|
|
208
291
|
const skyeyeDir = "D:/install/skyeye/opt/skyeye/bin/skyeye.exe";
|
|
209
292
|
const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
|
|
210
|
-
// const response =await client.getCurrentRunningState()
|
|
211
|
-
// const response = await client.getMemoryValueDefault("128","4")
|
|
212
|
-
const response = yield client.getGlobalVarValueDefault("number_b", "int");
|
|
213
|
-
console.log("response:", response);
|
|
214
293
|
//启动多个skyeye
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
294
|
+
const count = 5;
|
|
295
|
+
const map = new Map;
|
|
296
|
+
for (let i = 1; i < count; i++) {
|
|
297
|
+
const port = 50050 + i;
|
|
298
|
+
const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', port.toString());
|
|
299
|
+
yield client.initSkyEyeAndRun2(pathSkyEye, fileName, port.toString(), skyeyeDir);
|
|
300
|
+
yield client.RunTestcase(json);
|
|
301
|
+
yield client.runCommand();
|
|
302
|
+
const res = yield client.getCurrentRunningState();
|
|
303
|
+
console.log("state3:", res.state);
|
|
304
|
+
map.set(port, client);
|
|
305
|
+
}
|
|
306
|
+
for (let i = 1; i < count; i++) {
|
|
307
|
+
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
308
|
+
const port = 50050 + i;
|
|
309
|
+
const client = map.get(port);
|
|
310
|
+
yield client.quitCommand();
|
|
311
|
+
}), i * 5000);
|
|
312
|
+
}
|
|
313
|
+
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
314
|
+
// await map.get(50051).stopGrpcService("")
|
|
315
|
+
yield map.get(50051).quitCommand();
|
|
316
|
+
}), 2000);
|
|
317
|
+
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
318
|
+
// await map.get(50052).stopGrpcService("")
|
|
319
|
+
yield map.get(50052).quitCommand();
|
|
320
|
+
}), 5000);
|
|
321
|
+
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
322
|
+
// await map.get(50053).stopGrpcService("")
|
|
323
|
+
yield map.get(50053).quitCommand();
|
|
324
|
+
}), 8000);
|
|
325
|
+
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
326
|
+
// await map.get(50054).stopGrpcService("")
|
|
327
|
+
yield map.get(50054).quitCommand();
|
|
328
|
+
}), 11000);
|
|
250
329
|
});
|
|
251
330
|
}
|
|
252
|
-
test();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skyeye-sdk-js",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.6",
|
|
4
4
|
"description": "gRPC to SkyEye",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"google-protobuf": "^3.21.2",
|
|
28
28
|
"lodash": "^4.6.1",
|
|
29
29
|
"minimist": "^1.2.0",
|
|
30
|
-
"protobufjs": "^7.2.6"
|
|
30
|
+
"protobufjs": "^7.2.6",
|
|
31
|
+
"skyeye-sdk-js": "^1.3.2"
|
|
31
32
|
}
|
|
32
33
|
}
|
package/src/RequestFactory.ts
CHANGED
|
@@ -73,6 +73,20 @@ export class RequestFactory {
|
|
|
73
73
|
request.setRequest(baseRequest.toJSONString());
|
|
74
74
|
return request;
|
|
75
75
|
}
|
|
76
|
+
public setMemoryValue(cpuName: string, baseAddr: string, value: string, length: string) {
|
|
77
|
+
const baseRequest = new BaseRequest("SE_set_memory_value");
|
|
78
|
+
const args: { [key: string]: string } = {};
|
|
79
|
+
args.cpuname = cpuName;
|
|
80
|
+
args.baseaddr = "0x" + baseAddr;
|
|
81
|
+
args.value = value;
|
|
82
|
+
args.length = length;
|
|
83
|
+
baseRequest.setArgs(args)
|
|
84
|
+
const request = new JSONRequest()
|
|
85
|
+
request.setRequest(baseRequest.toJSONString());
|
|
86
|
+
return request;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
76
90
|
|
|
77
91
|
public enableDeviceWork(deviceName: string) {
|
|
78
92
|
const baseRequest = new BaseRequest("SE_enable_device_work");
|
|
@@ -163,17 +177,16 @@ export class RequestFactory {
|
|
|
163
177
|
baseRequest.setArgs(args)
|
|
164
178
|
const request = new JSONRequest()
|
|
165
179
|
request.setRequest(baseRequest.toJSONString());
|
|
166
|
-
console.log("request:",request)
|
|
167
180
|
return request;
|
|
168
181
|
}
|
|
169
182
|
|
|
170
183
|
|
|
171
|
-
public setGlobalVarValue(cpuName: string, varName: string, bytesNum:
|
|
184
|
+
public setGlobalVarValue(cpuName: string, varName: string, bytesNum: number, valueType: GlobalVarType, value: string) {
|
|
172
185
|
const baseRequest = new BaseRequest("SE_set_global_variable_value");
|
|
173
|
-
const args: { [key: string]:
|
|
186
|
+
const args: { [key: string]: any } = {};
|
|
174
187
|
args.cpu_name = cpuName;
|
|
175
188
|
args.var_name = varName;
|
|
176
|
-
args.value_bytes_number =
|
|
189
|
+
args.value_bytes_number = bytesNum
|
|
177
190
|
args.value_type = valueType;
|
|
178
191
|
args.value = value;
|
|
179
192
|
baseRequest.setArgs(args)
|
|
@@ -204,9 +217,9 @@ export class RequestFactory {
|
|
|
204
217
|
public setRegisterValue(machName: string, deviceName: string, regName: string, value: string) {
|
|
205
218
|
const baseRequest = new BaseRequest("SE_set_device_register_value");
|
|
206
219
|
const args: { [key: string]: string } = {};
|
|
207
|
-
args.
|
|
208
|
-
args.
|
|
209
|
-
args.
|
|
220
|
+
args.machname = machName;
|
|
221
|
+
args.devname = deviceName;
|
|
222
|
+
args.regname = regName;
|
|
210
223
|
args.value = String(value);
|
|
211
224
|
baseRequest.setArgs(args)
|
|
212
225
|
const request = new JSONRequest()
|
|
@@ -214,7 +227,7 @@ export class RequestFactory {
|
|
|
214
227
|
return request;
|
|
215
228
|
}
|
|
216
229
|
|
|
217
|
-
|
|
230
|
+
|
|
218
231
|
public getAllDeviceInfo() {
|
|
219
232
|
const baseRequest = new BaseRequest("SE_get_all_fault_inject_device_info");
|
|
220
233
|
const request = new JSONRequest()
|
|
@@ -223,10 +236,10 @@ export class RequestFactory {
|
|
|
223
236
|
}
|
|
224
237
|
|
|
225
238
|
|
|
226
|
-
public getRamAddrInfo(machName:string,addr:string){
|
|
239
|
+
public getRamAddrInfo(machName: string, addr: string) {
|
|
227
240
|
const baseRequest = new BaseRequest("SE_get_mem_device_addr_info");
|
|
228
241
|
const args: { [key: string]: string } = {};
|
|
229
|
-
args.
|
|
242
|
+
args.machname = machName;
|
|
230
243
|
args.addr = addr
|
|
231
244
|
baseRequest.setArgs(args)
|
|
232
245
|
const request = new JSONRequest()
|
|
@@ -237,11 +250,11 @@ export class RequestFactory {
|
|
|
237
250
|
|
|
238
251
|
|
|
239
252
|
|
|
240
|
-
public setFaultInject(machName:string,deviceName:string,addr:string,bit:string,mode:string){
|
|
253
|
+
public setFaultInject(machName: string, deviceName: string, addr: string, bit: string, mode: string) {
|
|
241
254
|
const baseRequest = new BaseRequest("SE_set_fault_inject");
|
|
242
255
|
const args: { [key: string]: string } = {};
|
|
243
|
-
args.
|
|
244
|
-
args.
|
|
256
|
+
args.machname = machName;
|
|
257
|
+
args.devicename = deviceName;
|
|
245
258
|
args.addr = addr;
|
|
246
259
|
args.bit = bit;
|
|
247
260
|
args.mode = mode;
|
|
@@ -253,11 +266,11 @@ export class RequestFactory {
|
|
|
253
266
|
|
|
254
267
|
|
|
255
268
|
|
|
256
|
-
public deleteFaultInject(machName:string,deviceName:string,addr:string,bit:string,mode:string){
|
|
269
|
+
public deleteFaultInject(machName: string, deviceName: string, addr: string, bit: string, mode: string) {
|
|
257
270
|
const baseRequest = new BaseRequest("SE_delete_fault");
|
|
258
271
|
const args: { [key: string]: string } = {};
|
|
259
|
-
args.
|
|
260
|
-
args.
|
|
272
|
+
args.machname = machName;
|
|
273
|
+
args.devicename = deviceName;
|
|
261
274
|
args.addr = addr;
|
|
262
275
|
args.bit = bit;
|
|
263
276
|
args.mode = mode;
|
|
@@ -268,7 +281,7 @@ export class RequestFactory {
|
|
|
268
281
|
}
|
|
269
282
|
|
|
270
283
|
|
|
271
|
-
|
|
284
|
+
|
|
272
285
|
|
|
273
286
|
public getFaultInjectList() {
|
|
274
287
|
const baseRequest = new BaseRequest("SE_get_fault_inject_list");
|
|
@@ -279,11 +292,11 @@ export class RequestFactory {
|
|
|
279
292
|
|
|
280
293
|
|
|
281
294
|
|
|
282
|
-
public getDisassembleInfo(cpuName:string,startAddr:string,nums:string){
|
|
295
|
+
public getDisassembleInfo(cpuName: string, startAddr: string, nums: string) {
|
|
283
296
|
const baseRequest = new BaseRequest("SE_get_disassemble_info");
|
|
284
297
|
const args: { [key: string]: string } = {};
|
|
285
298
|
args.cpuname = cpuName;
|
|
286
|
-
args.startAddr = "0x"+startAddr
|
|
299
|
+
args.startAddr = "0x" + startAddr
|
|
287
300
|
args.length = nums
|
|
288
301
|
baseRequest.setArgs(args)
|
|
289
302
|
const request = new JSONRequest()
|
|
@@ -295,7 +308,7 @@ export class RequestFactory {
|
|
|
295
308
|
|
|
296
309
|
|
|
297
310
|
|
|
298
|
-
public singleStep(cpuName:string){
|
|
311
|
+
public singleStep(cpuName: string) {
|
|
299
312
|
const baseRequest = new BaseRequest("SE_system_step");
|
|
300
313
|
const args: { [key: string]: string } = {};
|
|
301
314
|
args.cpuname = cpuName;
|
|
@@ -306,7 +319,7 @@ export class RequestFactory {
|
|
|
306
319
|
}
|
|
307
320
|
|
|
308
321
|
|
|
309
|
-
public getcpuRegisterInfo(cpuName:string){
|
|
322
|
+
public getcpuRegisterInfo(cpuName: string) {
|
|
310
323
|
const baseRequest = new BaseRequest("SE_get_cpu_register_info");
|
|
311
324
|
const args: { [key: string]: string } = {};
|
|
312
325
|
args.cpuname = cpuName;
|
package/src/SkyEyeClient.ts
CHANGED
|
@@ -23,6 +23,7 @@ import { GetCpuRegisterInfoResponse } from './response/GetCpuRegisterInfoRespons
|
|
|
23
23
|
import { SkyEyeSDKException } from './exception/SkyEyeSDKException';
|
|
24
24
|
import { ServiceError } from '@grpc/grpc-js';
|
|
25
25
|
import * as cp from 'child_process';
|
|
26
|
+
import { Board } from './models/Board';
|
|
26
27
|
let client: JSONTransmissionClient | any = null;
|
|
27
28
|
|
|
28
29
|
|
|
@@ -402,7 +403,7 @@ export class SkyEyeClient extends JSONTransmissionClient {
|
|
|
402
403
|
|
|
403
404
|
|
|
404
405
|
|
|
405
|
-
public async setGlobalVarValue(cpuName: string, varName: string, bytesNum:
|
|
406
|
+
public async setGlobalVarValue(cpuName: string, varName: string, bytesNum: number, valueType: GlobalVarType, value: string) {
|
|
406
407
|
try {
|
|
407
408
|
return await this.call(RequestFactory.getInstance().setGlobalVarValue(cpuName, varName, bytesNum, valueType, value))
|
|
408
409
|
} catch (error) {
|
|
@@ -415,7 +416,7 @@ export class SkyEyeClient extends JSONTransmissionClient {
|
|
|
415
416
|
const cpuList = (await this.getCpuList()).getCpuList();
|
|
416
417
|
if (cpuList != null && cpuList.length > 0) {
|
|
417
418
|
try {
|
|
418
|
-
return await this.call(RequestFactory.getInstance().setGlobalVarValue(cpuList[0].getName(), varName,
|
|
419
|
+
return await this.call(RequestFactory.getInstance().setGlobalVarValue(cpuList[0].getName(), varName, 8, valueType, value));
|
|
419
420
|
} catch (error) {
|
|
420
421
|
console.error("Error during setGlobalVarValueDefault:", error);
|
|
421
422
|
throw error;
|
|
@@ -427,14 +428,6 @@ export class SkyEyeClient extends JSONTransmissionClient {
|
|
|
427
428
|
}
|
|
428
429
|
|
|
429
430
|
|
|
430
|
-
public async getMemoryValue(cpuName: string, baseAddr: string, length: string) {
|
|
431
|
-
try {
|
|
432
|
-
return this.getAddressingSpace(cpuName, baseAddr, length);
|
|
433
|
-
} catch (error) {
|
|
434
|
-
console.error("Error during getMemoryValue:", error);
|
|
435
|
-
throw error;
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
431
|
|
|
439
432
|
|
|
440
433
|
public async getAddressingSpace(cpuName: string, baseAddr: string, length: string) {
|
|
@@ -445,9 +438,14 @@ export class SkyEyeClient extends JSONTransmissionClient {
|
|
|
445
438
|
throw error;
|
|
446
439
|
}
|
|
447
440
|
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
441
|
+
public async getMemoryValue(cpuName: string, baseAddr: string, length: string) {
|
|
442
|
+
try {
|
|
443
|
+
return this.getAddressingSpace(cpuName, baseAddr, length);
|
|
444
|
+
} catch (error) {
|
|
445
|
+
console.error("Error during getMemoryValue:", error);
|
|
446
|
+
throw error;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
451
449
|
public async getMemoryValueDefault(baseAddr: string, length: string) {
|
|
452
450
|
try {
|
|
453
451
|
return this.getAddressingSpaceDefault(baseAddr, length);
|
|
@@ -456,8 +454,6 @@ export class SkyEyeClient extends JSONTransmissionClient {
|
|
|
456
454
|
throw error;
|
|
457
455
|
}
|
|
458
456
|
}
|
|
459
|
-
|
|
460
|
-
|
|
461
457
|
public async getAddressingSpaceDefault(baseAddr: string, length: string) {
|
|
462
458
|
const cpuList = (await this.getCpuList()).getCpuList();
|
|
463
459
|
if (cpuList != null && cpuList.length > 0) {
|
|
@@ -473,6 +469,30 @@ export class SkyEyeClient extends JSONTransmissionClient {
|
|
|
473
469
|
}
|
|
474
470
|
}
|
|
475
471
|
|
|
472
|
+
public async setMemoryValue(cpuName: string, baseAddr: string, value: string, length: string) {
|
|
473
|
+
try {
|
|
474
|
+
return await this.call(RequestFactory.getInstance().setMemoryValue(cpuName, baseAddr, value, length));
|
|
475
|
+
} catch (error) {
|
|
476
|
+
console.error("Error during getAddressingSpaceDefault:", error);
|
|
477
|
+
throw error;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
public async setMemoryValueDefault(baseAddr: string, value: string, length: string) {
|
|
481
|
+
const cpuList = (await this.getCpuList()).getCpuList();
|
|
482
|
+
if (cpuList != null && cpuList.length > 0) {
|
|
483
|
+
try {
|
|
484
|
+
return await this.setMemoryValue(cpuList[0].getName(), baseAddr, value, length)
|
|
485
|
+
} catch (error) {
|
|
486
|
+
console.error("Error during getAddressingSpaceDefault:", error);
|
|
487
|
+
throw error;
|
|
488
|
+
}
|
|
489
|
+
} else {
|
|
490
|
+
console.error("无法获取cpu,请确认cpu是否存在:");
|
|
491
|
+
throw new SkyEyeSDKException("无法获取cpu,请确认cpu是否存在:");
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
|
|
476
496
|
|
|
477
497
|
public async getCpuRegisters(cpuName: string) {
|
|
478
498
|
const response = new GetCpuRegisterInfoResponse();
|
|
@@ -555,14 +575,14 @@ export class SkyEyeClient extends JSONTransmissionClient {
|
|
|
555
575
|
if (!deviceTree.boardMap.has(boardName)) {
|
|
556
576
|
throw new SkyEyeSDKException("未能找到该板卡");
|
|
557
577
|
}
|
|
558
|
-
const board = boardMap.get(boardName);
|
|
559
|
-
const deviceMap = board.
|
|
560
|
-
if (!deviceMap.has(cpuName) || !(deviceMap.get(cpuName) instanceof Cpu)) {
|
|
561
|
-
|
|
562
|
-
}
|
|
563
|
-
const cpu = deviceMap.get(cpuName);
|
|
578
|
+
// const board: Board = boardMap.get(boardName);
|
|
579
|
+
// const deviceMap = board.deviceMap;
|
|
580
|
+
// if (!deviceMap.has(cpuName) || !(deviceMap.get(cpuName) instanceof Cpu)) {
|
|
581
|
+
// throw new SkyEyeSDKException("未能找到该设备");
|
|
582
|
+
// }
|
|
583
|
+
// const cpu = deviceMap.get(cpuName);
|
|
564
584
|
try {
|
|
565
|
-
return await this.call(RequestFactory.getInstance().setRegisterValue(
|
|
585
|
+
return await this.call(RequestFactory.getInstance().setRegisterValue(boardName, cpuName, registerName, value));
|
|
566
586
|
} catch (error) {
|
|
567
587
|
console.error("Error during getAddressingSpace:", error);
|
|
568
588
|
throw error;
|
package/test.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { JSONResponse } from "./src/proto/skyeye_rpc_pb";
|
|
2
2
|
import { GrpcUtil } from "./src/GrpcUtil";
|
|
3
3
|
import { ServiceError } from "@grpc/grpc-js";
|
|
4
|
+
import { Enum } from "protobufjs";
|
|
4
5
|
|
|
5
6
|
const { SkyEyeClientFactory } = require('./src/SkyEyeClientFactory')
|
|
6
7
|
const { SkyEyeClient } = require('./src/SkyEyeClient')
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
const { Cpu } = require('./src/models/Cpu')
|
|
9
10
|
|
|
10
11
|
const json = {
|
|
11
12
|
"id": "4a162d75-3a84-5264-992f-287624830ead",
|
|
@@ -180,9 +181,95 @@ const json = {
|
|
|
180
181
|
}
|
|
181
182
|
|
|
182
183
|
|
|
184
|
+
class RegisterItem {
|
|
185
|
+
name: string;
|
|
186
|
+
type: RegisterType; //0 cpu寄存器 1 设备寄存器
|
|
187
|
+
deviceName: string; //设备名称
|
|
188
|
+
boardName: string;
|
|
189
|
+
}
|
|
183
190
|
|
|
184
|
-
|
|
191
|
+
enum RegisterType {
|
|
192
|
+
CPU,
|
|
193
|
+
Device
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
async function getAllRegisterList() {
|
|
199
|
+
const allRegister: RegisterItem[] = [];
|
|
200
|
+
const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
|
|
201
|
+
|
|
202
|
+
//通过 getDeviceTree 获取板卡、设备、寄存器层级, 列出所有寄存器列表选择
|
|
203
|
+
|
|
204
|
+
const resultTree = await client.getDeviceTree()
|
|
205
|
+
console.log("结果 resultTree:", JSON.stringify(resultTree))
|
|
206
|
+
console.log("结果 keys:", resultTree.boardMap.keys())
|
|
207
|
+
|
|
208
|
+
for (const key of resultTree.boardMap.keys()) {
|
|
209
|
+
const device = resultTree.boardMap.get(key);
|
|
210
|
+
// 在这里对获取到的键值对进行处理
|
|
211
|
+
console.log(`板卡: ${key},设备: ${device.deviceMap}`);
|
|
212
|
+
|
|
213
|
+
if (!device.deviceMap || device.deviceMap.keys().length == 0) {
|
|
214
|
+
continue
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
for (const k of device.deviceMap.keys()) {
|
|
218
|
+
const register = device.deviceMap.get(k);
|
|
219
|
+
console.log(`设备: ${k}, 寄存器: ${register}`);
|
|
220
|
+
console.log("寄存器下的寄存器: ", register.registerMap)
|
|
221
|
+
if (!register.registerMap || register.registerMap.keys().length == 0) {
|
|
222
|
+
continue
|
|
223
|
+
}
|
|
224
|
+
getRegisterMap(register, allRegister)
|
|
225
|
+
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
console.log("allRegister2:", allRegister.length)
|
|
229
|
+
return allRegister;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
function getRegisterMap(bean: any, allRegister: RegisterItem[]) {
|
|
235
|
+
if (!bean.registerMap || bean.registerMap.keys().length == 0) {
|
|
236
|
+
return
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
for (const r of bean.registerMap.keys()) {
|
|
240
|
+
const result = bean.registerMap.get(r);
|
|
241
|
+
console.log(`设备: ${r}, 寄存器: ${result}`);
|
|
242
|
+
|
|
243
|
+
const item = new RegisterItem()
|
|
244
|
+
item.name = r.name
|
|
245
|
+
|
|
246
|
+
if (bean instanceof Cpu) {
|
|
247
|
+
console.log(`寄存器类型: ${bean.className}`);
|
|
248
|
+
item.type = RegisterType.CPU
|
|
249
|
+
} else {
|
|
250
|
+
item.type = RegisterType.Device
|
|
251
|
+
}
|
|
252
|
+
allRegister.push(item)
|
|
253
|
+
getRegisterMap(result, allRegister)
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
async function setRegister() {
|
|
261
|
+
const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
|
|
262
|
+
const result = await client.setCpuRegisterValue('c6713_0', 'c67x_core_0', 'FADCR_REG', '3')
|
|
263
|
+
console.log("setRegister:", result)
|
|
264
|
+
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// getAllRegisterList()
|
|
268
|
+
setRegister()
|
|
185
269
|
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
async function test() {
|
|
186
273
|
// console.log("Connected to SkyEye server");
|
|
187
274
|
// await client.getDeviceList();
|
|
188
275
|
// await client.getCurrentCpuMips();
|
|
@@ -202,10 +289,6 @@ async function test() {
|
|
|
202
289
|
|
|
203
290
|
|
|
204
291
|
// await client.initSkyEyeAndRun(pathSkyEye,fileName,port,skyeyeDir);
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
292
|
// const pathSkyEye = "D:/data/case/c6713_demo";
|
|
210
293
|
// const fileName = "c6713_demo.skyeye";
|
|
211
294
|
// const skyeyeDir = "D:/install/skyeye/opt/skyeye/bin/skyeye.exe"
|
|
@@ -215,68 +298,81 @@ async function test() {
|
|
|
215
298
|
// const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
|
|
216
299
|
// await client.initSkyEyeAndRun2(pathSkyEye, fileName, port, skyeyeDir)
|
|
217
300
|
|
|
218
|
-
const pathSkyEye = "D:/data/case/workspace_c6713/targets/c6713_fc_1553b";
|
|
219
|
-
const fileName = "c6713_fc_1553b.skyeye";
|
|
220
|
-
const skyeyeDir = "D:/install/skyeye/opt/skyeye/bin/skyeye.exe"
|
|
301
|
+
// const pathSkyEye = "D:/data/case/workspace_c6713/targets/c6713_fc_1553b";
|
|
302
|
+
// const fileName = "c6713_fc_1553b.skyeye";
|
|
303
|
+
// const skyeyeDir = "D:/install/skyeye/opt/skyeye/bin/skyeye.exe"
|
|
221
304
|
|
|
222
305
|
|
|
223
|
-
const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
|
|
306
|
+
// const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
|
|
307
|
+
|
|
224
308
|
// const response =await client.getCurrentRunningState()
|
|
225
309
|
// const response = await client.getMemoryValueDefault("128","4")
|
|
226
|
-
const response = await client.getGlobalVarValueDefault("
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
//启动多个skyeye
|
|
231
|
-
// const count = 5;
|
|
232
|
-
// const map = new Map<number, any>;
|
|
233
|
-
// for (let i = 1; i < count; i++) {
|
|
234
|
-
// const port = 50050 + i
|
|
235
|
-
// const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', port.toString());
|
|
236
|
-
// await client.initSkyEyeAndRun2(pathSkyEye, fileName, port.toString(), skyeyeDir)
|
|
237
|
-
// await client.RunTestcase(json)
|
|
238
|
-
// await client.runCommand()
|
|
239
|
-
// const res = await client.getCurrentRunningState()
|
|
240
|
-
// console.log("state3:", res.state)
|
|
241
|
-
// map.set(port, client);
|
|
242
|
-
// }
|
|
243
|
-
// for (let i = 1; i < count; i++) {
|
|
244
|
-
// setTimeout(async () => {
|
|
245
|
-
// const port = 50050 + i
|
|
246
|
-
// const client = map.get(port)
|
|
247
|
-
// await client.quitCommand()
|
|
248
|
-
// }, i * 5000)
|
|
249
|
-
// }
|
|
310
|
+
// const response = await client.getGlobalVarValueDefault("number_a","int")
|
|
311
|
+
// const response = await client.setGlobalVarValueDefault("number_a", "int", "12")
|
|
250
312
|
|
|
313
|
+
// const response = await client.getDeviceTree()
|
|
251
314
|
|
|
252
315
|
|
|
316
|
+
// const response = await client.getMemoryValueDefault("10001", "1")
|
|
317
|
+
// console.log("response:", response)
|
|
318
|
+
// console.log("response:", response.boardMap)
|
|
319
|
+
// console.log("response:", response.boardMap.keys[0])
|
|
320
|
+
}
|
|
253
321
|
|
|
254
322
|
|
|
255
323
|
|
|
256
|
-
// setTimeout(async () => {
|
|
257
|
-
// // await map.get(50051).stopGrpcService("")
|
|
258
|
-
// await map.get(50051).quitCommand()
|
|
259
|
-
// }, 2000)
|
|
260
324
|
|
|
261
|
-
// setTimeout(async () => {
|
|
262
|
-
// // await map.get(50052).stopGrpcService("")
|
|
263
|
-
// await map.get(50052).quitCommand()
|
|
264
|
-
// }, 5000)
|
|
265
325
|
|
|
266
|
-
// setTimeout(async () => {
|
|
267
|
-
// // await map.get(50053).stopGrpcService("")
|
|
268
|
-
// await map.get(50053).quitCommand()
|
|
269
|
-
// }, 8000)
|
|
270
326
|
|
|
271
|
-
// setTimeout(async () => {
|
|
272
|
-
// // await map.get(50054).stopGrpcService("")
|
|
273
|
-
// await map.get(50054).quitCommand()
|
|
274
|
-
// }, 11000)
|
|
275
327
|
|
|
276
328
|
|
|
277
|
-
}
|
|
278
|
-
test();
|
|
279
329
|
|
|
330
|
+
async function testMutil() {
|
|
280
331
|
|
|
332
|
+
const pathSkyEye = "D:/data/case/workspace_c6713/targets/c6713_fc_1553b";
|
|
333
|
+
const fileName = "c6713_fc_1553b.skyeye";
|
|
334
|
+
const skyeyeDir = "D:/install/skyeye/opt/skyeye/bin/skyeye.exe"
|
|
335
|
+
const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
|
|
281
336
|
|
|
282
337
|
|
|
338
|
+
//启动多个skyeye
|
|
339
|
+
const count = 5;
|
|
340
|
+
const map = new Map<number, any>;
|
|
341
|
+
for (let i = 1; i < count; i++) {
|
|
342
|
+
const port = 50050 + i
|
|
343
|
+
const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', port.toString());
|
|
344
|
+
await client.initSkyEyeAndRun2(pathSkyEye, fileName, port.toString(), skyeyeDir)
|
|
345
|
+
await client.RunTestcase(json)
|
|
346
|
+
await client.runCommand()
|
|
347
|
+
const res = await client.getCurrentRunningState()
|
|
348
|
+
console.log("state3:", res.state)
|
|
349
|
+
map.set(port, client);
|
|
350
|
+
}
|
|
351
|
+
for (let i = 1; i < count; i++) {
|
|
352
|
+
setTimeout(async () => {
|
|
353
|
+
const port = 50050 + i
|
|
354
|
+
const client = map.get(port)
|
|
355
|
+
await client.quitCommand()
|
|
356
|
+
}, i * 5000)
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
setTimeout(async () => {
|
|
360
|
+
// await map.get(50051).stopGrpcService("")
|
|
361
|
+
await map.get(50051).quitCommand()
|
|
362
|
+
}, 2000)
|
|
363
|
+
|
|
364
|
+
setTimeout(async () => {
|
|
365
|
+
// await map.get(50052).stopGrpcService("")
|
|
366
|
+
await map.get(50052).quitCommand()
|
|
367
|
+
}, 5000)
|
|
368
|
+
|
|
369
|
+
setTimeout(async () => {
|
|
370
|
+
// await map.get(50053).stopGrpcService("")
|
|
371
|
+
await map.get(50053).quitCommand()
|
|
372
|
+
}, 8000)
|
|
373
|
+
|
|
374
|
+
setTimeout(async () => {
|
|
375
|
+
// await map.get(50054).stopGrpcService("")
|
|
376
|
+
await map.get(50054).quitCommand()
|
|
377
|
+
}, 11000)
|
|
378
|
+
}
|