skyeye-sdk-js 1.3.1 → 1.3.4

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.
@@ -19,7 +19,7 @@ export declare class RequestFactory {
19
19
  getCurrentSimulationTime(): JSONRequest;
20
20
  getCurrentPC(cpuName: string): JSONRequest;
21
21
  getCpuMips(cpuName: string): JSONRequest;
22
- getGlobalVarValue(cpuName: string, varName: string, bytesNum: string, valueType: GlobalVarType): JSONRequest;
22
+ getGlobalVarValue(cpuName: string, varName: string, bytesNum: number, valueType: GlobalVarType): JSONRequest;
23
23
  setGlobalVarValue(cpuName: string, varName: string, bytesNum: string, valueType: GlobalVarType, value: string): JSONRequest;
24
24
  getDeviceList(): JSONRequest;
25
25
  getDeviceTree(): JSONRequest;
@@ -137,6 +137,7 @@ class RequestFactory {
137
137
  baseRequest.setArgs(args);
138
138
  const request = new skyeye_rpc_pb_1.JSONRequest();
139
139
  request.setRequest(baseRequest.toJSONString());
140
+ console.log("request:", request);
140
141
  return request;
141
142
  }
142
143
  setGlobalVarValue(cpuName, varName, bytesNum, valueType, value) {
@@ -40,7 +40,7 @@ export declare class SkyEyeClient extends JSONTransmissionClient {
40
40
  getCurrentPC(): Promise<any>;
41
41
  getCpuMips(cpuName: string): Promise<any>;
42
42
  getCurrentCpuMips(): Promise<any>;
43
- getGlobalVarValue(cpuName: string, varName: string, bytesNum: string, valueType: GlobalVarType): Promise<any>;
43
+ getGlobalVarValue(cpuName: string, varName: string, bytesNum: number, valueType: GlobalVarType): Promise<any>;
44
44
  getGlobalVarValueDefault(varName: string, valueType: GlobalVarType): Promise<any>;
45
45
  setGlobalVarValue(cpuName: string, varName: string, bytesNum: string, valueType: GlobalVarType, value: string): Promise<any>;
46
46
  setGlobalVarValueDefault(varName: string, valueType: GlobalVarType, value: string): Promise<any>;
@@ -72,9 +72,14 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
72
72
  });
73
73
  return __awaiter(this, void 0, void 0, function* () {
74
74
  try {
75
+ //TODO
76
+ const state = (yield this.getCurrentRunningState()).getState();
77
+ if (GetRunningStateResponse_1.StateState.UNLOADED === state || GetRunningStateResponse_1.StateState.QUITED === state) {
78
+ throw new SkyEyeSDKException_1.SkyEyeSDKException("当前SkyEye未运行");
79
+ }
75
80
  const request = new skyeye_rpc_pb_1.JSONRequest();
76
81
  // request.setRequest(json);
77
- request.setRequest("{\"request\": {\"name\": \"chdir\"}");
82
+ // request.setRequest("{\"request\": {\"name\": \"chdir\"}");
78
83
  const stream = _super.stopRunTest.call(this, request);
79
84
  return stream;
80
85
  }
@@ -142,6 +147,7 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
142
147
  return ackObj;
143
148
  }
144
149
  catch (error) {
150
+ console.error("Error during gRPC request:", JSON.stringify(request));
145
151
  console.error("Error during gRPC call:", error);
146
152
  throw error;
147
153
  }
@@ -430,7 +436,7 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
430
436
  const cpuList = (yield this.getCpuList()).getCpuList();
431
437
  if (cpuList != null && cpuList.length > 0) {
432
438
  try {
433
- return yield this.call(RequestFactory_1.RequestFactory.getInstance().getGlobalVarValue(cpuList[0].getName(), varName, "4", valueType));
439
+ return yield this.call(RequestFactory_1.RequestFactory.getInstance().getGlobalVarValue(cpuList[0].getName(), varName, 4, valueType));
434
440
  }
435
441
  catch (error) {
436
442
  console.error("Error during getGlobalVarValueDefault:", error);
@@ -554,7 +560,7 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
554
560
  let result = 0;
555
561
  if (!isNaN(numOffset1) && !isNaN(numOffset2)) {
556
562
  result = numOffset1 - numOffset2;
557
- console.log("Result:", result);
563
+ // console.log("Result:", result);
558
564
  }
559
565
  else {
560
566
  console.log("Invalid offset values.");
package/dist/test.js CHANGED
@@ -11,9 +11,179 @@ 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 json = {
15
+ "id": "4a162d75-3a84-5264-992f-287624830ead",
16
+ "name": "鍙戦€佸唴瀛樻秷鎭祴璇?",
17
+ "overview": "",
18
+ "parentId": "8a6d70cd-bd7a-4871-d2f3-2f4fdf7b5a46",
19
+ "projectId": "15ffe24f-8ca6-4fcf-afe5-fe01027e2ffb",
20
+ "steps": [
21
+ {
22
+ "id": "35846013-6510-fd0a-a046-a98c2f24157b",
23
+ "sendConditions": {
24
+ "id": "b3c97e92-7367-63ba-6a6b-5f7ca590164c",
25
+ "name": "杩愯0.5s",
26
+ "projectId": "15ffe24f-8ca6-4fcf-afe5-fe01027e2ffb",
27
+ "overview": "",
28
+ "relationship": "A",
29
+ "child": [
30
+ {
31
+ "id": "5ba88de6-a224-0e80-6585-d5e417b424ce",
32
+ "tag": "A",
33
+ "condition": {
34
+ "type": 1,
35
+ "time": 0.5
36
+ }
37
+ }
38
+ ]
39
+ },
40
+ "expectConditions": {
41
+ "id": "6e265328-255e-d7e3-11fd-0a4211d0d0d6",
42
+ "name": "杩愯0.8s",
43
+ "projectId": "15ffe24f-8ca6-4fcf-afe5-fe01027e2ffb",
44
+ "overview": "",
45
+ "relationship": "A",
46
+ "child": [
47
+ {
48
+ "id": "d9e08452-f88b-8de9-bd20-5d5288987fde",
49
+ "tag": "A",
50
+ "condition": {
51
+ "type": 1,
52
+ "time": 0.8
53
+ }
54
+ }
55
+ ]
56
+ },
57
+ "sends": {
58
+ "templateId": "",
59
+ "name": "鍐呭瓨0x4鍙戦€?",
60
+ "child": [
61
+ {
62
+ "id": "0cd71a92-4e7a-dcb8-d74b-dc6ea8103d02",
63
+ "templdateId": "",
64
+ "name": "鏂扮殑鍙戦€?",
65
+ "target": {
66
+ "type": 3,
67
+ "globalName": "",
68
+ "varType": "",
69
+ "addr": "0x4",
70
+ "length": 4,
71
+ "name": "",
72
+ "deviceName": "",
73
+ "busType": 0,
74
+ "directions": 1,
75
+ "nodes": [
76
+ {
77
+ "name": "鑺傜偣1",
78
+ "rtAddr": "",
79
+ "subAddr": "",
80
+ "id": "row_253"
81
+ },
82
+ {
83
+ "name": "鑺傜偣2",
84
+ "rtAddr": "",
85
+ "subAddr": "",
86
+ "id": "row_254"
87
+ }
88
+ ],
89
+ "fields": [
90
+ {
91
+ "name": "field1",
92
+ "dataType": 0,
93
+ "defaultValue": 4,
94
+ "dataRange": [],
95
+ "desc": "this is field1",
96
+ "id": "a89ee30f-ea3d-411e-9bf1-543935a003fc"
97
+ }
98
+ ]
99
+ },
100
+ "dataFormat": 0,
101
+ "value": "4",
102
+ "fields": [
103
+ {
104
+ "name": "field1",
105
+ "dataType": 0,
106
+ "defaultValue": 4,
107
+ "dataRange": [],
108
+ "desc": "this is field1",
109
+ "id": "d4c808d1-47ba-a30e-cfbe-68c0d2772b3d"
110
+ }
111
+ ],
112
+ "_X_ROW_KEY": "row_251"
113
+ }
114
+ ]
115
+ },
116
+ "expects": {
117
+ "templateId": "",
118
+ "name": "鍐呭瓨0x14鍙戦€?",
119
+ "child": [
120
+ {
121
+ "id": "85276ca0-0a09-aa87-ebff-1e6dfc4e5f4f",
122
+ "name": "鏂扮殑棰勬湡",
123
+ "templateId": "",
124
+ "target": {
125
+ "type": 3,
126
+ "globalName": "",
127
+ "varType": "",
128
+ "addr": "0x44",
129
+ "length": 4,
130
+ "name": "",
131
+ "deviceName": "",
132
+ "busType": 0,
133
+ "directions": 1,
134
+ "nodes": [
135
+ {
136
+ "name": "鑺傜偣1",
137
+ "rtAddr": "",
138
+ "subAddr": "",
139
+ "id": "row_299"
140
+ },
141
+ {
142
+ "name": "鑺傜偣2",
143
+ "rtAddr": "",
144
+ "subAddr": "",
145
+ "id": "row_300"
146
+ }
147
+ ],
148
+ "fields": [
149
+ {
150
+ "name": "field1",
151
+ "dataType": 0,
152
+ "defaultValue": 4,
153
+ "dataRange": [],
154
+ "desc": "this is field1",
155
+ "id": "ef2b8873-516c-a338-a8d0-5e8eda5fa08b"
156
+ }
157
+ ]
158
+ },
159
+ "dataFormat": 0,
160
+ "value": "8",
161
+ "fields": [
162
+ {
163
+ "name": "field1",
164
+ "dataType": 0,
165
+ "defaultValue": 4,
166
+ "dataRange": [],
167
+ "desc": "this is field1",
168
+ "id": "379506c9-33d2-167d-6c22-8e0ca8559c0a"
169
+ }
170
+ ],
171
+ "_X_ROW_KEY": "row_297"
172
+ }
173
+ ]
174
+ },
175
+ "select": true
176
+ }
177
+ ],
178
+ "settings": {
179
+ "timeout": ""
180
+ },
181
+ "createdAt": "2024-06-05T02:18:27.630Z",
182
+ "updatedAt": "2024-06-11T06:37:05.487Z",
183
+ "results": []
184
+ };
14
185
  function test() {
15
186
  return __awaiter(this, void 0, void 0, function* () {
16
- const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
17
187
  // console.log("Connected to SkyEye server");
18
188
  // await client.getDeviceList();
19
189
  // await client.getCurrentCpuMips();
@@ -26,20 +196,57 @@ function test() {
26
196
  // const response = await client.getMemoryValueDefault(1, 16);
27
197
  // const response = await client.getMemoryValue("c7s",0,16);
28
198
  // console.log("结果response:", response)
29
- const pathSkyEye = "D:/data/case/c6713_demo";
30
- const fileName = "c6713_demo.skyeye";
31
- const skyeyeDir = "D:/install/skyeye/opt/skyeye/bin/skyeye.exe";
32
- const port = "50051";
33
199
  // await client.initSkyEyeAndRun(pathSkyEye,fileName,port,skyeyeDir);
34
- yield client.initSkyEyeAndRun2(pathSkyEye, fileName, port, skyeyeDir);
35
- // setTimeout(async ()=>{
36
- // const quitResponse = await client.quitCommand()
37
- // console.log("quitResponse",quitResponse)
38
- // const response = await client.stopGrpcService("")
39
- // console.log("stopGrpcService",response)
40
- // },6000)
41
- // GrpcUtil.initAndRunExample();
42
- // const bean:string = '{"id":"33d209da-2459-4e49-97c3-5b1509bc638c","steps":[{"condition":{"type":10,"value":"123"},"send":{"target":{"type":2,"addr":"1222"},"data":"0101011101"}},{"condition":{"type":0,"value":"0xff"},"send":{"target":{"type":2,"addr":"1222"},"data":"0101011101"}}],"expects":[{"condition":{"type":0,"value":"0xff"},"send":{"target":{"type":3,"addr":"2221"}}}]}';
200
+ // const pathSkyEye = "D:/data/case/c6713_demo";
201
+ // const fileName = "c6713_demo.skyeye";
202
+ // const skyeyeDir = "D:/install/skyeye/opt/skyeye/bin/skyeye.exe"
203
+ // const port = "50051"
204
+ // const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
205
+ // await client.initSkyEyeAndRun2(pathSkyEye, fileName, port, skyeyeDir)
206
+ const pathSkyEye = "D:/data/case/workspace_c6713/targets/c6713_fc_1553b";
207
+ const fileName = "c6713_fc_1553b.skyeye";
208
+ const skyeyeDir = "D:/install/skyeye/opt/skyeye/bin/skyeye.exe";
209
+ 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
+ //启动多个skyeye
215
+ // const count = 5;
216
+ // const map = new Map<number, any>;
217
+ // for (let i = 1; i < count; i++) {
218
+ // const port = 50050 + i
219
+ // const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', port.toString());
220
+ // await client.initSkyEyeAndRun2(pathSkyEye, fileName, port.toString(), skyeyeDir)
221
+ // await client.RunTestcase(json)
222
+ // await client.runCommand()
223
+ // const res = await client.getCurrentRunningState()
224
+ // console.log("state3:", res.state)
225
+ // map.set(port, client);
226
+ // }
227
+ // for (let i = 1; i < count; i++) {
228
+ // setTimeout(async () => {
229
+ // const port = 50050 + i
230
+ // const client = map.get(port)
231
+ // await client.quitCommand()
232
+ // }, i * 5000)
233
+ // }
234
+ // setTimeout(async () => {
235
+ // // await map.get(50051).stopGrpcService("")
236
+ // await map.get(50051).quitCommand()
237
+ // }, 2000)
238
+ // setTimeout(async () => {
239
+ // // await map.get(50052).stopGrpcService("")
240
+ // await map.get(50052).quitCommand()
241
+ // }, 5000)
242
+ // setTimeout(async () => {
243
+ // // await map.get(50053).stopGrpcService("")
244
+ // await map.get(50053).quitCommand()
245
+ // }, 8000)
246
+ // setTimeout(async () => {
247
+ // // await map.get(50054).stopGrpcService("")
248
+ // await map.get(50054).quitCommand()
249
+ // }, 11000)
43
250
  });
44
251
  }
45
252
  test();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skyeye-sdk-js",
3
- "version": "1.3.1",
3
+ "version": "1.3.4",
4
4
  "description": "gRPC to SkyEye",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -153,10 +153,9 @@ export class RequestFactory {
153
153
  return request;
154
154
  }
155
155
 
156
- public getGlobalVarValue(cpuName: string, varName: string, bytesNum: string, valueType: GlobalVarType) {
156
+ public getGlobalVarValue(cpuName: string, varName: string, bytesNum: number, valueType: GlobalVarType) {
157
157
  const baseRequest = new BaseRequest("SE_get_global_variable_value");
158
- const args: { [key: string]: string } = {};
159
-
158
+ const args: { [key: string]: any } = {};
160
159
  args.cpu_name = cpuName;
161
160
  args.var_name = varName;
162
161
  args.value_bytes_number = bytesNum
@@ -164,6 +163,7 @@ export class RequestFactory {
164
163
  baseRequest.setArgs(args)
165
164
  const request = new JSONRequest()
166
165
  request.setRequest(baseRequest.toJSONString());
166
+ console.log("request:",request)
167
167
  return request;
168
168
  }
169
169
 
@@ -46,9 +46,14 @@ export class SkyEyeClient extends JSONTransmissionClient {
46
46
  //终止所有grpc通信
47
47
  public async stopGrpcService(json: string) {
48
48
  try {
49
+ //TODO
50
+ const state = (await this.getCurrentRunningState()).getState();
51
+ if (StateState.UNLOADED === state || StateState.QUITED === state) {
52
+ throw new SkyEyeSDKException("当前SkyEye未运行")
53
+ }
49
54
  const request = new JSONRequest();
50
55
  // request.setRequest(json);
51
- request.setRequest("{\"request\": {\"name\": \"chdir\"}");
56
+ // request.setRequest("{\"request\": {\"name\": \"chdir\"}");
52
57
  const stream = super.stopRunTest(request);
53
58
  return stream;
54
59
  } catch (error) {
@@ -104,6 +109,7 @@ export class SkyEyeClient extends JSONTransmissionClient {
104
109
  // this.printResponseLog(ackObj)
105
110
  return ackObj;
106
111
  } catch (error) {
112
+ console.error("Error during gRPC request:", JSON.stringify(request));
107
113
  console.error("Error during gRPC call:", error);
108
114
  throw error;
109
115
  }
@@ -365,7 +371,7 @@ export class SkyEyeClient extends JSONTransmissionClient {
365
371
  }
366
372
 
367
373
 
368
- public async getGlobalVarValue(cpuName: string, varName: string, bytesNum: string, valueType: GlobalVarType) {
374
+ public async getGlobalVarValue(cpuName: string, varName: string, bytesNum: number, valueType: GlobalVarType) {
369
375
  try {
370
376
  return await this.call(RequestFactory.getInstance().getGlobalVarValue(cpuName, varName, bytesNum, valueType))
371
377
  } catch (error) {
@@ -381,7 +387,7 @@ export class SkyEyeClient extends JSONTransmissionClient {
381
387
  const cpuList = (await this.getCpuList()).getCpuList();
382
388
  if (cpuList != null && cpuList.length > 0) {
383
389
  try {
384
- return await this.call(RequestFactory.getInstance().getGlobalVarValue(cpuList[0].getName(), varName, "4", valueType));
390
+ return await this.call(RequestFactory.getInstance().getGlobalVarValue(cpuList[0].getName(), varName, 4, valueType));
385
391
  } catch (error) {
386
392
  console.error("Error during getGlobalVarValueDefault:", error);
387
393
  throw error;
@@ -499,7 +505,7 @@ export class SkyEyeClient extends JSONTransmissionClient {
499
505
  let result: number = 0;
500
506
  if (!isNaN(numOffset1) && !isNaN(numOffset2)) {
501
507
  result = numOffset1 - numOffset2;
502
- console.log("Result:", result);
508
+ // console.log("Result:", result);
503
509
  } else {
504
510
  console.log("Invalid offset values.");
505
511
  }
@@ -607,7 +613,7 @@ export class SkyEyeClient extends JSONTransmissionClient {
607
613
  response.setState(StateState.STOPPED);
608
614
  break;
609
615
  }
610
- }
616
+ }
611
617
  // else {
612
618
  // throw new SkyEyeSDKException(String(call.error));
613
619
  // }
@@ -877,7 +883,7 @@ export class SkyEyeClient extends JSONTransmissionClient {
877
883
  }
878
884
 
879
885
 
880
-
886
+
881
887
  private checkState() {
882
888
  return new Promise((resolve, reject) => {
883
889
  let flag = true;
package/test.ts CHANGED
@@ -5,8 +5,184 @@ import { ServiceError } from "@grpc/grpc-js";
5
5
  const { SkyEyeClientFactory } = require('./src/SkyEyeClientFactory')
6
6
  const { SkyEyeClient } = require('./src/SkyEyeClient')
7
7
 
8
+
9
+
10
+ const json = {
11
+ "id": "4a162d75-3a84-5264-992f-287624830ead",
12
+ "name": "鍙戦€佸唴瀛樻秷鎭祴璇?",
13
+ "overview": "",
14
+ "parentId": "8a6d70cd-bd7a-4871-d2f3-2f4fdf7b5a46",
15
+ "projectId": "15ffe24f-8ca6-4fcf-afe5-fe01027e2ffb",
16
+ "steps": [
17
+ {
18
+ "id": "35846013-6510-fd0a-a046-a98c2f24157b",
19
+ "sendConditions": {
20
+ "id": "b3c97e92-7367-63ba-6a6b-5f7ca590164c",
21
+ "name": "杩愯0.5s",
22
+ "projectId": "15ffe24f-8ca6-4fcf-afe5-fe01027e2ffb",
23
+ "overview": "",
24
+ "relationship": "A",
25
+ "child": [
26
+ {
27
+ "id": "5ba88de6-a224-0e80-6585-d5e417b424ce",
28
+ "tag": "A",
29
+ "condition": {
30
+ "type": 1,
31
+ "time": 0.5
32
+ }
33
+ }
34
+ ]
35
+ },
36
+ "expectConditions": {
37
+ "id": "6e265328-255e-d7e3-11fd-0a4211d0d0d6",
38
+ "name": "杩愯0.8s",
39
+ "projectId": "15ffe24f-8ca6-4fcf-afe5-fe01027e2ffb",
40
+ "overview": "",
41
+ "relationship": "A",
42
+ "child": [
43
+ {
44
+ "id": "d9e08452-f88b-8de9-bd20-5d5288987fde",
45
+ "tag": "A",
46
+ "condition": {
47
+ "type": 1,
48
+ "time": 0.8
49
+ }
50
+ }
51
+ ]
52
+ },
53
+ "sends": {
54
+ "templateId": "",
55
+ "name": "鍐呭瓨0x4鍙戦€?",
56
+ "child": [
57
+ {
58
+ "id": "0cd71a92-4e7a-dcb8-d74b-dc6ea8103d02",
59
+ "templdateId": "",
60
+ "name": "鏂扮殑鍙戦€?",
61
+ "target": {
62
+ "type": 3,
63
+ "globalName": "",
64
+ "varType": "",
65
+ "addr": "0x4",
66
+ "length": 4,
67
+ "name": "",
68
+ "deviceName": "",
69
+ "busType": 0,
70
+ "directions": 1,
71
+ "nodes": [
72
+ {
73
+ "name": "鑺傜偣1",
74
+ "rtAddr": "",
75
+ "subAddr": "",
76
+ "id": "row_253"
77
+ },
78
+ {
79
+ "name": "鑺傜偣2",
80
+ "rtAddr": "",
81
+ "subAddr": "",
82
+ "id": "row_254"
83
+ }
84
+ ],
85
+ "fields": [
86
+ {
87
+ "name": "field1",
88
+ "dataType": 0,
89
+ "defaultValue": 4,
90
+ "dataRange": [],
91
+ "desc": "this is field1",
92
+ "id": "a89ee30f-ea3d-411e-9bf1-543935a003fc"
93
+ }
94
+ ]
95
+ },
96
+ "dataFormat": 0,
97
+ "value": "4",
98
+ "fields": [
99
+ {
100
+ "name": "field1",
101
+ "dataType": 0,
102
+ "defaultValue": 4,
103
+ "dataRange": [],
104
+ "desc": "this is field1",
105
+ "id": "d4c808d1-47ba-a30e-cfbe-68c0d2772b3d"
106
+ }
107
+ ],
108
+ "_X_ROW_KEY": "row_251"
109
+ }
110
+ ]
111
+ },
112
+ "expects": {
113
+ "templateId": "",
114
+ "name": "鍐呭瓨0x14鍙戦€?",
115
+ "child": [
116
+ {
117
+ "id": "85276ca0-0a09-aa87-ebff-1e6dfc4e5f4f",
118
+ "name": "鏂扮殑棰勬湡",
119
+ "templateId": "",
120
+ "target": {
121
+ "type": 3,
122
+ "globalName": "",
123
+ "varType": "",
124
+ "addr": "0x44",
125
+ "length": 4,
126
+ "name": "",
127
+ "deviceName": "",
128
+ "busType": 0,
129
+ "directions": 1,
130
+ "nodes": [
131
+ {
132
+ "name": "鑺傜偣1",
133
+ "rtAddr": "",
134
+ "subAddr": "",
135
+ "id": "row_299"
136
+ },
137
+ {
138
+ "name": "鑺傜偣2",
139
+ "rtAddr": "",
140
+ "subAddr": "",
141
+ "id": "row_300"
142
+ }
143
+ ],
144
+ "fields": [
145
+ {
146
+ "name": "field1",
147
+ "dataType": 0,
148
+ "defaultValue": 4,
149
+ "dataRange": [],
150
+ "desc": "this is field1",
151
+ "id": "ef2b8873-516c-a338-a8d0-5e8eda5fa08b"
152
+ }
153
+ ]
154
+ },
155
+ "dataFormat": 0,
156
+ "value": "8",
157
+ "fields": [
158
+ {
159
+ "name": "field1",
160
+ "dataType": 0,
161
+ "defaultValue": 4,
162
+ "dataRange": [],
163
+ "desc": "this is field1",
164
+ "id": "379506c9-33d2-167d-6c22-8e0ca8559c0a"
165
+ }
166
+ ],
167
+ "_X_ROW_KEY": "row_297"
168
+ }
169
+ ]
170
+ },
171
+ "select": true
172
+ }
173
+ ],
174
+ "settings": {
175
+ "timeout": ""
176
+ },
177
+ "createdAt": "2024-06-05T02:18:27.630Z",
178
+ "updatedAt": "2024-06-11T06:37:05.487Z",
179
+ "results": []
180
+ }
181
+
182
+
183
+
8
184
  async function test() {
9
- const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
185
+
10
186
  // console.log("Connected to SkyEye server");
11
187
  // await client.getDeviceList();
12
188
  // await client.getCurrentCpuMips();
@@ -24,24 +200,83 @@ async function test() {
24
200
  // const response = await client.getMemoryValue("c7s",0,16);
25
201
  // console.log("结果response:", response)
26
202
 
27
- const pathSkyEye = "D:/data/case/c6713_demo";
28
- const fileName = "c6713_demo.skyeye";
29
- const skyeyeDir = "D:/install/skyeye/opt/skyeye/bin/skyeye.exe"
30
- const port = "50051"
203
+
31
204
  // await client.initSkyEyeAndRun(pathSkyEye,fileName,port,skyeyeDir);
32
205
 
33
- await client.initSkyEyeAndRun2(pathSkyEye,fileName,port,skyeyeDir)
34
-
35
- // setTimeout(async ()=>{
36
- // const quitResponse = await client.quitCommand()
37
- // console.log("quitResponse",quitResponse)
38
- // const response = await client.stopGrpcService("")
39
- // console.log("stopGrpcService",response)
40
- // },6000)
41
206
 
42
- // GrpcUtil.initAndRunExample();
43
207
 
44
- // const bean:string = '{"id":"33d209da-2459-4e49-97c3-5b1509bc638c","steps":[{"condition":{"type":10,"value":"123"},"send":{"target":{"type":2,"addr":"1222"},"data":"0101011101"}},{"condition":{"type":0,"value":"0xff"},"send":{"target":{"type":2,"addr":"1222"},"data":"0101011101"}}],"expects":[{"condition":{"type":0,"value":"0xff"},"send":{"target":{"type":3,"addr":"2221"}}}]}';
45
-
208
+
209
+ // const pathSkyEye = "D:/data/case/c6713_demo";
210
+ // const fileName = "c6713_demo.skyeye";
211
+ // const skyeyeDir = "D:/install/skyeye/opt/skyeye/bin/skyeye.exe"
212
+
213
+
214
+ // const port = "50051"
215
+ // const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
216
+ // await client.initSkyEyeAndRun2(pathSkyEye, fileName, port, skyeyeDir)
217
+
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"
221
+
222
+
223
+ const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
224
+ // const response =await client.getCurrentRunningState()
225
+ // const response = await client.getMemoryValueDefault("128","4")
226
+ const response = await client.getGlobalVarValueDefault("number_b","int")
227
+ console.log("response:", response)
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
+ // }
250
+
251
+
252
+
253
+
254
+
255
+
256
+ // setTimeout(async () => {
257
+ // // await map.get(50051).stopGrpcService("")
258
+ // await map.get(50051).quitCommand()
259
+ // }, 2000)
260
+
261
+ // setTimeout(async () => {
262
+ // // await map.get(50052).stopGrpcService("")
263
+ // await map.get(50052).quitCommand()
264
+ // }, 5000)
265
+
266
+ // setTimeout(async () => {
267
+ // // await map.get(50053).stopGrpcService("")
268
+ // await map.get(50053).quitCommand()
269
+ // }, 8000)
270
+
271
+ // setTimeout(async () => {
272
+ // // await map.get(50054).stopGrpcService("")
273
+ // await map.get(50054).quitCommand()
274
+ // }, 11000)
275
+
276
+
46
277
  }
47
278
  test();
279
+
280
+
281
+
282
+