skyeye-sdk-js 1.1.2 → 1.1.3
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.js +1 -1
- package/dist/test.js +29 -12
- package/package.json +1 -1
- package/src/GrpcUtil.js +91 -0
- package/src/RequestFactory.js +259 -0
- package/src/SkyEyeClient.js +1272 -0
- package/src/SkyEyeClient.ts +2 -2
- package/src/requests/BaseRequest.js +19 -0
- package/src/response/BaseResponse.js +27 -0
- package/test.ts +30 -12
package/src/SkyEyeClient.ts
CHANGED
|
@@ -50,7 +50,7 @@ export class SkyEyeClient extends JSONTransmissionClient {
|
|
|
50
50
|
const stream = super.runTestcase(request);
|
|
51
51
|
return stream;
|
|
52
52
|
} catch (error) {
|
|
53
|
-
console.error("Error during
|
|
53
|
+
console.error("Error during RunTestcas2e:", error);
|
|
54
54
|
throw error;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -827,7 +827,7 @@ export class SkyEyeClient extends JSONTransmissionClient {
|
|
|
827
827
|
client.callSkyEye(Jr, (error: ServiceError | null, response: JSONResponse) => {
|
|
828
828
|
console.log("run_script res:" + response + error);
|
|
829
829
|
|
|
830
|
-
this.runCommand()
|
|
830
|
+
// this.runCommand()
|
|
831
831
|
|
|
832
832
|
return "1";
|
|
833
833
|
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseRequest = void 0;
|
|
4
|
+
var BaseRequest = /** @class */ (function () {
|
|
5
|
+
function BaseRequest(name) {
|
|
6
|
+
this.request = {
|
|
7
|
+
name: name,
|
|
8
|
+
args: null
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
BaseRequest.prototype.toJSONString = function () {
|
|
12
|
+
return JSON.stringify({ request: this.request });
|
|
13
|
+
};
|
|
14
|
+
BaseRequest.prototype.setArgs = function (args) {
|
|
15
|
+
this.request.args = args;
|
|
16
|
+
};
|
|
17
|
+
return BaseRequest;
|
|
18
|
+
}());
|
|
19
|
+
exports.BaseRequest = BaseRequest;
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.BaseResponse = void 0;
|
|
19
|
+
var skyeye_rpc_pb_1 = require("../proto/skyeye_rpc_pb");
|
|
20
|
+
var BaseResponse = /** @class */ (function (_super) {
|
|
21
|
+
__extends(BaseResponse, _super);
|
|
22
|
+
function BaseResponse() {
|
|
23
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
+
}
|
|
25
|
+
return BaseResponse;
|
|
26
|
+
}(skyeye_rpc_pb_1.JSONResponse));
|
|
27
|
+
exports.BaseResponse = BaseResponse;
|
package/test.ts
CHANGED
|
@@ -12,7 +12,7 @@ async function test() {
|
|
|
12
12
|
// await client.getCurrentCpuMips();
|
|
13
13
|
// await client.runCommand();
|
|
14
14
|
|
|
15
|
-
const response = await client.getCurrentRunningState();
|
|
15
|
+
// const response = await client.getCurrentRunningState();
|
|
16
16
|
|
|
17
17
|
// const response = await client.getGlobalVarValueDefault("a",GlobalVarType.DOUBLE);
|
|
18
18
|
// const response = await client.getGlobalVarValue("cx53123","a",16,GlobalVarType.DOUBLE);
|
|
@@ -22,7 +22,7 @@ async function test() {
|
|
|
22
22
|
|
|
23
23
|
// const response = await client.getMemoryValueDefault(1, 16);
|
|
24
24
|
// const response = await client.getMemoryValue("c7s",0,16);
|
|
25
|
-
console.log("结果response:", response)
|
|
25
|
+
// console.log("结果response:", response)
|
|
26
26
|
|
|
27
27
|
// const pathSkyEye = "D:/data/case/c6713_demo";
|
|
28
28
|
// const fileName = "c6713_demo.skyeye";
|
|
@@ -33,15 +33,33 @@ async function test() {
|
|
|
33
33
|
// GrpcUtil.initAndRunExample();
|
|
34
34
|
|
|
35
35
|
// 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"}}}]}';
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
const json = {
|
|
37
|
+
id: "memory_test",
|
|
38
|
+
steps: [
|
|
39
|
+
{
|
|
40
|
+
condition: { type: 5, addr: "0x1800000", length: 8 },
|
|
41
|
+
send: { target: { type: 3, addr: "0x4", length: 4 }, data: 50 }
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
condition: { type: 3, addr: "0x1900000", length: 8 },
|
|
45
|
+
send: { target: { type: 3, addr: "0x4", length: 4 }, data: 50 }
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
expects: [
|
|
49
|
+
{ condition: { type: 0 }, expect: { target: { type: 3, addr: "0x8", length: 4 } } }
|
|
50
|
+
]
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const jsonString = JSON.stringify(json);
|
|
54
|
+
const stream = await client.RunTestcase(jsonString);
|
|
55
|
+
stream.on('data', (response: JSONResponse) => {
|
|
56
|
+
console.log('Received response:',response);
|
|
57
|
+
});
|
|
58
|
+
stream.on('end', () => {
|
|
59
|
+
console.log('Stream ended');
|
|
60
|
+
});
|
|
61
|
+
stream.on('error', (error: Error) => {
|
|
62
|
+
console.error('Error occurred:', error.message);
|
|
63
|
+
});
|
|
46
64
|
}
|
|
47
65
|
test();
|