skyeye-sdk-js 1.0.6 → 1.0.7
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 +4 -12
- package/dist/test.js +5 -1
- package/package.json +1 -1
- package/src/SkyEyeClient.ts +10 -10
- package/test.ts +5 -1
package/dist/src/SkyEyeClient.js
CHANGED
|
@@ -829,17 +829,9 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
|
|
|
829
829
|
getPort() {
|
|
830
830
|
return this.port;
|
|
831
831
|
}
|
|
832
|
-
|
|
833
|
-
// const pathSkyEye = "D:/install/SkyEye/demo/c6713_demo";
|
|
834
|
-
const pathSkyEye = "D:/data/case/c6713_demo";
|
|
835
|
-
const fileName = "c6713_demo.skyeye";
|
|
832
|
+
initSkyEye(pathSkyEye, fileName, skyeyeDir, port) {
|
|
836
833
|
console.log('runExample');
|
|
837
|
-
|
|
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);
|
|
834
|
+
cp.exec(skyeyeDir + " -q " + port + "\n", (err, stdout, stderr) => {
|
|
843
835
|
console.log('stdout: ' + stdout);
|
|
844
836
|
console.log('stderr: ' + stderr);
|
|
845
837
|
});
|
|
@@ -852,14 +844,14 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
|
|
|
852
844
|
Jr.setRequest("{\"request\": {\"name\": \"chdir\", \"args\": {\"path\":\"" + pathSkyEye + "\"}}}");
|
|
853
845
|
client.callSkyEye(Jr, (error, response) => {
|
|
854
846
|
console.log("chdir res:" + response + error);
|
|
855
|
-
// client.run_script();
|
|
856
847
|
Jr.setRequest("{\"request\": {\"name\": \"run_script\", \"args\": {\"filename\":\"" + fileName + "\"}}}");
|
|
857
848
|
client.callSkyEye(Jr, (error, response) => {
|
|
858
849
|
console.log("run_script res:" + response + error);
|
|
850
|
+
this.runCommand();
|
|
851
|
+
return "1";
|
|
859
852
|
});
|
|
860
853
|
});
|
|
861
854
|
}, 2000);
|
|
862
|
-
return "1";
|
|
863
855
|
}
|
|
864
856
|
}
|
|
865
857
|
exports.SkyEyeClient = SkyEyeClient;
|
package/dist/test.js
CHANGED
|
@@ -26,7 +26,11 @@ function test() {
|
|
|
26
26
|
// const response = await client.getMemoryValueDefault(1, 16);
|
|
27
27
|
// const response = await client.getMemoryValue("c7s",0,16);
|
|
28
28
|
// console.log("结果response:", response)
|
|
29
|
-
|
|
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
|
+
yield client.initSkyEye(pathSkyEye, fileName, skyeyeDir, port);
|
|
30
34
|
// GrpcUtil.initAndRunExample();
|
|
31
35
|
});
|
|
32
36
|
}
|
package/package.json
CHANGED
package/src/SkyEyeClient.ts
CHANGED
|
@@ -770,21 +770,15 @@ export class SkyEyeClient extends JSONTransmissionClient {
|
|
|
770
770
|
return this.port;
|
|
771
771
|
}
|
|
772
772
|
|
|
773
|
-
public
|
|
774
|
-
const pathSkyEye = "D:/data/case/c6713_demo";
|
|
775
|
-
const fileName = "c6713_demo.skyeye";
|
|
773
|
+
public initSkyEyeAndRun(pathSkyEye:string,fileName:string,skyeyeDir:string,port:string) {
|
|
776
774
|
console.log('runExample');
|
|
777
|
-
cp.exec("
|
|
775
|
+
cp.exec(skyeyeDir+" -q "+port+"\n", (err: any, stdout: any, stderr: any) => {
|
|
778
776
|
console.log('stdout: ' + stdout);
|
|
779
777
|
console.log('stderr: ' + stderr);
|
|
780
778
|
});
|
|
781
779
|
setTimeout(() => {
|
|
782
|
-
|
|
783
|
-
//客户端
|
|
784
780
|
client = new JSONTransmissionClient('127.0.0.1:50051', grpc.credentials.createInsecure());
|
|
785
781
|
console.log('client:' + client);
|
|
786
|
-
|
|
787
|
-
//chdir
|
|
788
782
|
const Jr = new JSONRequest();
|
|
789
783
|
Jr.setRequest("{\"request\": {\"name\": \"chdir\", \"args\": {\"path\":\"" + pathSkyEye + "\"}}}");
|
|
790
784
|
client.callSkyEye(Jr, (error: ServiceError | null, response: JSONResponse) => {
|
|
@@ -793,12 +787,18 @@ export class SkyEyeClient extends JSONTransmissionClient {
|
|
|
793
787
|
Jr.setRequest("{\"request\": {\"name\": \"run_script\", \"args\": {\"filename\":\"" + fileName + "\"}}}");
|
|
794
788
|
client.callSkyEye(Jr, (error: ServiceError | null, response: JSONResponse) => {
|
|
795
789
|
console.log("run_script res:" + response + error);
|
|
796
|
-
|
|
790
|
+
|
|
791
|
+
this.runCommand()
|
|
792
|
+
|
|
793
|
+
return "1";
|
|
797
794
|
});
|
|
798
795
|
});
|
|
799
796
|
}, 2000);
|
|
800
|
-
return "1";
|
|
801
797
|
}
|
|
802
798
|
|
|
803
799
|
|
|
800
|
+
|
|
801
|
+
|
|
802
|
+
|
|
803
|
+
|
|
804
804
|
}
|
package/test.ts
CHANGED
|
@@ -22,7 +22,11 @@ async function test() {
|
|
|
22
22
|
// const response = await client.getMemoryValue("c7s",0,16);
|
|
23
23
|
// console.log("结果response:", response)
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
const pathSkyEye = "D:/data/case/c6713_demo";
|
|
26
|
+
const fileName = "c6713_demo.skyeye";
|
|
27
|
+
const skyeyeDir = "D:/install/skyeye/opt/skyeye/bin/skyeye.exe"
|
|
28
|
+
const port = "50051"
|
|
29
|
+
await client.initSkyEyeAndRun(pathSkyEye,fileName,skyeyeDir,port);
|
|
26
30
|
|
|
27
31
|
// GrpcUtil.initAndRunExample();
|
|
28
32
|
|