skyeye-sdk-js 1.0.5 → 1.0.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/SkyEyeClient.d.ts +2 -1
- package/dist/SkyEyeClient.js +2 -2
- package/dist/src/GrpcUtil.d.ts +1 -0
- package/dist/src/GrpcUtil.js +58 -0
- package/dist/src/SkyEyeClient.d.ts +1 -0
- package/dist/src/SkyEyeClient.js +35 -1
- package/dist/test.d.ts +1 -0
- package/dist/test.js +33 -0
- package/package.json +2 -2
- package/src/GrpcUtil.ts +45 -1
- package/src/RequestFactory.ts +0 -4
- package/src/SkyEyeClient.ts +38 -6
- package/src/exception/SkyEyeSDKException.js +23 -5
- package/src/models/Board.js +12 -9
- package/src/models/Cpu.js +42 -23
- package/src/models/Device.js +13 -12
- package/src/models/FaultInjectItem.js +4 -3
- package/src/models/FaultInjectType.js +1 -1
- package/src/models/InstructionItem.js +5 -2
- package/src/models/Register.js +19 -18
- package/src/response/BaseResponse.js +23 -3
- package/src/response/GetAllDeviceInfoResponse.js +24 -6
- package/src/response/GetCpuListResponse.js +29 -11
- package/src/response/GetCpuRegisterInfoResponse.js +24 -6
- package/src/response/GetDeviceListResponse.js +24 -6
- package/src/response/GetDeviceTreeResponse.js +24 -6
- package/src/response/GetDisassembleInfoResponse.js +23 -3
- package/src/response/GetFaultInjectListResponse.js +35 -13
- package/src/response/GetRamAddrInfoResponse.js +23 -3
- package/src/response/GetRunningStateResponse.js +43 -25
- package/src/{test.js → test1.js} +7 -4
- package/src/utils/ParseBoardUtils.js +33 -30
- package/test.ts +31 -0
- package/src/GrpcUtil.js +0 -55
- package/src/JsonRequest.js +0 -29
- package/src/JsonResponse.js +0 -36
- package/src/RequestFactory.js +0 -257
- package/src/SkyEyeClient.js +0 -831
- package/src/SkyEyeClientFactory.js +0 -53
- package/src/requests/BaseRequest.js +0 -18
- /package/dist/{proto → src/proto}/skyeye_rpc.proto +0 -0
- /package/dist/{proto → src/proto}/skyeye_rpc_grpc_pb.d.ts +0 -0
- /package/dist/{proto → src/proto}/skyeye_rpc_grpc_pb.js +0 -0
- /package/dist/{proto → src/proto}/skyeye_rpc_pb.d.ts +0 -0
- /package/dist/{proto → src/proto}/skyeye_rpc_pb.js +0 -0
package/dist/SkyEyeClient.d.ts
CHANGED
|
@@ -14,7 +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
|
-
|
|
17
|
+
declare class SkyEyeClient extends JSONTransmissionClient {
|
|
18
18
|
private host;
|
|
19
19
|
private port;
|
|
20
20
|
constructor(host: string, port: string);
|
|
@@ -68,3 +68,4 @@ export declare class SkyEyeClient extends JSONTransmissionClient {
|
|
|
68
68
|
getHost(): string;
|
|
69
69
|
getPort(): string;
|
|
70
70
|
}
|
|
71
|
+
export { SkyEyeClient };
|
package/dist/SkyEyeClient.js
CHANGED
|
@@ -58,7 +58,7 @@ let client = null;
|
|
|
58
58
|
const boardMap = new Map();
|
|
59
59
|
class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
|
|
60
60
|
constructor(host, port) {
|
|
61
|
-
super(host + ":" + port, grpc.credentials.createInsecure());
|
|
61
|
+
super(host + ":" + port, grpc.credentials.createInsecure(), null);
|
|
62
62
|
this.host = host;
|
|
63
63
|
this.port = port;
|
|
64
64
|
}
|
|
@@ -560,7 +560,7 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
|
|
|
560
560
|
}
|
|
561
561
|
getDeviceTree() {
|
|
562
562
|
return __awaiter(this, void 0, void 0, function* () {
|
|
563
|
-
const state = (yield this.
|
|
563
|
+
const state = (yield this.getCurrentRunningState()).getState();
|
|
564
564
|
if (GetRunningStateResponse_1.StateState.UNLOADED === state || GetRunningStateResponse_1.StateState.QUITED === state) {
|
|
565
565
|
throw new SkyEyeSDKException_1.SkyEyeSDKException("当前SkyEye未加载配置,需要加载配置可以获取设备树信息,请检查当前配置");
|
|
566
566
|
}
|
package/dist/src/GrpcUtil.d.ts
CHANGED
package/dist/src/GrpcUtil.js
CHANGED
|
@@ -1,14 +1,72 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.GrpcUtil = void 0;
|
|
27
|
+
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
4
28
|
const skyeye_rpc_pb_1 = require("./proto/skyeye_rpc_pb");
|
|
29
|
+
const skyeye_rpc_grpc_pb_1 = require("./proto/skyeye_rpc_grpc_pb");
|
|
5
30
|
const SkyEyeClient_1 = require("./SkyEyeClient");
|
|
6
31
|
let client = null;
|
|
32
|
+
const cp = __importStar(require("child_process"));
|
|
7
33
|
class GrpcUtil {
|
|
8
34
|
constructor(host, port) {
|
|
9
35
|
this.Jr = new skyeye_rpc_pb_1.JSONRequest();
|
|
10
36
|
client = new SkyEyeClient_1.SkyEyeClient(host, port);
|
|
11
37
|
}
|
|
38
|
+
static initAndRunExample() {
|
|
39
|
+
// const pathSkyEye = "D:/install/SkyEye/demo/c6713_demo";
|
|
40
|
+
const pathSkyEye = "D:/data/case/c6713_demo";
|
|
41
|
+
const fileName = "c6713_demo.skyeye";
|
|
42
|
+
console.log('runExample');
|
|
43
|
+
// const output = vscode.window.createOutputChannel("SkyEye Output");
|
|
44
|
+
// output.show(true);
|
|
45
|
+
// 命令行,进实例,跑skyeye.exe
|
|
46
|
+
cp.exec("cd " + pathSkyEye + " / && skyeye.exe -q 50051\n", (err, stdout, stderr) => {
|
|
47
|
+
// output.append(stdout);
|
|
48
|
+
// output.append(stderr);
|
|
49
|
+
console.log('stdout: ' + stdout);
|
|
50
|
+
console.log('stderr: ' + stderr);
|
|
51
|
+
});
|
|
52
|
+
setTimeout(() => {
|
|
53
|
+
//客户端
|
|
54
|
+
client = new skyeye_rpc_grpc_pb_1.JSONTransmissionClient('127.0.0.1:50051', grpc.credentials.createInsecure());
|
|
55
|
+
console.log('client:' + client);
|
|
56
|
+
//chdir
|
|
57
|
+
const Jr = new skyeye_rpc_pb_1.JSONRequest();
|
|
58
|
+
Jr.setRequest("{\"request\": {\"name\": \"chdir\", \"args\": {\"path\":\"" + pathSkyEye + "\"}}}");
|
|
59
|
+
client.callSkyEye(Jr, (error, response) => {
|
|
60
|
+
console.log("chdir res:" + response + error);
|
|
61
|
+
// client.run_script();
|
|
62
|
+
Jr.setRequest("{\"request\": {\"name\": \"run_script\", \"args\": {\"filename\":\"" + fileName + "\"}}}");
|
|
63
|
+
client.callSkyEye(Jr, (error, response) => {
|
|
64
|
+
console.log("run_script res:" + response + error);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}, 2000);
|
|
68
|
+
return "1";
|
|
69
|
+
}
|
|
12
70
|
//status
|
|
13
71
|
getRunningStatus() {
|
|
14
72
|
this.Jr.setRequest("{\"request\": {\"name\": \"SE_get_running_status\", \"args\": {}}}");
|
package/dist/src/SkyEyeClient.js
CHANGED
|
@@ -34,6 +34,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
exports.SkyEyeClient = void 0;
|
|
36
36
|
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
37
|
+
const skyeye_rpc_pb_1 = require("./proto/skyeye_rpc_pb");
|
|
37
38
|
const skyeye_rpc_grpc_pb_1 = require("./proto/skyeye_rpc_grpc_pb");
|
|
38
39
|
const RequestFactory_1 = require("./RequestFactory");
|
|
39
40
|
const GetCpuListResponse_1 = require("./response/GetCpuListResponse");
|
|
@@ -53,12 +54,13 @@ const GetDisassembleInfoResponse_1 = require("./response/GetDisassembleInfoRespo
|
|
|
53
54
|
const InstructionItem_1 = require("./models/InstructionItem");
|
|
54
55
|
const GetCpuRegisterInfoResponse_1 = require("./response/GetCpuRegisterInfoResponse");
|
|
55
56
|
const SkyEyeSDKException_1 = require("./exception/SkyEyeSDKException");
|
|
57
|
+
const cp = __importStar(require("child_process"));
|
|
56
58
|
let client = null;
|
|
57
59
|
// ----------------------------当前运行程序的设备树----------------------------------------//
|
|
58
60
|
const boardMap = new Map();
|
|
59
61
|
class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
|
|
60
62
|
constructor(host, port) {
|
|
61
|
-
super(host + ":" + port, grpc.credentials.createInsecure());
|
|
63
|
+
super(host + ":" + port, grpc.credentials.createInsecure(), null);
|
|
62
64
|
this.host = host;
|
|
63
65
|
this.port = port;
|
|
64
66
|
}
|
|
@@ -827,5 +829,37 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
|
|
|
827
829
|
getPort() {
|
|
828
830
|
return this.port;
|
|
829
831
|
}
|
|
832
|
+
initAndRunExample() {
|
|
833
|
+
// const pathSkyEye = "D:/install/SkyEye/demo/c6713_demo";
|
|
834
|
+
const pathSkyEye = "D:/data/case/c6713_demo";
|
|
835
|
+
const fileName = "c6713_demo.skyeye";
|
|
836
|
+
console.log('runExample');
|
|
837
|
+
// const output = vscode.window.createOutputChannel("SkyEye Output");
|
|
838
|
+
// output.show(true);
|
|
839
|
+
// 命令行,进实例,跑skyeye.exe
|
|
840
|
+
cp.exec("cd " + pathSkyEye + " / && skyeye.exe -q 50051\n", (err, stdout, stderr) => {
|
|
841
|
+
// output.append(stdout);
|
|
842
|
+
// output.append(stderr);
|
|
843
|
+
console.log('stdout: ' + stdout);
|
|
844
|
+
console.log('stderr: ' + stderr);
|
|
845
|
+
});
|
|
846
|
+
setTimeout(() => {
|
|
847
|
+
//客户端
|
|
848
|
+
client = new skyeye_rpc_grpc_pb_1.JSONTransmissionClient('127.0.0.1:50051', grpc.credentials.createInsecure());
|
|
849
|
+
console.log('client:' + client);
|
|
850
|
+
//chdir
|
|
851
|
+
const Jr = new skyeye_rpc_pb_1.JSONRequest();
|
|
852
|
+
Jr.setRequest("{\"request\": {\"name\": \"chdir\", \"args\": {\"path\":\"" + pathSkyEye + "\"}}}");
|
|
853
|
+
client.callSkyEye(Jr, (error, response) => {
|
|
854
|
+
console.log("chdir res:" + response + error);
|
|
855
|
+
// client.run_script();
|
|
856
|
+
Jr.setRequest("{\"request\": {\"name\": \"run_script\", \"args\": {\"filename\":\"" + fileName + "\"}}}");
|
|
857
|
+
client.callSkyEye(Jr, (error, response) => {
|
|
858
|
+
console.log("run_script res:" + response + error);
|
|
859
|
+
});
|
|
860
|
+
});
|
|
861
|
+
}, 2000);
|
|
862
|
+
return "1";
|
|
863
|
+
}
|
|
830
864
|
}
|
|
831
865
|
exports.SkyEyeClient = SkyEyeClient;
|
package/dist/test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/test.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const { SkyEyeClientFactory } = require('./src/SkyEyeClientFactory');
|
|
13
|
+
const { SkyEyeClient } = require('./src/SkyEyeClient');
|
|
14
|
+
function test() {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
|
|
17
|
+
console.log("Connected to SkyEye server");
|
|
18
|
+
// await client.getDeviceList();
|
|
19
|
+
// await client.getCurrentCpuMips();
|
|
20
|
+
// await client.runCommand();
|
|
21
|
+
// const response = await client.getCurrentRunningState();
|
|
22
|
+
// const response = await client.getGlobalVarValueDefault("a",GlobalVarType.DOUBLE);
|
|
23
|
+
// const response = await client.getGlobalVarValue("cx53123","a",16,GlobalVarType.DOUBLE);
|
|
24
|
+
// const response = await client.getCpuRegistersDefault();
|
|
25
|
+
// const response = await client.getCpuRegisters("c7xx");
|
|
26
|
+
// const response = await client.getMemoryValueDefault(1, 16);
|
|
27
|
+
// const response = await client.getMemoryValue("c7s",0,16);
|
|
28
|
+
// console.log("结果response:", response)
|
|
29
|
+
yield client.initAndRunExample();
|
|
30
|
+
// GrpcUtil.initAndRunExample();
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
test();
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skyeye-sdk-js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
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
|
|
10
|
+
"dev": "tsc & node dist/test.js",
|
|
11
11
|
"release": "tsc && npm publish"
|
|
12
12
|
},
|
|
13
13
|
"keywords": [],
|
package/src/GrpcUtil.ts
CHANGED
|
@@ -3,7 +3,8 @@ import { JSONRequest, JSONResponse } from './proto/skyeye_rpc_pb';
|
|
|
3
3
|
import { JSONTransmissionService, JSONTransmissionClient } from './proto/skyeye_rpc_grpc_pb';
|
|
4
4
|
import { SkyEyeClient } from './SkyEyeClient';
|
|
5
5
|
let client: SkyEyeClient | any = null;
|
|
6
|
-
|
|
6
|
+
import * as cp from 'child_process';
|
|
7
|
+
import { ServiceError } from '@grpc/grpc-js';
|
|
7
8
|
|
|
8
9
|
export class GrpcUtil {
|
|
9
10
|
|
|
@@ -12,6 +13,49 @@ export class GrpcUtil {
|
|
|
12
13
|
constructor(host: string, port: string) {
|
|
13
14
|
client = new SkyEyeClient(host, port);
|
|
14
15
|
}
|
|
16
|
+
|
|
17
|
+
public static initAndRunExample() {
|
|
18
|
+
// const pathSkyEye = "D:/install/SkyEye/demo/c6713_demo";
|
|
19
|
+
const pathSkyEye = "D:/data/case/c6713_demo";
|
|
20
|
+
const fileName = "c6713_demo.skyeye";
|
|
21
|
+
console.log('runExample');
|
|
22
|
+
// const output = vscode.window.createOutputChannel("SkyEye Output");
|
|
23
|
+
// output.show(true);
|
|
24
|
+
// 命令行,进实例,跑skyeye.exe
|
|
25
|
+
|
|
26
|
+
cp.exec("cd " + pathSkyEye + " / && skyeye.exe -q 50051\n", (err: any, stdout: any, stderr: any) => {
|
|
27
|
+
// output.append(stdout);
|
|
28
|
+
// output.append(stderr);
|
|
29
|
+
console.log('stdout: ' + stdout);
|
|
30
|
+
console.log('stderr: ' + stderr);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
|
|
35
|
+
//客户端
|
|
36
|
+
client = new JSONTransmissionClient('127.0.0.1:50051', grpc.credentials.createInsecure());
|
|
37
|
+
console.log('client:' + client);
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
//chdir
|
|
41
|
+
const Jr = new JSONRequest();
|
|
42
|
+
Jr.setRequest("{\"request\": {\"name\": \"chdir\", \"args\": {\"path\":\"" + pathSkyEye + "\"}}}");
|
|
43
|
+
client.callSkyEye(Jr, (error: ServiceError | null, response: JSONResponse) => {
|
|
44
|
+
console.log("chdir res:" + response + error);
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
// client.run_script();
|
|
48
|
+
|
|
49
|
+
Jr.setRequest("{\"request\": {\"name\": \"run_script\", \"args\": {\"filename\":\"" + fileName + "\"}}}");
|
|
50
|
+
client.callSkyEye(Jr, (error: ServiceError | null, response: JSONResponse) => {
|
|
51
|
+
console.log("run_script res:" + response + error);
|
|
52
|
+
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}, 2000);
|
|
56
|
+
return "1";
|
|
57
|
+
}
|
|
58
|
+
|
|
15
59
|
|
|
16
60
|
|
|
17
61
|
//status
|
package/src/RequestFactory.ts
CHANGED
package/src/SkyEyeClient.ts
CHANGED
|
@@ -19,9 +19,10 @@ import { FaultInjectItem } from './models/FaultInjectItem';
|
|
|
19
19
|
import { GetFaultInjectListResponse } from './response/GetFaultInjectListResponse';
|
|
20
20
|
import { GetDisassembleInfoResponse } from './response/GetDisassembleInfoResponse';
|
|
21
21
|
import { InstructionItem } from './models/InstructionItem';
|
|
22
|
-
import { cp } from 'fs';
|
|
23
22
|
import { GetCpuRegisterInfoResponse } from './response/GetCpuRegisterInfoResponse';
|
|
24
23
|
import { SkyEyeSDKException } from './exception/SkyEyeSDKException';
|
|
24
|
+
import { ServiceError } from '@grpc/grpc-js';
|
|
25
|
+
import * as cp from 'child_process';
|
|
25
26
|
let client: JSONTransmissionClient | any = null;
|
|
26
27
|
|
|
27
28
|
|
|
@@ -36,7 +37,7 @@ export class SkyEyeClient extends JSONTransmissionClient {
|
|
|
36
37
|
|
|
37
38
|
|
|
38
39
|
constructor(host: string, port: string) {
|
|
39
|
-
super(host + ":" + port, grpc.credentials.createInsecure());
|
|
40
|
+
super(host + ":" + port, grpc.credentials.createInsecure(),null);
|
|
40
41
|
this.host = host;
|
|
41
42
|
this.port = port;
|
|
42
43
|
}
|
|
@@ -225,7 +226,7 @@ export class SkyEyeClient extends JSONTransmissionClient {
|
|
|
225
226
|
const response = new GetDeviceListResponse();
|
|
226
227
|
try {
|
|
227
228
|
const call = await this.call(RequestFactory.getInstance().getDeviceList());
|
|
228
|
-
console.log("getDeviceList:",call)
|
|
229
|
+
console.log("getDeviceList:", call)
|
|
229
230
|
if (call != null) {
|
|
230
231
|
response.isSuccess = true;
|
|
231
232
|
const result = call.result;
|
|
@@ -253,7 +254,7 @@ export class SkyEyeClient extends JSONTransmissionClient {
|
|
|
253
254
|
}
|
|
254
255
|
}
|
|
255
256
|
}
|
|
256
|
-
|
|
257
|
+
|
|
257
258
|
} catch (error) {
|
|
258
259
|
console.error("Error during getPC:", error);
|
|
259
260
|
throw error;
|
|
@@ -443,7 +444,7 @@ export class SkyEyeClient extends JSONTransmissionClient {
|
|
|
443
444
|
if (r1.offset == null) {
|
|
444
445
|
return 1;
|
|
445
446
|
}
|
|
446
|
-
if (r2.offset== null) {
|
|
447
|
+
if (r2.offset == null) {
|
|
447
448
|
return -1;
|
|
448
449
|
}
|
|
449
450
|
if (r1.offset === r2.offset) {
|
|
@@ -638,7 +639,7 @@ export class SkyEyeClient extends JSONTransmissionClient {
|
|
|
638
639
|
throw error;
|
|
639
640
|
}
|
|
640
641
|
}
|
|
641
|
-
|
|
642
|
+
|
|
642
643
|
|
|
643
644
|
public async deleteFaultInjectDefault(faultInjectItem: FaultInjectItem) {
|
|
644
645
|
try {
|
|
@@ -769,4 +770,35 @@ export class SkyEyeClient extends JSONTransmissionClient {
|
|
|
769
770
|
return this.port;
|
|
770
771
|
}
|
|
771
772
|
|
|
773
|
+
public initAndRunExample() {
|
|
774
|
+
const pathSkyEye = "D:/data/case/c6713_demo";
|
|
775
|
+
const fileName = "c6713_demo.skyeye";
|
|
776
|
+
console.log('runExample');
|
|
777
|
+
cp.exec("cd " + pathSkyEye + " / && skyeye.exe -q 50051\n", (err: any, stdout: any, stderr: any) => {
|
|
778
|
+
console.log('stdout: ' + stdout);
|
|
779
|
+
console.log('stderr: ' + stderr);
|
|
780
|
+
});
|
|
781
|
+
setTimeout(() => {
|
|
782
|
+
|
|
783
|
+
//客户端
|
|
784
|
+
client = new JSONTransmissionClient('127.0.0.1:50051', grpc.credentials.createInsecure());
|
|
785
|
+
console.log('client:' + client);
|
|
786
|
+
|
|
787
|
+
//chdir
|
|
788
|
+
const Jr = new JSONRequest();
|
|
789
|
+
Jr.setRequest("{\"request\": {\"name\": \"chdir\", \"args\": {\"path\":\"" + pathSkyEye + "\"}}}");
|
|
790
|
+
client.callSkyEye(Jr, (error: ServiceError | null, response: JSONResponse) => {
|
|
791
|
+
console.log("chdir res:" + response + error);
|
|
792
|
+
|
|
793
|
+
Jr.setRequest("{\"request\": {\"name\": \"run_script\", \"args\": {\"filename\":\"" + fileName + "\"}}}");
|
|
794
|
+
client.callSkyEye(Jr, (error: ServiceError | null, response: JSONResponse) => {
|
|
795
|
+
console.log("run_script res:" + response + error);
|
|
796
|
+
|
|
797
|
+
});
|
|
798
|
+
});
|
|
799
|
+
}, 2000);
|
|
800
|
+
return "1";
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
|
|
772
804
|
}
|
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
2
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
18
|
exports.SkyEyeSDKException = void 0;
|
|
4
19
|
// 定义 SkyEyeSDKException 类
|
|
5
|
-
|
|
6
|
-
|
|
20
|
+
var SkyEyeSDKException = /** @class */ (function (_super) {
|
|
21
|
+
__extends(SkyEyeSDKException, _super);
|
|
22
|
+
function SkyEyeSDKException(message) {
|
|
7
23
|
// 调用父类的构造函数
|
|
8
|
-
|
|
24
|
+
var _this = _super.call(this, message) || this;
|
|
9
25
|
// 设置类名
|
|
10
|
-
|
|
26
|
+
_this.name = 'SkyEyeSDKException';
|
|
27
|
+
return _this;
|
|
11
28
|
}
|
|
12
|
-
|
|
29
|
+
return SkyEyeSDKException;
|
|
30
|
+
}(Error));
|
|
13
31
|
exports.SkyEyeSDKException = SkyEyeSDKException;
|
package/src/models/Board.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Board = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return this.name;
|
|
4
|
+
var Board = /** @class */ (function () {
|
|
5
|
+
function Board() {
|
|
7
6
|
}
|
|
8
|
-
|
|
7
|
+
Board.prototype.getName = function () {
|
|
8
|
+
return this.name;
|
|
9
|
+
};
|
|
10
|
+
Board.prototype.getParent = function () {
|
|
9
11
|
return null;
|
|
10
|
-
}
|
|
11
|
-
toString() {
|
|
12
|
-
return
|
|
13
|
-
}
|
|
14
|
-
|
|
12
|
+
};
|
|
13
|
+
Board.prototype.toString = function () {
|
|
14
|
+
return "Board{name='".concat(this.name, "', deviceMap=").concat(this.deviceMap, "}");
|
|
15
|
+
};
|
|
16
|
+
return Board;
|
|
17
|
+
}());
|
|
15
18
|
exports.Board = Board;
|
package/src/models/Cpu.js
CHANGED
|
@@ -1,33 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
2
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
18
|
exports.Cpu = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
19
|
+
var Device_1 = require("./Device");
|
|
20
|
+
var Cpu = /** @class */ (function (_super) {
|
|
21
|
+
__extends(Cpu, _super);
|
|
22
|
+
function Cpu(info) {
|
|
23
|
+
var _this = this;
|
|
24
|
+
if (info) {
|
|
25
|
+
_this = _super.call(this, info) || this;
|
|
26
|
+
_this.className = info.className;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
_this = _super.call(this, null) || this;
|
|
30
|
+
}
|
|
31
|
+
return _this;
|
|
32
|
+
}
|
|
6
33
|
/**
|
|
7
34
|
* CPU类型
|
|
8
35
|
*/
|
|
9
36
|
// private className: string;
|
|
10
|
-
getClassName() {
|
|
37
|
+
Cpu.prototype.getClassName = function () {
|
|
11
38
|
return this.className;
|
|
12
|
-
}
|
|
13
|
-
setClassName(className) {
|
|
39
|
+
};
|
|
40
|
+
Cpu.prototype.setClassName = function (className) {
|
|
14
41
|
this.className = className;
|
|
15
|
-
}
|
|
16
|
-
setName(name) {
|
|
42
|
+
};
|
|
43
|
+
Cpu.prototype.setName = function (name) {
|
|
17
44
|
this.name = name;
|
|
18
|
-
}
|
|
19
|
-
setParent(parent) {
|
|
45
|
+
};
|
|
46
|
+
Cpu.prototype.setParent = function (parent) {
|
|
20
47
|
this.parent = parent;
|
|
21
|
-
}
|
|
22
|
-
constructor(info) {
|
|
23
|
-
if (info) {
|
|
24
|
-
super(info);
|
|
25
|
-
this.className = info.className;
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
super(null);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
48
|
+
};
|
|
31
49
|
// constructor(
|
|
32
50
|
// className: string,
|
|
33
51
|
// name: string,
|
|
@@ -40,8 +58,9 @@ class Cpu extends Device_1.Device {
|
|
|
40
58
|
// super(name, parent, registerMap, baseAddr, length, 'Cpu', state);
|
|
41
59
|
// this.className = className;
|
|
42
60
|
// }
|
|
43
|
-
toString() {
|
|
44
|
-
return
|
|
45
|
-
}
|
|
46
|
-
|
|
61
|
+
Cpu.prototype.toString = function () {
|
|
62
|
+
return "Cpu{className='".concat(this.className, "', name='").concat(this.name, "', parent=").concat(this.parent != null ? this.parent.getName() : null, ", registerMap=").concat(this.registerMap, ", state=").concat(this.state, "}");
|
|
63
|
+
};
|
|
64
|
+
return Cpu;
|
|
65
|
+
}(Device_1.Device));
|
|
47
66
|
exports.Cpu = Cpu;
|
package/src/models/Device.js
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Device = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return this.name;
|
|
7
|
-
}
|
|
8
|
-
getParent() {
|
|
9
|
-
return this.parent;
|
|
10
|
-
}
|
|
11
|
-
constructor(info) {
|
|
4
|
+
var Device = /** @class */ (function () {
|
|
5
|
+
function Device(info) {
|
|
12
6
|
if (info) {
|
|
13
7
|
this.name = info.name;
|
|
14
8
|
this.parent = info.parent;
|
|
@@ -19,8 +13,15 @@ class Device {
|
|
|
19
13
|
this.state = info.state;
|
|
20
14
|
}
|
|
21
15
|
}
|
|
22
|
-
|
|
23
|
-
return
|
|
24
|
-
}
|
|
25
|
-
|
|
16
|
+
Device.prototype.getName = function () {
|
|
17
|
+
return this.name;
|
|
18
|
+
};
|
|
19
|
+
Device.prototype.getParent = function () {
|
|
20
|
+
return this.parent;
|
|
21
|
+
};
|
|
22
|
+
Device.prototype.toString = function () {
|
|
23
|
+
return "Device{name='".concat(this.name, "', parent=").concat(this.parent != null ? this.parent.getName() : null, ", registerMap=").concat(this.registerMap, ", baseAddr=").concat(this.baseAddr, ", length=").concat(this.length, ", className='").concat(this.className, "', state=").concat(this.state, "}");
|
|
24
|
+
};
|
|
25
|
+
return Device;
|
|
26
|
+
}());
|
|
26
27
|
exports.Device = Device;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FaultInjectItem = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
var FaultInjectItem = /** @class */ (function () {
|
|
5
|
+
function FaultInjectItem(info) {
|
|
6
6
|
if (info) {
|
|
7
7
|
this.boardName = info.boardName;
|
|
8
8
|
this.deviceName = info.deviceName;
|
|
@@ -12,5 +12,6 @@ class FaultInjectItem {
|
|
|
12
12
|
this.type = info.type;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
return FaultInjectItem;
|
|
16
|
+
}());
|
|
16
17
|
exports.FaultInjectItem = FaultInjectItem;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InstructionItem = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
var InstructionItem = /** @class */ (function () {
|
|
5
|
+
function InstructionItem() {
|
|
6
|
+
}
|
|
7
|
+
return InstructionItem;
|
|
8
|
+
}());
|
|
6
9
|
exports.InstructionItem = InstructionItem;
|