skyeye-sdk-js 1.0.0

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.
Files changed (147) hide show
  1. package/.npmjgnore +2 -0
  2. package/dist/GrpcUtil.d.ts +9 -0
  3. package/dist/GrpcUtil.js +55 -0
  4. package/dist/JsonRequest.d.ts +10 -0
  5. package/dist/JsonRequest.js +29 -0
  6. package/dist/JsonResponse.d.ts +12 -0
  7. package/dist/JsonResponse.js +36 -0
  8. package/dist/RequestFactory.d.ts +35 -0
  9. package/dist/RequestFactory.js +257 -0
  10. package/dist/SkyEyeClient.d.ts +70 -0
  11. package/dist/SkyEyeClient.js +831 -0
  12. package/dist/SkyEyeClientFactory.d.ts +10 -0
  13. package/dist/SkyEyeClientFactory.js +53 -0
  14. package/dist/exception/SkyEyeSDKException.d.ts +3 -0
  15. package/dist/exception/SkyEyeSDKException.js +13 -0
  16. package/dist/models/Board.d.ts +9 -0
  17. package/dist/models/Board.js +15 -0
  18. package/dist/models/Cpu.d.ts +14 -0
  19. package/dist/models/Cpu.js +47 -0
  20. package/dist/models/CpuInterface.d.ts +13 -0
  21. package/dist/models/CpuInterface.js +2 -0
  22. package/dist/models/Device.d.ts +38 -0
  23. package/dist/models/Device.js +26 -0
  24. package/dist/models/DeviceInterface.d.ts +12 -0
  25. package/dist/models/DeviceInterface.js +2 -0
  26. package/dist/models/DeviceState.d.ts +4 -0
  27. package/dist/models/DeviceState.js +8 -0
  28. package/dist/models/FaultInjectItem.d.ts +11 -0
  29. package/dist/models/FaultInjectItem.js +16 -0
  30. package/dist/models/FaultInjectItemInterface.d.ts +9 -0
  31. package/dist/models/FaultInjectItemInterface.js +2 -0
  32. package/dist/models/FaultInjectType.d.ts +11 -0
  33. package/dist/models/FaultInjectType.js +25 -0
  34. package/dist/models/GlobalVarType.d.ts +5 -0
  35. package/dist/models/GlobalVarType.js +9 -0
  36. package/dist/models/InstructionItem.d.ts +5 -0
  37. package/dist/models/InstructionItem.js +6 -0
  38. package/dist/models/Node.d.ts +4 -0
  39. package/dist/models/Node.js +2 -0
  40. package/dist/models/Register.d.ts +38 -0
  41. package/dist/models/Register.js +32 -0
  42. package/dist/models/RegisterInterface.d.ts +10 -0
  43. package/dist/models/RegisterInterface.js +2 -0
  44. package/dist/requests/BaseRequest.d.ts +13 -0
  45. package/dist/requests/BaseRequest.js +18 -0
  46. package/dist/response/BaseResponse.d.ts +5 -0
  47. package/dist/response/BaseResponse.js +7 -0
  48. package/dist/response/GetAllDeviceInfoResponse.d.ts +5 -0
  49. package/dist/response/GetAllDeviceInfoResponse.js +11 -0
  50. package/dist/response/GetCpuListResponse.d.ts +8 -0
  51. package/dist/response/GetCpuListResponse.js +18 -0
  52. package/dist/response/GetCpuRegisterInfoResponse.d.ts +6 -0
  53. package/dist/response/GetCpuRegisterInfoResponse.js +11 -0
  54. package/dist/response/GetCurrentPCResponse.d.ts +4 -0
  55. package/dist/response/GetCurrentPCResponse.js +7 -0
  56. package/dist/response/GetDeviceListResponse.d.ts +6 -0
  57. package/dist/response/GetDeviceListResponse.js +11 -0
  58. package/dist/response/GetDeviceTreeResponse.d.ts +5 -0
  59. package/dist/response/GetDeviceTreeResponse.js +11 -0
  60. package/dist/response/GetDisassembleInfoResponse.d.ts +5 -0
  61. package/dist/response/GetDisassembleInfoResponse.js +7 -0
  62. package/dist/response/GetFaultInjectListResponse.d.ts +8 -0
  63. package/dist/response/GetFaultInjectListResponse.js +18 -0
  64. package/dist/response/GetRamAddrInfoResponse.d.ts +5 -0
  65. package/dist/response/GetRamAddrInfoResponse.js +7 -0
  66. package/dist/response/GetRunningStateResponse.d.ts +14 -0
  67. package/dist/response/GetRunningStateResponse.js +25 -0
  68. package/dist/utils/ParseBoardUtils.d.ts +6 -0
  69. package/dist/utils/ParseBoardUtils.js +108 -0
  70. package/index.js +9 -0
  71. package/package.json +35 -0
  72. package/src/GrpcUtil.js +55 -0
  73. package/src/GrpcUtil.ts +76 -0
  74. package/src/JsonRequest.js +29 -0
  75. package/src/JsonRequest.ts +36 -0
  76. package/src/JsonResponse.js +36 -0
  77. package/src/JsonResponse.ts +46 -0
  78. package/src/RequestFactory.js +257 -0
  79. package/src/RequestFactory.ts +324 -0
  80. package/src/SkyEyeClient.js +831 -0
  81. package/src/SkyEyeClient.ts +772 -0
  82. package/src/SkyEyeClientFactory.js +53 -0
  83. package/src/SkyEyeClientFactory.ts +46 -0
  84. package/src/exception/SkyEyeSDKException.js +13 -0
  85. package/src/exception/SkyEyeSDKException.ts +10 -0
  86. package/src/models/Board.js +15 -0
  87. package/src/models/Board.ts +18 -0
  88. package/src/models/Cpu.js +47 -0
  89. package/src/models/Cpu.ts +56 -0
  90. package/src/models/CpuInterface.js +2 -0
  91. package/src/models/CpuInterface.ts +15 -0
  92. package/src/models/Device.js +26 -0
  93. package/src/models/Device.ts +70 -0
  94. package/src/models/DeviceInterface.js +2 -0
  95. package/src/models/DeviceInterface.ts +14 -0
  96. package/src/models/DeviceState.js +8 -0
  97. package/src/models/DeviceState.ts +4 -0
  98. package/src/models/FaultInjectItem.js +16 -0
  99. package/src/models/FaultInjectItem.ts +33 -0
  100. package/src/models/FaultInjectItemInterface.js +2 -0
  101. package/src/models/FaultInjectItemInterface.ts +10 -0
  102. package/src/models/FaultInjectType.js +25 -0
  103. package/src/models/FaultInjectType.ts +22 -0
  104. package/src/models/GlobalVarType.js +9 -0
  105. package/src/models/GlobalVarType.ts +5 -0
  106. package/src/models/InstructionItem.js +6 -0
  107. package/src/models/InstructionItem.ts +6 -0
  108. package/src/models/Node.js +2 -0
  109. package/src/models/Node.ts +4 -0
  110. package/src/models/Register.js +32 -0
  111. package/src/models/Register.ts +73 -0
  112. package/src/models/RegisterInterface.js +2 -0
  113. package/src/models/RegisterInterface.ts +14 -0
  114. package/src/proto/skyeye_rpc.proto +11 -0
  115. package/src/proto/skyeye_rpc_grpc_pb.d.ts +40 -0
  116. package/src/proto/skyeye_rpc_grpc_pb.js +44 -0
  117. package/src/proto/skyeye_rpc_pb.d.ts +47 -0
  118. package/src/proto/skyeye_rpc_pb.js +322 -0
  119. package/src/requests/BaseRequest.js +18 -0
  120. package/src/requests/BaseRequest.ts +24 -0
  121. package/src/requests/GetRunningStatusRequest.js +10 -0
  122. package/src/response/BaseResponse.js +7 -0
  123. package/src/response/BaseResponse.ts +8 -0
  124. package/src/response/GetAllDeviceInfoResponse.js +11 -0
  125. package/src/response/GetAllDeviceInfoResponse.ts +6 -0
  126. package/src/response/GetCpuListResponse.js +18 -0
  127. package/src/response/GetCpuListResponse.ts +20 -0
  128. package/src/response/GetCpuRegisterInfoResponse.js +11 -0
  129. package/src/response/GetCpuRegisterInfoResponse.ts +10 -0
  130. package/src/response/GetCurrentPCResponse.js +7 -0
  131. package/src/response/GetCurrentPCResponse.ts +6 -0
  132. package/src/response/GetDeviceListResponse.js +11 -0
  133. package/src/response/GetDeviceListResponse.ts +11 -0
  134. package/src/response/GetDeviceTreeResponse.js +11 -0
  135. package/src/response/GetDeviceTreeResponse.ts +6 -0
  136. package/src/response/GetDisassembleInfoResponse.js +7 -0
  137. package/src/response/GetDisassembleInfoResponse.ts +6 -0
  138. package/src/response/GetFaultInjectListResponse.js +18 -0
  139. package/src/response/GetFaultInjectListResponse.ts +20 -0
  140. package/src/response/GetRamAddrInfoResponse.js +7 -0
  141. package/src/response/GetRamAddrInfoResponse.ts +6 -0
  142. package/src/response/GetRunningStateResponse.js +25 -0
  143. package/src/response/GetRunningStateResponse.ts +25 -0
  144. package/src/test.js +43 -0
  145. package/src/utils/ParseBoardUtils.js +108 -0
  146. package/src/utils/ParseBoardUtils.ts +107 -0
  147. package/tsconfig.json +17 -0
