skyeye-sdk-js 1.4.18 → 1.4.20
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/SkyEyeClient.d.ts +1 -1
- package/dist/src/SkyEyeClient.js +6 -8
- package/dist/test.js +128 -8
- package/package.json +1 -1
- package/src/SkyEyeClient.ts +7 -9
- package/test.ts +130 -8
|
@@ -91,7 +91,7 @@ export declare class SkyEyeClient extends JSONTransmissionClient {
|
|
|
91
91
|
getPort(): string;
|
|
92
92
|
initSkyEyeAndRun(pathSkyEye: string, fileName: string, port: string, skyeyeDir: string): void;
|
|
93
93
|
private childProcess;
|
|
94
|
-
initSkyEyeAndRun2(pathSkyEye: string, fileName: string, port: string, skyeyeDir: string
|
|
94
|
+
initSkyEyeAndRun2(pathSkyEye: string, fileName: string, port: string, skyeyeDir: string): Promise<boolean>;
|
|
95
95
|
private checkModule;
|
|
96
96
|
private checkState;
|
|
97
97
|
private startSkyEye;
|
package/dist/src/SkyEyeClient.js
CHANGED
|
@@ -1171,7 +1171,7 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
|
|
|
1171
1171
|
});
|
|
1172
1172
|
}, 2000);
|
|
1173
1173
|
}
|
|
1174
|
-
initSkyEyeAndRun2(pathSkyEye, fileName, port, skyeyeDir
|
|
1174
|
+
initSkyEyeAndRun2(pathSkyEye, fileName, port, skyeyeDir) {
|
|
1175
1175
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1176
1176
|
try {
|
|
1177
1177
|
console.log('runExample');
|
|
@@ -1186,13 +1186,11 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
|
|
|
1186
1186
|
ackObj.result = false;
|
|
1187
1187
|
throw new Error(ackObj.error);
|
|
1188
1188
|
}
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
throw new Error(ackObj.error);
|
|
1195
|
-
}
|
|
1189
|
+
response = yield this.runScript(fileName, port);
|
|
1190
|
+
ackObj = JSON.parse(response.toString()).ack;
|
|
1191
|
+
if (ackObj.result === "false") {
|
|
1192
|
+
ackObj.result = false;
|
|
1193
|
+
throw new Error(ackObj.error);
|
|
1196
1194
|
}
|
|
1197
1195
|
return true;
|
|
1198
1196
|
}
|
package/dist/test.js
CHANGED
|
@@ -9,7 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const
|
|
12
|
+
const SkyEyeClientFactory_1 = require("./src/SkyEyeClientFactory");
|
|
13
|
+
// const { SkyEyeClientFactory } = require('./src/SkyEyeClientFactory')
|
|
13
14
|
const { SkyEyeClient } = require('./src/SkyEyeClient');
|
|
14
15
|
const { Cpu } = require('./src/models/Cpu');
|
|
15
16
|
var RegisterType;
|
|
@@ -50,15 +51,134 @@ function test() {
|
|
|
50
51
|
// const fileName = "FMQL45T900_SylixOS.skyeye";
|
|
51
52
|
// const skyeyeDir = "D:/install/SkyEye/opt/skyeye/bin/skyeye.exe"
|
|
52
53
|
// const port = "50066"
|
|
53
|
-
const pathSkyEye = "
|
|
54
|
-
const fileName = "
|
|
55
|
-
const skyeyeDir = "
|
|
56
|
-
const port =
|
|
57
|
-
const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', port);
|
|
54
|
+
const pathSkyEye = "C:/Users/SkyEye/Desktop/skytest-project/SkyTest_Double";
|
|
55
|
+
const fileName = "SkyTest_Double.skyeye";
|
|
56
|
+
const skyeyeDir = "C:/SkyEye/opt/skyeye/bin/skyeye.exe";
|
|
57
|
+
const port = '50019';
|
|
58
|
+
const client = SkyEyeClientFactory_1.SkyEyeClientFactory.instance.createClient('127.0.0.1', port);
|
|
58
59
|
const t = yield client.initSkyEyeAndRun2(pathSkyEye, fileName, port, skyeyeDir);
|
|
60
|
+
console.log(t);
|
|
61
|
+
let count = 1;
|
|
62
|
+
while (count === 1) {
|
|
63
|
+
const res = (yield client.getCurrentRunningState()).getState();
|
|
64
|
+
console.log(res);
|
|
65
|
+
if (res === "STOPPED") {
|
|
66
|
+
count++;
|
|
67
|
+
}
|
|
68
|
+
yield new Promise((resolve, rej) => {
|
|
69
|
+
setTimeout(() => {
|
|
70
|
+
resolve(true);
|
|
71
|
+
}, 1000);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
59
74
|
client.runCommand();
|
|
60
|
-
const response =
|
|
61
|
-
|
|
75
|
+
// const response = await client.runToTime("c67x_core_0","1");
|
|
76
|
+
client.getSimulationTime("c67x_core_0").then(res => {
|
|
77
|
+
console.log(res);
|
|
78
|
+
});
|
|
79
|
+
yield client.registerTimeMonitor({
|
|
80
|
+
id: "a1",
|
|
81
|
+
time: 500,
|
|
82
|
+
cpu_name: "c67x_core_0",
|
|
83
|
+
items: [],
|
|
84
|
+
direction: 'send',
|
|
85
|
+
cycle: 5
|
|
86
|
+
});
|
|
87
|
+
yield client.startTimeMonitor("a1");
|
|
88
|
+
const dataStream = client.timeDataReceive("a1");
|
|
89
|
+
dataStream.on('data', (data) => {
|
|
90
|
+
try {
|
|
91
|
+
console.log('1');
|
|
92
|
+
}
|
|
93
|
+
catch (e) {
|
|
94
|
+
console.log('stream parse error:' + e);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
// await new Promise(resolve => setTimeout(resolve, 100))
|
|
98
|
+
// await client.stopTimeMonitor("1")
|
|
99
|
+
yield client.registerTimeMonitor({
|
|
100
|
+
id: "2",
|
|
101
|
+
time: 400,
|
|
102
|
+
cpu_name: "c67x_core_0",
|
|
103
|
+
items: [],
|
|
104
|
+
direction: 'send',
|
|
105
|
+
cycle: 5
|
|
106
|
+
});
|
|
107
|
+
yield client.startTimeMonitor("2");
|
|
108
|
+
const dataStream2 = client.timeDataReceive("2");
|
|
109
|
+
dataStream2.on('data', (data) => {
|
|
110
|
+
try {
|
|
111
|
+
console.log('2');
|
|
112
|
+
}
|
|
113
|
+
catch (e) {
|
|
114
|
+
console.log('stream parse error:' + e);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
// await new Promise(resolve => setTimeout(resolve, 100))
|
|
118
|
+
// await client.stopTimeMonitor("1")
|
|
119
|
+
yield client.registerTimeMonitor({
|
|
120
|
+
id: "3",
|
|
121
|
+
time: 300,
|
|
122
|
+
cpu_name: "c67x_core_0",
|
|
123
|
+
items: [],
|
|
124
|
+
direction: 'send',
|
|
125
|
+
cycle: 5
|
|
126
|
+
});
|
|
127
|
+
yield client.startTimeMonitor("3");
|
|
128
|
+
const dataStream3 = client.timeDataReceive("3");
|
|
129
|
+
dataStream3.on('data', (data) => {
|
|
130
|
+
try {
|
|
131
|
+
console.log('3');
|
|
132
|
+
}
|
|
133
|
+
catch (e) {
|
|
134
|
+
console.log('stream parse error:' + e);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
// await new Promise(resolve => setTimeout(resolve, 1000))
|
|
138
|
+
// const rr = await client.getSimulationTime("c67x_core_0")
|
|
139
|
+
// console.log(rr)
|
|
140
|
+
// await client.stopTimeMonitor("1")
|
|
141
|
+
yield client.registerTimeMonitor({
|
|
142
|
+
id: "4",
|
|
143
|
+
time: 200,
|
|
144
|
+
cpu_name: "c67x_core_0",
|
|
145
|
+
items: [],
|
|
146
|
+
direction: 'send',
|
|
147
|
+
cycle: 5
|
|
148
|
+
});
|
|
149
|
+
yield client.startTimeMonitor("4");
|
|
150
|
+
const dataStream4 = client.timeDataReceive("4");
|
|
151
|
+
dataStream4.on('data', (data) => {
|
|
152
|
+
try {
|
|
153
|
+
console.log('4');
|
|
154
|
+
}
|
|
155
|
+
catch (e) {
|
|
156
|
+
console.log('stream parse error:' + e);
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
// await new Promise(resolve => setTimeout(resolve, 100))
|
|
160
|
+
// await client.stopTimeMonitor("1")
|
|
161
|
+
yield client.registerTimeMonitor({
|
|
162
|
+
id: "5",
|
|
163
|
+
time: 100,
|
|
164
|
+
cpu_name: "c67x_core_0",
|
|
165
|
+
items: [],
|
|
166
|
+
direction: 'send',
|
|
167
|
+
cycle: 5
|
|
168
|
+
});
|
|
169
|
+
yield client.startTimeMonitor("5");
|
|
170
|
+
const dataStream5 = client.timeDataReceive("5");
|
|
171
|
+
dataStream5.on('data', (data) => {
|
|
172
|
+
try {
|
|
173
|
+
console.log('5');
|
|
174
|
+
}
|
|
175
|
+
catch (e) {
|
|
176
|
+
console.log('stream parse error:' + e);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
yield new Promise(resolve => setTimeout(resolve, 300000));
|
|
180
|
+
// await client.stopTimeMonitor("1")
|
|
181
|
+
console.log("response:", 123);
|
|
62
182
|
// const responseCpuList = await client.getCpuList()
|
|
63
183
|
// console.log("responseCpuList:", responseCpuList)
|
|
64
184
|
// const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', 50056);
|
package/package.json
CHANGED
package/src/SkyEyeClient.ts
CHANGED
|
@@ -1080,7 +1080,7 @@ export class SkyEyeClient extends JSONTransmissionClient {
|
|
|
1080
1080
|
|
|
1081
1081
|
private childProcess: cp.ChildProcess | null = null;
|
|
1082
1082
|
|
|
1083
|
-
public async initSkyEyeAndRun2(pathSkyEye: string, fileName: string, port: string, skyeyeDir: string
|
|
1083
|
+
public async initSkyEyeAndRun2(pathSkyEye: string, fileName: string, port: string, skyeyeDir: string) {
|
|
1084
1084
|
try {
|
|
1085
1085
|
console.log('runExample');
|
|
1086
1086
|
|
|
@@ -1095,14 +1095,12 @@ export class SkyEyeClient extends JSONTransmissionClient {
|
|
|
1095
1095
|
ackObj.result = false
|
|
1096
1096
|
throw new Error(ackObj.error)
|
|
1097
1097
|
}
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
}
|
|
1105
|
-
}
|
|
1098
|
+
response = await this.runScript(fileName, port);
|
|
1099
|
+
ackObj = JSON.parse(response.toString()).ack;
|
|
1100
|
+
if (ackObj.result === "false") {
|
|
1101
|
+
ackObj.result = false
|
|
1102
|
+
throw new Error(ackObj.error)
|
|
1103
|
+
}
|
|
1106
1104
|
return true;
|
|
1107
1105
|
} catch (error) {
|
|
1108
1106
|
console.error("initSkyEyeAndRun error:", error);
|
package/test.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { JSONResponse } from "./src/proto/skyeye_rpc_pb";
|
|
|
2
2
|
import { GrpcUtil } from "./src/GrpcUtil";
|
|
3
3
|
import { ServiceError } from "@grpc/grpc-js";
|
|
4
4
|
import { Enum } from "protobufjs";
|
|
5
|
-
|
|
6
|
-
const { SkyEyeClientFactory } = require('./src/SkyEyeClientFactory')
|
|
5
|
+
import { SkyEyeClientFactory } from './src/SkyEyeClientFactory'
|
|
6
|
+
// const { SkyEyeClientFactory } = require('./src/SkyEyeClientFactory')
|
|
7
7
|
const { SkyEyeClient } = require('./src/SkyEyeClient')
|
|
8
8
|
|
|
9
9
|
const { Cpu } = require('./src/models/Cpu')
|
|
@@ -57,15 +57,137 @@ async function test() {
|
|
|
57
57
|
// const skyeyeDir = "D:/install/SkyEye/opt/skyeye/bin/skyeye.exe"
|
|
58
58
|
// const port = "50066"
|
|
59
59
|
|
|
60
|
-
const pathSkyEye = "
|
|
61
|
-
const fileName = "
|
|
62
|
-
const skyeyeDir = "
|
|
63
|
-
const port =
|
|
60
|
+
const pathSkyEye = "C:/Users/SkyEye/Desktop/skytest-project/SkyTest_Double";
|
|
61
|
+
const fileName = "SkyTest_Double.skyeye";
|
|
62
|
+
const skyeyeDir = "C:/SkyEye/opt/skyeye/bin/skyeye.exe"
|
|
63
|
+
const port = '50019'
|
|
64
64
|
const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', port);
|
|
65
65
|
const t = await client.initSkyEyeAndRun2(pathSkyEye, fileName, port, skyeyeDir)
|
|
66
|
+
console.log(t)
|
|
67
|
+
let count = 1
|
|
68
|
+
while (count === 1) {
|
|
69
|
+
const res = (await client.getCurrentRunningState()).getState()
|
|
70
|
+
console.log(res)
|
|
71
|
+
if (res === "STOPPED" ) {
|
|
72
|
+
count++
|
|
73
|
+
}
|
|
74
|
+
await new Promise((resolve, rej) => {
|
|
75
|
+
setTimeout(()=>{
|
|
76
|
+
resolve(true)
|
|
77
|
+
}, 1000)
|
|
78
|
+
})
|
|
79
|
+
}
|
|
66
80
|
client.runCommand();
|
|
67
|
-
const response = await client.runToTime("c67x_core_0","1");
|
|
68
|
-
|
|
81
|
+
// const response = await client.runToTime("c67x_core_0","1");
|
|
82
|
+
client.getSimulationTime("c67x_core_0").then(res => {
|
|
83
|
+
console.log(res)
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
await client.registerTimeMonitor({
|
|
87
|
+
id: "a1",
|
|
88
|
+
time: 500,
|
|
89
|
+
cpu_name: "c67x_core_0",
|
|
90
|
+
items: [],
|
|
91
|
+
direction: 'send',
|
|
92
|
+
cycle: 5
|
|
93
|
+
})
|
|
94
|
+
await client.startTimeMonitor("a1")
|
|
95
|
+
const dataStream = client.timeDataReceive("a1")
|
|
96
|
+
dataStream.on('data', (data: any) => {
|
|
97
|
+
try {
|
|
98
|
+
console.log('1')
|
|
99
|
+
} catch (e) {
|
|
100
|
+
console.log('stream parse error:' + e)
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
// await new Promise(resolve => setTimeout(resolve, 100))
|
|
104
|
+
// await client.stopTimeMonitor("1")
|
|
105
|
+
|
|
106
|
+
await client.registerTimeMonitor({
|
|
107
|
+
id: "2",
|
|
108
|
+
time: 400,
|
|
109
|
+
cpu_name: "c67x_core_0",
|
|
110
|
+
items: [],
|
|
111
|
+
direction: 'send',
|
|
112
|
+
cycle: 5
|
|
113
|
+
})
|
|
114
|
+
await client.startTimeMonitor("2")
|
|
115
|
+
const dataStream2 = client.timeDataReceive("2")
|
|
116
|
+
dataStream2.on('data', (data: any) => {
|
|
117
|
+
try {
|
|
118
|
+
console.log('2')
|
|
119
|
+
} catch (e) {
|
|
120
|
+
console.log('stream parse error:' + e)
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
// await new Promise(resolve => setTimeout(resolve, 100))
|
|
124
|
+
// await client.stopTimeMonitor("1")
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
await client.registerTimeMonitor({
|
|
128
|
+
id: "3",
|
|
129
|
+
time: 300,
|
|
130
|
+
cpu_name: "c67x_core_0",
|
|
131
|
+
items: [],
|
|
132
|
+
direction: 'send',
|
|
133
|
+
cycle: 5
|
|
134
|
+
})
|
|
135
|
+
await client.startTimeMonitor("3")
|
|
136
|
+
const dataStream3 = client.timeDataReceive("3")
|
|
137
|
+
dataStream3.on('data', (data: any) => {
|
|
138
|
+
try {
|
|
139
|
+
console.log('3')
|
|
140
|
+
} catch (e) {
|
|
141
|
+
console.log('stream parse error:' + e)
|
|
142
|
+
}
|
|
143
|
+
})
|
|
144
|
+
// await new Promise(resolve => setTimeout(resolve, 1000))
|
|
145
|
+
// const rr = await client.getSimulationTime("c67x_core_0")
|
|
146
|
+
// console.log(rr)
|
|
147
|
+
// await client.stopTimeMonitor("1")
|
|
148
|
+
|
|
149
|
+
await client.registerTimeMonitor({
|
|
150
|
+
id: "4",
|
|
151
|
+
time: 200,
|
|
152
|
+
cpu_name: "c67x_core_0",
|
|
153
|
+
items: [],
|
|
154
|
+
direction: 'send',
|
|
155
|
+
cycle: 5
|
|
156
|
+
})
|
|
157
|
+
await client.startTimeMonitor("4")
|
|
158
|
+
const dataStream4 = client.timeDataReceive("4")
|
|
159
|
+
dataStream4.on('data', (data: any) => {
|
|
160
|
+
try {
|
|
161
|
+
console.log('4')
|
|
162
|
+
} catch (e) {
|
|
163
|
+
console.log('stream parse error:' + e)
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
// await new Promise(resolve => setTimeout(resolve, 100))
|
|
167
|
+
// await client.stopTimeMonitor("1")
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
await client.registerTimeMonitor({
|
|
171
|
+
id: "5",
|
|
172
|
+
time: 100,
|
|
173
|
+
cpu_name: "c67x_core_0",
|
|
174
|
+
items: [],
|
|
175
|
+
direction: 'send',
|
|
176
|
+
cycle: 5
|
|
177
|
+
})
|
|
178
|
+
await client.startTimeMonitor("5")
|
|
179
|
+
const dataStream5 = client.timeDataReceive("5")
|
|
180
|
+
dataStream5.on('data', (data: any) => {
|
|
181
|
+
try {
|
|
182
|
+
console.log('5')
|
|
183
|
+
} catch (e) {
|
|
184
|
+
console.log('stream parse error:' + e)
|
|
185
|
+
}
|
|
186
|
+
})
|
|
187
|
+
await new Promise(resolve => setTimeout(resolve, 300000))
|
|
188
|
+
// await client.stopTimeMonitor("1")
|
|
189
|
+
|
|
190
|
+
console.log("response:", 123)
|
|
69
191
|
|
|
70
192
|
// const responseCpuList = await client.getCpuList()
|
|
71
193
|
// console.log("responseCpuList:", responseCpuList)
|