package/.npmjgnore ADDED
@@ -0,0 +1,2 @@
1
+ node_modules
2
+ dist
@@ -0,0 +1,9 @@
1
+ export declare class GrpcUtil {
2
+ private Jr;
3
+ constructor(host: string, port: string);
4
+ getRunningStatus(): void;
5
+ runCommand(): void;
6
+ stopCommand(): void;
7
+ quitCommand(): void;
8
+ getDeviceRegisterInfo(machname: string, devname: string, _callback: (device: string) => void): void;
9
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GrpcUtil = void 0;
4
+ const skyeye_rpc_pb_1 = require("./proto/skyeye_rpc_pb");
5
+ const SkyEyeClient_1 = require("./SkyEyeClient");
6
+ let client = null;
7
+ class GrpcUtil {
8
+ constructor(host, port) {
9
+ this.Jr = new skyeye_rpc_pb_1.JSONRequest();
10
+ client = new SkyEyeClient_1.SkyEyeClient(host, port);
11
+ }
12
+ //status
13
+ getRunningStatus() {
14
+ this.Jr.setRequest("{\"request\": {\"name\": \"SE_get_running_status\", \"args\": {}}}");
15
+ client.callSkyEye(this.Jr, (error, response) => {
16
+ var obj = eval("(" + response.toString() + ")");
17
+ var ackObj = JSON.parse(JSON.stringify(obj.ack));
18
+ console.log("ackObj.result:" + ackObj.result);
19
+ return ackObj;
20
+ });
21
+ }
22
+ //run
23
+ runCommand() {
24
+ this.Jr.setRequest("{\"request\": {\"name\": \"run\", \"args\": {}}}");
25
+ client.callSkyEye(this.Jr, (error, response) => {
26
+ console.log("res" + response + error);
27
+ var obj = eval("(" + response.toString() + ")");
28
+ var ackObj = JSON.parse(JSON.stringify(obj.ack));
29
+ console.log("ackObj.result" + ackObj.result);
30
+ });
31
+ }
32
+ //stop
33
+ stopCommand() {
34
+ this.Jr.setRequest("{\"request\": {\"name\": \"stop\", \"args\": {}}}");
35
+ client.callSkyEye(this.Jr, (error, response) => {
36
+ console.log("res" + response + error);
37
+ });
38
+ }
39
+ //quit
40
+ quitCommand() {
41
+ this.Jr.setRequest("{\"request\": {\"name\": \"quit\", \"args\": {}}}");
42
+ client.callSkyEye(this.Jr, (error, response) => {
43
+ console.log("res" + response + error);
44
+ });
45
+ }
46
+ //SE_get_device_register_info 设备寄存器信息(表格内容)
47
+ getDeviceRegisterInfo(machname, devname, _callback) {
48
+ console.log('SE_get_device_register_info:machname:' + machname + ' devname' + devname);
49
+ this.Jr.setRequest("{\"request\": {\"name\": \"SE_get_device_register_info\",\"args\":{\"machname\": \"" + machname + "\",\"devname\": \"" + devname + "\"}}}");
50
+ client.callSkyEye(this.Jr, (error, response) => {
51
+ console.log("res" + response + error);
52
+ });
53
+ }
54
+ }
55
+ exports.GrpcUtil = GrpcUtil;
@@ -0,0 +1,10 @@
1
+ declare class JsonRequest {
2
+ constructor();
3
+ get api_name(): any;
4
+ set api_name(api_name: any);
5
+ get args(): any;
6
+ set args(args: any);
7
+ get timeout(): any;
8
+ set timeout(timeout: any);
9
+ toString(): string;
10
+ }
@@ -0,0 +1,29 @@
1
+ class JsonRequest {
2
+ constructor() {
3
+ this.api_name = '';
4
+ this.args = null;
5
+ this.timeout = 60;
6
+ }
7
+ get api_name() {
8
+ return this.api_name;
9
+ }
10
+ set api_name(api_name) {
11
+ this.api_name = api_name;
12
+ }
13
+ get args() {
14
+ return this.args;
15
+ }
16
+ set args(args) {
17
+ this.args = args;
18
+ }
19
+ get timeout() {
20
+ return this.timeout;
21
+ }
22
+ set timeout(timeout) {
23
+ this.timeout = this.timeout;
24
+ }
25
+ toString() {
26
+ return `JsonRequest{api_name='${this.api_name}', args=${this.args}, timeout=${this.timeout}}`;
27
+ }
28
+ }
29
+ module.exports = JsonRequest;
@@ -0,0 +1,12 @@
1
+ declare class JsonResponse {
2
+ constructor();
3
+ get isSuccess(): any;
4
+ set isSuccess(success: any);
5
+ get result(): any;
6
+ set result(result: any);
7
+ get callFuncName(): any;
8
+ set callFuncName(callFuncName: any);
9
+ get error(): any;
10
+ set error(error: any);
11
+ toString(): string;
12
+ }
@@ -0,0 +1,36 @@
1
+ class JsonResponse {
2
+ constructor() {
3
+ this.isSuccess = false;
4
+ this.result = null;
5
+ this.callFuncName = '';
6
+ this.error = null;
7
+ }
8
+ get isSuccess() {
9
+ return this.isSuccess;
10
+ }
11
+ set isSuccess(success) {
12
+ this.isSuccess = success;
13
+ }
14
+ get result() {
15
+ return this.result;
16
+ }
17
+ set result(result) {
18
+ this.result = result;
19
+ }
20
+ get callFuncName() {
21
+ return this.callFuncName;
22
+ }
23
+ set callFuncName(callFuncName) {
24
+ this.callFuncName = callFuncName;
25
+ }
26
+ get error() {
27
+ return this.error;
28
+ }
29
+ set error(error) {
30
+ this.error = error;
31
+ }
32
+ toString() {
33
+ return `JsonResponse{isSuccess=${this.isSuccess}, result=${this.result}, callFuncName='${this.callFuncName}', error=${this.error}}`;
34
+ }
35
+ }
36
+ module.exports = JsonResponse;
@@ -0,0 +1,35 @@
1
+ import { JSONRequest } from "./proto/skyeye_rpc_pb";
2
+ import { GlobalVarType } from './models/GlobalVarType';
3
+ export declare class RequestFactory {
4
+ private static _instance;
5
+ private constructor();
6
+ static getInstance(): RequestFactory;
7
+ getRunningStatus(): JSONRequest;
8
+ runScriptRequest(filename: string): JSONRequest;
9
+ runCommand(): JSONRequest;
10
+ stopCommand(): JSONRequest;
11
+ quitCommand(): JSONRequest;
12
+ getCpuList(): JSONRequest;
13
+ getMemoryValue(cpuName: string, baseAddr: number, length: number): JSONRequest;
14
+ enableDeviceWork(deviceName: string): JSONRequest;
15
+ disableDeviceWork(deviceName: string): JSONRequest;
16
+ changeDir(path: string): JSONRequest;
17
+ getRunningDeviceInfo(): JSONRequest;
18
+ getSimulationTime(cpuName: string): JSONRequest;
19
+ getCurrentSimulationTime(): JSONRequest;
20
+ getCurrentPC(cpuName: string): JSONRequest;
21
+ getCpuMips(cpuName: string): JSONRequest;
22
+ getGlobalVarValue(cpuName: string, varName: string, bytesNum: number, valueType: GlobalVarType): JSONRequest;
23
+ setGlobalVarValue(cpuName: string, varName: string, bytesNum: number, valueType: GlobalVarType, value: string): JSONRequest;
24
+ getDeviceList(): JSONRequest;
25
+ getDeviceTree(): JSONRequest;
26
+ setRegisterValue(machName: string, deviceName: string, regName: string, value: number): JSONRequest;
27
+ getAllDeviceInfo(): JSONRequest;
28
+ getRamAddrInfo(machName: string, addr: number): JSONRequest;
29
+ setFaultInject(machName: string, deviceName: string, addr: string, bit: string, mode: string): JSONRequest;
30
+ deleteFaultInject(machName: string, deviceName: string, addr: string, bit: string, mode: string): JSONRequest;
31
+ getFaultInjectList(): JSONRequest;
32
+ getDisassembleInfo(cpuName: string, startAddr: number, nums: number): JSONRequest;
33
+ singleStep(cpuName: string): JSONRequest;
34
+ getcpuRegisterInfo(cpuName: string): JSONRequest;
35
+ }
@@ -0,0 +1,257 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RequestFactory = void 0;
4
+ const skyeye_rpc_pb_1 = require("./proto/skyeye_rpc_pb");
5
+ const BaseRequest_1 = require("./requests/BaseRequest");
6
+ class RequestFactory {
7
+ constructor() { }
8
+ static getInstance() {
9
+ if (!this._instance) {
10
+ this._instance = new RequestFactory();
11
+ }
12
+ return this._instance;
13
+ }
14
+ getRunningStatus() {
15
+ const baseRequest = new BaseRequest_1.BaseRequest("SE_get_running_status");
16
+ const request = new skyeye_rpc_pb_1.JSONRequest();
17
+ request.setRequest(baseRequest.toJSONString());
18
+ return request;
19
+ }
20
+ runScriptRequest(filename) {
21
+ const baseRequest = new BaseRequest_1.BaseRequest("run_script");
22
+ const args = {};
23
+ args.filename = filename;
24
+ const request = new skyeye_rpc_pb_1.JSONRequest();
25
+ request.setRequest(baseRequest.toJSONString());
26
+ return request;
27
+ }
28
+ runCommand() {
29
+ const baseRequest = new BaseRequest_1.BaseRequest("run");
30
+ const request = new skyeye_rpc_pb_1.JSONRequest();
31
+ request.setRequest(baseRequest.toJSONString());
32
+ return request;
33
+ }
34
+ stopCommand() {
35
+ const baseRequest = new BaseRequest_1.BaseRequest("stop");
36
+ const request = new skyeye_rpc_pb_1.JSONRequest();
37
+ request.setRequest(baseRequest.toJSONString());
38
+ return request;
39
+ }
40
+ quitCommand() {
41
+ const baseRequest = new BaseRequest_1.BaseRequest("quit");
42
+ const request = new skyeye_rpc_pb_1.JSONRequest();
43
+ request.setRequest(baseRequest.toJSONString());
44
+ return request;
45
+ }
46
+ getCpuList() {
47
+ const baseRequest = new BaseRequest_1.BaseRequest("cpu_list");
48
+ const request = new skyeye_rpc_pb_1.JSONRequest();
49
+ request.setRequest(baseRequest.toJSONString());
50
+ return request;
51
+ }
52
+ getMemoryValue(cpuName, baseAddr, length) {
53
+ const baseRequest = new BaseRequest_1.BaseRequest("SE_get_memory_value");
54
+ const args = {};
55
+ args.cpuname = cpuName;
56
+ args.baseaddr = "0x" + baseAddr.toString(16);
57
+ args.length = length.toString();
58
+ baseRequest.setArgs(args);
59
+ const request = new skyeye_rpc_pb_1.JSONRequest();
60
+ request.setRequest(baseRequest.toJSONString());
61
+ return request;
62
+ }
63
+ enableDeviceWork(deviceName) {
64
+ const baseRequest = new BaseRequest_1.BaseRequest("SE_enable_device_work");
65
+ const args = {};
66
+ args.device_name = deviceName;
67
+ baseRequest.setArgs(args);
68
+ const request = new skyeye_rpc_pb_1.JSONRequest();
69
+ request.setRequest(baseRequest.toJSONString());
70
+ return request;
71
+ }
72
+ disableDeviceWork(deviceName) {
73
+ const baseRequest = new BaseRequest_1.BaseRequest("SE_disable_device_work");
74
+ const args = {};
75
+ args.device_name = deviceName;
76
+ baseRequest.setArgs(args);
77
+ const request = new skyeye_rpc_pb_1.JSONRequest();
78
+ request.setRequest(baseRequest.toJSONString());
79
+ return request;
80
+ }
81
+ changeDir(path) {
82
+ const baseRequest = new BaseRequest_1.BaseRequest("chdir");
83
+ const args = {};
84
+ args.path = path;
85
+ baseRequest.setArgs(args);
86
+ const request = new skyeye_rpc_pb_1.JSONRequest();
87
+ request.setRequest(baseRequest.toJSONString());
88
+ return request;
89
+ }
90
+ getRunningDeviceInfo() {
91
+ const baseRequest = new BaseRequest_1.BaseRequest("SE_get_simulation_device_info");
92
+ const request = new skyeye_rpc_pb_1.JSONRequest();
93
+ request.setRequest(baseRequest.toJSONString());
94
+ return request;
95
+ }
96
+ getSimulationTime(cpuName) {
97
+ const baseRequest = new BaseRequest_1.BaseRequest("SE_get_simulation_run_time");
98
+ const args = {};
99
+ args.cpuname = cpuName;
100
+ baseRequest.setArgs(args);
101
+ const request = new skyeye_rpc_pb_1.JSONRequest();
102
+ request.setRequest(baseRequest.toJSONString());
103
+ return request;
104
+ }
105
+ getCurrentSimulationTime() {
106
+ const baseRequest = new BaseRequest_1.BaseRequest("SE_get_simulation_run_time");
107
+ const request = new skyeye_rpc_pb_1.JSONRequest();
108
+ request.setRequest(baseRequest.toJSONString());
109
+ return request;
110
+ }
111
+ getCurrentPC(cpuName) {
112
+ const baseRequest = new BaseRequest_1.BaseRequest("SE_get_current_pc");
113
+ const args = {};
114
+ args.cpuname = cpuName;
115
+ baseRequest.setArgs(args);
116
+ const request = new skyeye_rpc_pb_1.JSONRequest();
117
+ request.setRequest(baseRequest.toJSONString());
118
+ return request;
119
+ }
120
+ getCpuMips(cpuName) {
121
+ const baseRequest = new BaseRequest_1.BaseRequest("SE_get_cpu_mips");
122
+ const args = {};
123
+ args.cpuname = cpuName;
124
+ baseRequest.setArgs(args);
125
+ const request = new skyeye_rpc_pb_1.JSONRequest();
126
+ request.setRequest(baseRequest.toJSONString());
127
+ // request.setRequest("{\"request\":{\"name\":\"SE_get_cpu_mips\",\"args\":{\"cpuname\":\"" + cpuName + "\"}}}");
128
+ return request;
129
+ }
130
+ getGlobalVarValue(cpuName, varName, bytesNum, valueType) {
131
+ const baseRequest = new BaseRequest_1.BaseRequest("SE_get_global_variable_value");
132
+ const args = {};
133
+ args.cpu_name = cpuName;
134
+ args.var_name = varName;
135
+ args.value_bytes_number = String(bytesNum);
136
+ args.value_type = valueType;
137
+ baseRequest.setArgs(args);
138
+ const request = new skyeye_rpc_pb_1.JSONRequest();
139
+ request.setRequest(baseRequest.toJSONString());
140
+ return request;
141
+ }
142
+ setGlobalVarValue(cpuName, varName, bytesNum, valueType, value) {
143
+ const baseRequest = new BaseRequest_1.BaseRequest("SE_set_global_variable_value");
144
+ const args = {};
145
+ args.cpu_name = cpuName;
146
+ args.var_name = varName;
147
+ args.value_bytes_number = String(bytesNum);
148
+ args.value_type = valueType;
149
+ args.value = value;
150
+ baseRequest.setArgs(args);
151
+ const request = new skyeye_rpc_pb_1.JSONRequest();
152
+ request.setRequest(baseRequest.toJSONString());
153
+ return request;
154
+ }
155
+ getDeviceList() {
156
+ const baseRequest = new BaseRequest_1.BaseRequest("SE_get_fault_inject_device_info");
157
+ const request = new skyeye_rpc_pb_1.JSONRequest();
158
+ request.setRequest(baseRequest.toJSONString());
159
+ return request;
160
+ }
161
+ getDeviceTree() {
162
+ const baseRequest = new BaseRequest_1.BaseRequest("SE_get_device_tree");
163
+ const request = new skyeye_rpc_pb_1.JSONRequest();
164
+ request.setRequest(baseRequest.toJSONString());
165
+ return request;
166
+ }
167
+ setRegisterValue(machName, deviceName, regName, value) {
168
+ const baseRequest = new BaseRequest_1.BaseRequest("SE_set_device_register_value");
169
+ const args = {};
170
+ args.machName = machName;
171
+ args.deviceName = deviceName;
172
+ args.regName = regName;
173
+ args.value = String(value);
174
+ baseRequest.setArgs(args);
175
+ const request = new skyeye_rpc_pb_1.JSONRequest();
176
+ request.setRequest(baseRequest.toJSONString());
177
+ return request;
178
+ }
179
+ getAllDeviceInfo() {
180
+ const baseRequest = new BaseRequest_1.BaseRequest("SE_get_all_fault_inject_device_info");
181
+ const request = new skyeye_rpc_pb_1.JSONRequest();
182
+ request.setRequest(baseRequest.toJSONString());
183
+ return request;
184
+ }
185
+ getRamAddrInfo(machName, addr) {
186
+ const baseRequest = new BaseRequest_1.BaseRequest("SE_get_mem_device_addr_info");
187
+ const args = {};
188
+ args.machName = machName;
189
+ args.addr = String(addr);
190
+ baseRequest.setArgs(args);
191
+ const request = new skyeye_rpc_pb_1.JSONRequest();
192
+ request.setRequest(baseRequest.toJSONString());
193
+ return request;
194
+ }
195
+ setFaultInject(machName, deviceName, addr, bit, mode) {
196
+ const baseRequest = new BaseRequest_1.BaseRequest("SE_set_fault_inject");
197
+ const args = {};
198
+ args.machName = machName;
199
+ args.deviceName = deviceName;
200
+ args.addr = addr;
201
+ args.bit = bit;
202
+ args.mode = mode;
203
+ baseRequest.setArgs(args);
204
+ const request = new skyeye_rpc_pb_1.JSONRequest();
205
+ request.setRequest(baseRequest.toJSONString());
206
+ return request;
207
+ }
208
+ deleteFaultInject(machName, deviceName, addr, bit, mode) {
209
+ const baseRequest = new BaseRequest_1.BaseRequest("SE_delete_fault");
210
+ const args = {};
211
+ args.machName = machName;
212
+ args.deviceName = deviceName;
213
+ args.addr = addr;
214
+ args.bit = bit;
215
+ args.mode = mode;
216
+ baseRequest.setArgs(args);
217
+ const request = new skyeye_rpc_pb_1.JSONRequest();
218
+ request.setRequest(baseRequest.toJSONString());
219
+ return request;
220
+ }
221
+ getFaultInjectList() {
222
+ const baseRequest = new BaseRequest_1.BaseRequest("SE_get_fault_inject_list");
223
+ const request = new skyeye_rpc_pb_1.JSONRequest();
224
+ request.setRequest(baseRequest.toJSONString());
225
+ return request;
226
+ }
227
+ getDisassembleInfo(cpuName, startAddr, nums) {
228
+ const baseRequest = new BaseRequest_1.BaseRequest("SE_get_disassemble_info");
229
+ const args = {};
230
+ args.cpuname = cpuName;
231
+ args.startAddr = "0x" + startAddr;
232
+ args.length = String(nums);
233
+ baseRequest.setArgs(args);
234
+ const request = new skyeye_rpc_pb_1.JSONRequest();
235
+ request.setRequest(baseRequest.toJSONString());
236
+ return request;
237
+ }
238
+ singleStep(cpuName) {
239
+ const baseRequest = new BaseRequest_1.BaseRequest("SE_system_step");
240
+ const args = {};
241
+ args.cpuname = cpuName;
242
+ baseRequest.setArgs(args);
243
+ const request = new skyeye_rpc_pb_1.JSONRequest();
244
+ request.setRequest(baseRequest.toJSONString());
245
+ return request;
246
+ }
247
+ getcpuRegisterInfo(cpuName) {
248
+ const baseRequest = new BaseRequest_1.BaseRequest("SE_get_cpu_register_info");
249
+ const args = {};
250
+ args.cpuname = cpuName;
251
+ baseRequest.setArgs(args);
252
+ const request = new skyeye_rpc_pb_1.JSONRequest();
253
+ request.setRequest(baseRequest.toJSONString());
254
+ return request;
255
+ }
256
+ }
257
+ exports.RequestFactory = RequestFactory;
@@ -0,0 +1,70 @@
1
+ import { JSONRequest } from './proto/skyeye_rpc_pb';
2
+ import { JSONTransmissionClient } from './proto/skyeye_rpc_grpc_pb';
3
+ import { GetCpuListResponse } from './response/GetCpuListResponse';
4
+ import { GlobalVarType } from './models/GlobalVarType';
5
+ import { GetDeviceListResponse } from './response/GetDeviceListResponse';
6
+ import { GetRunningStateResponse } from './response/GetRunningStateResponse';
7
+ import { Register } from './models/Register';
8
+ import { GetDeviceTreeResponse } from './response/GetDeviceTreeResponse';
9
+ import { GetAllDeviceInfoResponse } from './response/GetAllDeviceInfoResponse';
10
+ import { GetRamAddrInfoResponse } from './response/GetRamAddrInfoResponse';
11
+ import { Device } from './models/Device';
12
+ import { FaultInjectType } from './models/FaultInjectType';
13
+ import { FaultInjectItem } from './models/FaultInjectItem';
14
+ import { GetFaultInjectListResponse } from './response/GetFaultInjectListResponse';
15
+ import { GetDisassembleInfoResponse } from './response/GetDisassembleInfoResponse';
16
+ import { GetCpuRegisterInfoResponse } from './response/GetCpuRegisterInfoResponse';
17
+ export declare class SkyEyeClient extends JSONTransmissionClient {
18
+ private host;
19
+ private port;
20
+ constructor(host: string, port: string);
21
+ private printRequestLog;
22
+ private printResponseLog;
23
+ call(request: JSONRequest): Promise<any>;
24
+ runScriptRequest(filename: string): Promise<any>;
25
+ runCommand(): Promise<any>;
26
+ stopCommand(): Promise<any>;
27
+ quitCommand(): Promise<any>;
28
+ getCpuList(): Promise<GetCpuListResponse>;
29
+ enableDeviceWork(deviceName: string): Promise<any>;
30
+ disableDeviceWork(deviceName: string): Promise<any>;
31
+ changeDir(skyeyeProjectRootDir: string): Promise<any>;
32
+ getRunningDeviceInfo(): Promise<any>;
33
+ getSimulationTime(cpuName: string): Promise<any>;
34
+ getCurrentSimulationTime(): Promise<any>;
35
+ getDeviceList(): Promise<GetDeviceListResponse>;
36
+ getPC(cpuName: string): Promise<any>;
37
+ getCurrentPC(): Promise<any>;
38
+ getCpuMips(cpuName: string): Promise<any>;
39
+ getCurrentCpuMips(): Promise<any>;
40
+ getGlobalVarValue(cpuName: string, varName: string, bytesNum: number, valueType: GlobalVarType): Promise<any>;
41
+ getGlobalVarValueDefault(varName: string, valueType: GlobalVarType): Promise<any>;
42
+ setGlobalVarValue(cpuName: string, varName: string, bytesNum: number, valueType: GlobalVarType, value: string): Promise<any>;
43
+ setGlobalVarValueDefault(varName: string, valueType: GlobalVarType, value: string): Promise<any>;
44
+ getMemoryValue(cpuName: string, baseAddr: number, length: number): Promise<any>;
45
+ getAddressingSpace(cpuName: string, baseAddr: number, length: number): Promise<any>;
46
+ getMemoryValueDefault(baseAddr: number, length: number): Promise<any>;
47
+ getAddressingSpaceDefault(baseAddr: number, length: number): Promise<any>;
48
+ getCpuRegisters(cpuName: string): Promise<GetCpuRegisterInfoResponse>;
49
+ getCpuRegistersDefault(): Promise<GetCpuRegisterInfoResponse>;
50
+ setCpuRegisterValueDefault(register: Register, value: number): Promise<any>;
51
+ setCpuRegisterValue(boardName: string, cpuName: string, registerName: string, value: number): Promise<any>;
52
+ getDeviceTree(): Promise<GetDeviceTreeResponse>;
53
+ getCurrentRunningState(): Promise<GetRunningStateResponse>;
54
+ getAllDeviceInfo(): Promise<GetAllDeviceInfoResponse>;
55
+ getRamAddrInfo(machName: string, addr: number): Promise<GetRamAddrInfoResponse>;
56
+ setRamFaultInjectDefault(device: Device, addr: number, bit: number, mode: FaultInjectType): Promise<any>;
57
+ setRamFaultInject(boardName: string, deviceName: string, addr: number, bit: number, mode: FaultInjectType): Promise<any>;
58
+ setRegisterFaultInjectDefault(register: Register, bit: number, mode: FaultInjectType): Promise<any>;
59
+ setRegisterFaultInject(boardName: string, deviceName: string, addr: number, bit: number, mode: FaultInjectType): Promise<any>;
60
+ deleteFaultInjectDefault(faultInjectItem: FaultInjectItem): Promise<any>;
61
+ deleteFaultInject(boardName: string, deviceName: string, addr: number, bit: string, mode: FaultInjectType): Promise<any>;
62
+ getFaultInjectList(): Promise<GetFaultInjectListResponse>;
63
+ getDisassembleInfo(cpuName: string, startAddr: number, nums: number): Promise<GetDisassembleInfoResponse>;
64
+ getDisassembleInfoDefault(startAddr: number, nums: number): Promise<GetDisassembleInfoResponse>;
65
+ SingleStep(cpuName: string): Promise<any>;
66
+ SingleStepDefault(): Promise<any>;
67
+ close(): boolean;
68
+ getHost(): string;
69
+ getPort(): string;
70
+ }