skyeye-sdk-js 1.4.7 → 1.4.9
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/RequestFactory.d.ts +1 -1
- package/dist/src/RequestFactory.js +2 -1
- package/dist/src/SkyEyeClient.d.ts +2 -2
- package/dist/src/SkyEyeClient.js +4 -4
- package/dist/src/proto/protoc.sh +32 -32
- package/dist/src/proto/skyeye_rpc_grpc_pb.js +88 -88
- package/dist/src/proto/skyeye_rpc_pb.js +328 -328
- package/package.json +1 -1
- package/src/RequestFactory.ts +3 -2
- package/src/SkyEyeClient.ts +4 -4
- package/src/exception/SkyEyeSDKException.js +31 -31
- package/src/models/Board.js +18 -18
- package/src/models/Cpu.js +66 -66
- package/src/models/CpuInterface.js +2 -2
- package/src/models/Device.js +27 -27
- package/src/models/DeviceInterface.js +2 -2
- package/src/models/DeviceState.js +8 -8
- package/src/models/FaultInjectItem.js +17 -17
- package/src/models/FaultInjectItemInterface.js +2 -2
- package/src/models/FaultInjectType.js +25 -25
- package/src/models/GlobalVarType.js +9 -9
- package/src/models/InstructionItem.js +9 -9
- package/src/models/Node.js +2 -2
- package/src/models/Register.js +33 -33
- package/src/models/RegisterInterface.js +2 -2
- package/src/proto/protoc.sh +32 -32
- package/src/proto/skyeye_rpc_grpc_pb.js +88 -88
- package/src/proto/skyeye_rpc_pb.js +328 -328
- package/src/proto bc_240328/protoc.sh +32 -32
- package/src/proto bc_240328/skyeye_rpc_grpc_pb.js +77 -77
- package/src/proto bc_240328/skyeye_rpc_pb.js +328 -328
- package/src/requests/BaseRequest.js +19 -19
- package/src/requests/GetRunningStatusRequest.js +10 -10
- package/src/response/BaseResponse.js +27 -27
- package/src/response/GetAllDeviceInfoResponse.js +29 -29
- package/src/response/GetCpuListResponse.js +36 -36
- package/src/response/GetCpuRegisterInfoResponse.js +29 -29
- package/src/response/GetCurrentPCResponse.js +7 -7
- package/src/response/GetDeviceListResponse.js +29 -29
- package/src/response/GetDeviceTreeResponse.js +29 -29
- package/src/response/GetDisassembleInfoResponse.js +27 -27
- package/src/response/GetFaultInjectListResponse.js +40 -40
- package/src/response/GetRamAddrInfoResponse.js +27 -27
- package/src/response/GetRunningStateResponse.js +43 -43
- package/src/utils/ParseBoardUtils.js +111 -111
- package/dist/GrpcUtil.d.ts +0 -9
- package/dist/GrpcUtil.js +0 -55
- package/dist/JsonRequest.d.ts +0 -10
- package/dist/JsonRequest.js +0 -29
- package/dist/JsonResponse.d.ts +0 -12
- package/dist/JsonResponse.js +0 -36
- package/dist/RequestFactory.d.ts +0 -35
- package/dist/RequestFactory.js +0 -257
- package/dist/exception/SkyEyeSDKException.d.ts +0 -3
- package/dist/exception/SkyEyeSDKException.js +0 -13
- package/dist/models/Board.d.ts +0 -9
- package/dist/models/Board.js +0 -15
- package/dist/models/Cpu.d.ts +0 -14
- package/dist/models/Cpu.js +0 -47
- package/dist/models/CpuInterface.d.ts +0 -13
- package/dist/models/CpuInterface.js +0 -2
- package/dist/models/Device.d.ts +0 -38
- package/dist/models/Device.js +0 -26
- package/dist/models/DeviceInterface.d.ts +0 -12
- package/dist/models/DeviceInterface.js +0 -2
- package/dist/models/DeviceState.d.ts +0 -4
- package/dist/models/DeviceState.js +0 -8
- package/dist/models/FaultInjectItem.d.ts +0 -11
- package/dist/models/FaultInjectItem.js +0 -16
- package/dist/models/FaultInjectItemInterface.d.ts +0 -9
- package/dist/models/FaultInjectItemInterface.js +0 -2
- package/dist/models/FaultInjectType.d.ts +0 -11
- package/dist/models/FaultInjectType.js +0 -25
- package/dist/models/GlobalVarType.d.ts +0 -5
- package/dist/models/GlobalVarType.js +0 -9
- package/dist/models/InstructionItem.d.ts +0 -5
- package/dist/models/InstructionItem.js +0 -6
- package/dist/models/Node.d.ts +0 -4
- package/dist/models/Node.js +0 -2
- package/dist/models/Register.d.ts +0 -38
- package/dist/models/Register.js +0 -32
- package/dist/models/RegisterInterface.d.ts +0 -10
- package/dist/models/RegisterInterface.js +0 -2
- package/dist/src/proto copy/skyeye_rpc.proto +0 -11
- package/dist/src/proto copy/skyeye_rpc_grpc_pb.d.ts +0 -40
- package/dist/src/proto copy/skyeye_rpc_grpc_pb.js +0 -44
- package/dist/src/proto copy/skyeye_rpc_pb.d.ts +0 -47
- package/dist/src/proto copy/skyeye_rpc_pb.js +0 -322
- package/dist/utils/ParseBoardUtils.d.ts +0 -6
- package/dist/utils/ParseBoardUtils.js +0 -108
package/dist/models/Register.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Register = void 0;
|
|
4
|
-
class Register {
|
|
5
|
-
getName() {
|
|
6
|
-
return this.name;
|
|
7
|
-
}
|
|
8
|
-
setName(name) {
|
|
9
|
-
this.name = name;
|
|
10
|
-
}
|
|
11
|
-
getParent() {
|
|
12
|
-
return this.parent;
|
|
13
|
-
}
|
|
14
|
-
setParent(node) {
|
|
15
|
-
this.parent = node;
|
|
16
|
-
}
|
|
17
|
-
constructor(info) {
|
|
18
|
-
if (info) {
|
|
19
|
-
this.name = info.name;
|
|
20
|
-
this.parent = info.parent;
|
|
21
|
-
this.baseAddr = info.baseAddr;
|
|
22
|
-
this.bits = info.bits;
|
|
23
|
-
this.value = info.value;
|
|
24
|
-
this.offset = info.offset;
|
|
25
|
-
this.description = info.description;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
toString() {
|
|
29
|
-
return `Register{name='${this.name}', parent=${this.parent != null ? this.parent.getName() : null}, baseAddr=${this.baseAddr}, offset=${this.offset}, bits=${this.bits}, value=${this.value}, description='${this.description}'}`;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.Register = Register;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// package:
|
|
2
|
-
// file: skyeye_rpc.proto
|
|
3
|
-
|
|
4
|
-
/* tslint:disable */
|
|
5
|
-
/* eslint-disable */
|
|
6
|
-
import * as grpc from '@grpc/grpc-js';
|
|
7
|
-
import * as skyeye_rpc_pb from "./skyeye_rpc_pb";
|
|
8
|
-
|
|
9
|
-
interface IJSONTransmissionService extends grpc.ServiceDefinition<grpc.UntypedServiceImplementation> {
|
|
10
|
-
callSkyEye: IJSONTransmissionService_ICallSkyEye;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface IJSONTransmissionService_ICallSkyEye extends grpc.MethodDefinition<skyeye_rpc_pb.JSONRequest, skyeye_rpc_pb.JSONResponse> {
|
|
14
|
-
path: "/JSONTransmission/CallSkyEye";
|
|
15
|
-
requestStream: false;
|
|
16
|
-
responseStream: false;
|
|
17
|
-
requestSerialize: grpc.serialize<skyeye_rpc_pb.JSONRequest>;
|
|
18
|
-
requestDeserialize: grpc.deserialize<skyeye_rpc_pb.JSONRequest>;
|
|
19
|
-
responseSerialize: grpc.serialize<skyeye_rpc_pb.JSONResponse>;
|
|
20
|
-
responseDeserialize: grpc.deserialize<skyeye_rpc_pb.JSONResponse>;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const JSONTransmissionService: IJSONTransmissionService;
|
|
24
|
-
|
|
25
|
-
export interface IJSONTransmissionServer {
|
|
26
|
-
callSkyEye: grpc.handleUnaryCall<skyeye_rpc_pb.JSONRequest, skyeye_rpc_pb.JSONResponse>;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface IJSONTransmissionClient {
|
|
30
|
-
callSkyEye(request: skyeye_rpc_pb.JSONRequest, callback: (error: grpc.ServiceError | null, response: skyeye_rpc_pb.JSONResponse) => void): grpc.ClientUnaryCall;
|
|
31
|
-
callSkyEye(request: skyeye_rpc_pb.JSONRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: skyeye_rpc_pb.JSONResponse) => void): grpc.ClientUnaryCall;
|
|
32
|
-
callSkyEye(request: skyeye_rpc_pb.JSONRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: skyeye_rpc_pb.JSONResponse) => void): grpc.ClientUnaryCall;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export class JSONTransmissionClient extends grpc.Client implements IJSONTransmissionClient {
|
|
36
|
-
constructor(address: string, credentials: grpc.ChannelCredentials, options?: object);
|
|
37
|
-
public callSkyEye(request: skyeye_rpc_pb.JSONRequest, callback: (error: grpc.ServiceError | null, response: skyeye_rpc_pb.JSONResponse) => void): grpc.ClientUnaryCall;
|
|
38
|
-
public callSkyEye(request: skyeye_rpc_pb.JSONRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: skyeye_rpc_pb.JSONResponse) => void): grpc.ClientUnaryCall;
|
|
39
|
-
public callSkyEye(request: skyeye_rpc_pb.JSONRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: skyeye_rpc_pb.JSONResponse) => void): grpc.ClientUnaryCall;
|
|
40
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// GENERATED CODE -- DO NOT EDIT!
|
|
2
|
-
|
|
3
|
-
'use strict';
|
|
4
|
-
var grpc = require('@grpc/grpc-js');
|
|
5
|
-
var src_proto_skyeye_rpc_pb = require('../../src/proto/skyeye_rpc_pb.js');
|
|
6
|
-
|
|
7
|
-
function serialize_JSONRequest(arg) {
|
|
8
|
-
if (!(arg instanceof src_proto_skyeye_rpc_pb.JSONRequest)) {
|
|
9
|
-
throw new Error('Expected argument of type JSONRequest');
|
|
10
|
-
}
|
|
11
|
-
return Buffer.from(arg.serializeBinary());
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function deserialize_JSONRequest(buffer_arg) {
|
|
15
|
-
return src_proto_skyeye_rpc_pb.JSONRequest.deserializeBinary(new Uint8Array(buffer_arg));
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function serialize_JSONResponse(arg) {
|
|
19
|
-
if (!(arg instanceof src_proto_skyeye_rpc_pb.JSONResponse)) {
|
|
20
|
-
throw new Error('Expected argument of type JSONResponse');
|
|
21
|
-
}
|
|
22
|
-
return Buffer.from(arg.serializeBinary());
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function deserialize_JSONResponse(buffer_arg) {
|
|
26
|
-
return src_proto_skyeye_rpc_pb.JSONResponse.deserializeBinary(new Uint8Array(buffer_arg));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var JSONTransmissionService = exports.JSONTransmissionService = {
|
|
31
|
-
callSkyEye: {
|
|
32
|
-
path: '/JSONTransmission/CallSkyEye',
|
|
33
|
-
requestStream: false,
|
|
34
|
-
responseStream: false,
|
|
35
|
-
requestType: src_proto_skyeye_rpc_pb.JSONRequest,
|
|
36
|
-
responseType: src_proto_skyeye_rpc_pb.JSONResponse,
|
|
37
|
-
requestSerialize: serialize_JSONRequest,
|
|
38
|
-
requestDeserialize: deserialize_JSONRequest,
|
|
39
|
-
responseSerialize: serialize_JSONResponse,
|
|
40
|
-
responseDeserialize: deserialize_JSONResponse,
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
exports.JSONTransmissionClient = grpc.makeGenericClientConstructor(JSONTransmissionService);
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// package:
|
|
2
|
-
// file: skyeye_rpc.proto
|
|
3
|
-
|
|
4
|
-
/* tslint:disable */
|
|
5
|
-
/* eslint-disable */
|
|
6
|
-
|
|
7
|
-
import * as jspb from "google-protobuf";
|
|
8
|
-
|
|
9
|
-
export class JSONRequest extends jspb.Message {
|
|
10
|
-
getRequest(): string;
|
|
11
|
-
setRequest(value: string): JSONRequest;
|
|
12
|
-
|
|
13
|
-
serializeBinary(): Uint8Array;
|
|
14
|
-
toObject(includeInstance?: boolean): JSONRequest.AsObject;
|
|
15
|
-
static toObject(includeInstance: boolean, msg: JSONRequest): JSONRequest.AsObject;
|
|
16
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
17
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
18
|
-
static serializeBinaryToWriter(message: JSONRequest, writer: jspb.BinaryWriter): void;
|
|
19
|
-
static deserializeBinary(bytes: Uint8Array): JSONRequest;
|
|
20
|
-
static deserializeBinaryFromReader(message: JSONRequest, reader: jspb.BinaryReader): JSONRequest;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export namespace JSONRequest {
|
|
24
|
-
export type AsObject = {
|
|
25
|
-
request: string,
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export class JSONResponse extends jspb.Message {
|
|
30
|
-
getResponse(): string;
|
|
31
|
-
setResponse(value: string): JSONResponse;
|
|
32
|
-
|
|
33
|
-
serializeBinary(): Uint8Array;
|
|
34
|
-
toObject(includeInstance?: boolean): JSONResponse.AsObject;
|
|
35
|
-
static toObject(includeInstance: boolean, msg: JSONResponse): JSONResponse.AsObject;
|
|
36
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
37
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
38
|
-
static serializeBinaryToWriter(message: JSONResponse, writer: jspb.BinaryWriter): void;
|
|
39
|
-
static deserializeBinary(bytes: Uint8Array): JSONResponse;
|
|
40
|
-
static deserializeBinaryFromReader(message: JSONResponse, reader: jspb.BinaryReader): JSONResponse;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export namespace JSONResponse {
|
|
44
|
-
export type AsObject = {
|
|
45
|
-
response: string,
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,322 +0,0 @@
|
|
|
1
|
-
// source: src/proto/skyeye_rpc.proto
|
|
2
|
-
/**
|
|
3
|
-
* @fileoverview
|
|
4
|
-
* @enhanceable
|
|
5
|
-
* @suppress {missingRequire} reports error on implicit type usages.
|
|
6
|
-
* @suppress {messageConventions} JS Compiler reports an error if a variable or
|
|
7
|
-
* field starts with 'MSG_' and isn't a translatable message.
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
// GENERATED CODE -- DO NOT EDIT!
|
|
11
|
-
/* eslint-disable */
|
|
12
|
-
// @ts-nocheck
|
|
13
|
-
|
|
14
|
-
var jspb = require('google-protobuf');
|
|
15
|
-
var goog = jspb;
|
|
16
|
-
var global = Function('return this')();
|
|
17
|
-
|
|
18
|
-
goog.exportSymbol('proto.JSONRequest', null, global);
|
|
19
|
-
goog.exportSymbol('proto.JSONResponse', null, global);
|
|
20
|
-
/**
|
|
21
|
-
* Generated by JsPbCodeGenerator.
|
|
22
|
-
* @param {Array=} opt_data Optional initial data array, typically from a
|
|
23
|
-
* server response, or constructed directly in Javascript. The array is used
|
|
24
|
-
* in place and becomes part of the constructed object. It is not cloned.
|
|
25
|
-
* If no data is provided, the constructed object will be empty, but still
|
|
26
|
-
* valid.
|
|
27
|
-
* @extends {jspb.Message}
|
|
28
|
-
* @constructor
|
|
29
|
-
*/
|
|
30
|
-
proto.JSONRequest = function(opt_data) {
|
|
31
|
-
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
|
|
32
|
-
};
|
|
33
|
-
goog.inherits(proto.JSONRequest, jspb.Message);
|
|
34
|
-
if (goog.DEBUG && !COMPILED) {
|
|
35
|
-
/**
|
|
36
|
-
* @public
|
|
37
|
-
* @override
|
|
38
|
-
*/
|
|
39
|
-
proto.JSONRequest.displayName = 'proto.JSONRequest';
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Generated by JsPbCodeGenerator.
|
|
43
|
-
* @param {Array=} opt_data Optional initial data array, typically from a
|
|
44
|
-
* server response, or constructed directly in Javascript. The array is used
|
|
45
|
-
* in place and becomes part of the constructed object. It is not cloned.
|
|
46
|
-
* If no data is provided, the constructed object will be empty, but still
|
|
47
|
-
* valid.
|
|
48
|
-
* @extends {jspb.Message}
|
|
49
|
-
* @constructor
|
|
50
|
-
*/
|
|
51
|
-
proto.JSONResponse = function(opt_data) {
|
|
52
|
-
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
|
|
53
|
-
};
|
|
54
|
-
goog.inherits(proto.JSONResponse, jspb.Message);
|
|
55
|
-
if (goog.DEBUG && !COMPILED) {
|
|
56
|
-
/**
|
|
57
|
-
* @public
|
|
58
|
-
* @override
|
|
59
|
-
*/
|
|
60
|
-
proto.JSONResponse.displayName = 'proto.JSONResponse';
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
66
|
-
/**
|
|
67
|
-
* Creates an object representation of this proto.
|
|
68
|
-
* Field names that are reserved in JavaScript and will be renamed to pb_name.
|
|
69
|
-
* Optional fields that are not set will be set to undefined.
|
|
70
|
-
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
|
|
71
|
-
* For the list of reserved names please see:
|
|
72
|
-
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
|
|
73
|
-
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
|
|
74
|
-
* JSPB instance for transitional soy proto support:
|
|
75
|
-
* http://goto/soy-param-migration
|
|
76
|
-
* @return {!Object}
|
|
77
|
-
*/
|
|
78
|
-
proto.JSONRequest.prototype.toObject = function(opt_includeInstance) {
|
|
79
|
-
return proto.JSONRequest.toObject(opt_includeInstance, this);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Static version of the {@see toObject} method.
|
|
85
|
-
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
|
|
86
|
-
* the JSPB instance for transitional soy proto support:
|
|
87
|
-
* http://goto/soy-param-migration
|
|
88
|
-
* @param {!proto.JSONRequest} msg The msg instance to transform.
|
|
89
|
-
* @return {!Object}
|
|
90
|
-
* @suppress {unusedLocalVariables} f is only used for nested messages
|
|
91
|
-
*/
|
|
92
|
-
proto.JSONRequest.toObject = function(includeInstance, msg) {
|
|
93
|
-
var f, obj = {
|
|
94
|
-
request: jspb.Message.getFieldWithDefault(msg, 1, "")
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
if (includeInstance) {
|
|
98
|
-
obj.$jspbMessageInstance = msg;
|
|
99
|
-
}
|
|
100
|
-
return obj;
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Deserializes binary data (in protobuf wire format).
|
|
107
|
-
* @param {jspb.ByteSource} bytes The bytes to deserialize.
|
|
108
|
-
* @return {!proto.JSONRequest}
|
|
109
|
-
*/
|
|
110
|
-
proto.JSONRequest.deserializeBinary = function(bytes) {
|
|
111
|
-
var reader = new jspb.BinaryReader(bytes);
|
|
112
|
-
var msg = new proto.JSONRequest;
|
|
113
|
-
return proto.JSONRequest.deserializeBinaryFromReader(msg, reader);
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Deserializes binary data (in protobuf wire format) from the
|
|
119
|
-
* given reader into the given message object.
|
|
120
|
-
* @param {!proto.JSONRequest} msg The message object to deserialize into.
|
|
121
|
-
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
|
|
122
|
-
* @return {!proto.JSONRequest}
|
|
123
|
-
*/
|
|
124
|
-
proto.JSONRequest.deserializeBinaryFromReader = function(msg, reader) {
|
|
125
|
-
while (reader.nextField()) {
|
|
126
|
-
if (reader.isEndGroup()) {
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
var field = reader.getFieldNumber();
|
|
130
|
-
switch (field) {
|
|
131
|
-
case 1:
|
|
132
|
-
var value = /** @type {string} */ (reader.readString());
|
|
133
|
-
msg.setRequest(value);
|
|
134
|
-
break;
|
|
135
|
-
default:
|
|
136
|
-
reader.skipField();
|
|
137
|
-
break;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return msg;
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Serializes the message to binary data (in protobuf wire format).
|
|
146
|
-
* @return {!Uint8Array}
|
|
147
|
-
*/
|
|
148
|
-
proto.JSONRequest.prototype.serializeBinary = function() {
|
|
149
|
-
var writer = new jspb.BinaryWriter();
|
|
150
|
-
proto.JSONRequest.serializeBinaryToWriter(this, writer);
|
|
151
|
-
return writer.getResultBuffer();
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Serializes the given message to binary data (in protobuf wire
|
|
157
|
-
* format), writing to the given BinaryWriter.
|
|
158
|
-
* @param {!proto.JSONRequest} message
|
|
159
|
-
* @param {!jspb.BinaryWriter} writer
|
|
160
|
-
* @suppress {unusedLocalVariables} f is only used for nested messages
|
|
161
|
-
*/
|
|
162
|
-
proto.JSONRequest.serializeBinaryToWriter = function(message, writer) {
|
|
163
|
-
var f = undefined;
|
|
164
|
-
f = message.getRequest();
|
|
165
|
-
if (f.length > 0) {
|
|
166
|
-
writer.writeString(
|
|
167
|
-
1,
|
|
168
|
-
f
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* optional string request = 1;
|
|
176
|
-
* @return {string}
|
|
177
|
-
*/
|
|
178
|
-
proto.JSONRequest.prototype.getRequest = function() {
|
|
179
|
-
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* @param {string} value
|
|
185
|
-
* @return {!proto.JSONRequest} returns this
|
|
186
|
-
*/
|
|
187
|
-
proto.JSONRequest.prototype.setRequest = function(value) {
|
|
188
|
-
return jspb.Message.setProto3StringField(this, 1, value);
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
196
|
-
/**
|
|
197
|
-
* Creates an object representation of this proto.
|
|
198
|
-
* Field names that are reserved in JavaScript and will be renamed to pb_name.
|
|
199
|
-
* Optional fields that are not set will be set to undefined.
|
|
200
|
-
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
|
|
201
|
-
* For the list of reserved names please see:
|
|
202
|
-
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
|
|
203
|
-
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
|
|
204
|
-
* JSPB instance for transitional soy proto support:
|
|
205
|
-
* http://goto/soy-param-migration
|
|
206
|
-
* @return {!Object}
|
|
207
|
-
*/
|
|
208
|
-
proto.JSONResponse.prototype.toObject = function(opt_includeInstance) {
|
|
209
|
-
return proto.JSONResponse.toObject(opt_includeInstance, this);
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Static version of the {@see toObject} method.
|
|
215
|
-
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
|
|
216
|
-
* the JSPB instance for transitional soy proto support:
|
|
217
|
-
* http://goto/soy-param-migration
|
|
218
|
-
* @param {!proto.JSONResponse} msg The msg instance to transform.
|
|
219
|
-
* @return {!Object}
|
|
220
|
-
* @suppress {unusedLocalVariables} f is only used for nested messages
|
|
221
|
-
*/
|
|
222
|
-
proto.JSONResponse.toObject = function(includeInstance, msg) {
|
|
223
|
-
var f, obj = {
|
|
224
|
-
response: jspb.Message.getFieldWithDefault(msg, 1, "")
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
if (includeInstance) {
|
|
228
|
-
obj.$jspbMessageInstance = msg;
|
|
229
|
-
}
|
|
230
|
-
return obj;
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Deserializes binary data (in protobuf wire format).
|
|
237
|
-
* @param {jspb.ByteSource} bytes The bytes to deserialize.
|
|
238
|
-
* @return {!proto.JSONResponse}
|
|
239
|
-
*/
|
|
240
|
-
proto.JSONResponse.deserializeBinary = function(bytes) {
|
|
241
|
-
var reader = new jspb.BinaryReader(bytes);
|
|
242
|
-
var msg = new proto.JSONResponse;
|
|
243
|
-
return proto.JSONResponse.deserializeBinaryFromReader(msg, reader);
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Deserializes binary data (in protobuf wire format) from the
|
|
249
|
-
* given reader into the given message object.
|
|
250
|
-
* @param {!proto.JSONResponse} msg The message object to deserialize into.
|
|
251
|
-
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
|
|
252
|
-
* @return {!proto.JSONResponse}
|
|
253
|
-
*/
|
|
254
|
-
proto.JSONResponse.deserializeBinaryFromReader = function(msg, reader) {
|
|
255
|
-
while (reader.nextField()) {
|
|
256
|
-
if (reader.isEndGroup()) {
|
|
257
|
-
break;
|
|
258
|
-
}
|
|
259
|
-
var field = reader.getFieldNumber();
|
|
260
|
-
switch (field) {
|
|
261
|
-
case 1:
|
|
262
|
-
var value = /** @type {string} */ (reader.readString());
|
|
263
|
-
msg.setResponse(value);
|
|
264
|
-
break;
|
|
265
|
-
default:
|
|
266
|
-
reader.skipField();
|
|
267
|
-
break;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
return msg;
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* Serializes the message to binary data (in protobuf wire format).
|
|
276
|
-
* @return {!Uint8Array}
|
|
277
|
-
*/
|
|
278
|
-
proto.JSONResponse.prototype.serializeBinary = function() {
|
|
279
|
-
var writer = new jspb.BinaryWriter();
|
|
280
|
-
proto.JSONResponse.serializeBinaryToWriter(this, writer);
|
|
281
|
-
return writer.getResultBuffer();
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Serializes the given message to binary data (in protobuf wire
|
|
287
|
-
* format), writing to the given BinaryWriter.
|
|
288
|
-
* @param {!proto.JSONResponse} message
|
|
289
|
-
* @param {!jspb.BinaryWriter} writer
|
|
290
|
-
* @suppress {unusedLocalVariables} f is only used for nested messages
|
|
291
|
-
*/
|
|
292
|
-
proto.JSONResponse.serializeBinaryToWriter = function(message, writer) {
|
|
293
|
-
var f = undefined;
|
|
294
|
-
f = message.getResponse();
|
|
295
|
-
if (f.length > 0) {
|
|
296
|
-
writer.writeString(
|
|
297
|
-
1,
|
|
298
|
-
f
|
|
299
|
-
);
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* optional string response = 1;
|
|
306
|
-
* @return {string}
|
|
307
|
-
*/
|
|
308
|
-
proto.JSONResponse.prototype.getResponse = function() {
|
|
309
|
-
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* @param {string} value
|
|
315
|
-
* @return {!proto.JSONResponse} returns this
|
|
316
|
-
*/
|
|
317
|
-
proto.JSONResponse.prototype.setResponse = function(value) {
|
|
318
|
-
return jspb.Message.setProto3StringField(this, 1, value);
|
|
319
|
-
};
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
goog.object.extend(exports, proto);
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// 注意: 在TypeScript中并不需要导入JsonNode对象,因为JSON对象直接可以进行解析
|
|
3
|
-
// 直接使用JSON.parse()来解析JSON字符串即可。
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.ParseBoardUtils = void 0;
|
|
6
|
-
const Board_1 = require("../models/Board");
|
|
7
|
-
const Device_1 = require("../models/Device");
|
|
8
|
-
const Register_1 = require("../models/Register");
|
|
9
|
-
const Cpu_1 = require("../models/Cpu");
|
|
10
|
-
const DeviceState_1 = require("../models/DeviceState");
|
|
11
|
-
class ParseBoardUtils {
|
|
12
|
-
static parseBoard(boardItems) {
|
|
13
|
-
const boardMap = new Map();
|
|
14
|
-
if (boardItems != null && typeof boardItems === 'object') {
|
|
15
|
-
for (const boardName in boardItems) {
|
|
16
|
-
if (Object.prototype.hasOwnProperty.call(boardItems, boardName)) {
|
|
17
|
-
const board = new Board_1.Board();
|
|
18
|
-
board.name = boardName;
|
|
19
|
-
const devices = boardItems[boardName];
|
|
20
|
-
const deviceMap = ParseBoardUtils.parseDevice(devices, board);
|
|
21
|
-
board.deviceMap = deviceMap;
|
|
22
|
-
boardMap.set(board.name, board);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return boardMap;
|
|
27
|
-
}
|
|
28
|
-
static parseDevice(devices, board) {
|
|
29
|
-
const deviceMap = new Map();
|
|
30
|
-
if (devices != null && typeof devices === 'object') {
|
|
31
|
-
for (const deviceName in devices) {
|
|
32
|
-
if (Object.prototype.hasOwnProperty.call(devices, deviceName)) {
|
|
33
|
-
const device = devices[deviceName];
|
|
34
|
-
if (device != null && typeof device === 'object') {
|
|
35
|
-
let dev;
|
|
36
|
-
if (device.type === 'device') {
|
|
37
|
-
dev = new Device_1.Device(null);
|
|
38
|
-
}
|
|
39
|
-
else if (device.type === 'cpu') {
|
|
40
|
-
dev = new Cpu_1.Cpu(null);
|
|
41
|
-
}
|
|
42
|
-
if (dev) {
|
|
43
|
-
dev.parent = board;
|
|
44
|
-
dev.name = deviceName;
|
|
45
|
-
for (const itemKey in device) {
|
|
46
|
-
if (Object.prototype.hasOwnProperty.call(device, itemKey)) {
|
|
47
|
-
const itemValue = device[itemKey];
|
|
48
|
-
switch (itemKey) {
|
|
49
|
-
case 'registers':
|
|
50
|
-
const registerItems = itemValue;
|
|
51
|
-
const registerMap = ParseBoardUtils.parseRegister(registerItems, dev);
|
|
52
|
-
dev.registerMap = registerMap;
|
|
53
|
-
break;
|
|
54
|
-
case 'state':
|
|
55
|
-
dev.state = itemValue === 0 ? DeviceState_1.DeviceState.DISABLE : DeviceState_1.DeviceState.ENABLE;
|
|
56
|
-
break;
|
|
57
|
-
case 'classname':
|
|
58
|
-
dev.className = itemValue;
|
|
59
|
-
break;
|
|
60
|
-
case 'baseaddr':
|
|
61
|
-
dev.baseAddr = itemValue;
|
|
62
|
-
break;
|
|
63
|
-
case 'length':
|
|
64
|
-
dev.length = itemValue;
|
|
65
|
-
break;
|
|
66
|
-
// Other cases for additional properties if needed
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
deviceMap.set(dev.name, dev);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return deviceMap;
|
|
77
|
-
}
|
|
78
|
-
static parseRegister(registerItems, device) {
|
|
79
|
-
const registerMap = new Map();
|
|
80
|
-
if (registerItems != null && typeof registerItems === 'object') {
|
|
81
|
-
for (const regKey in registerItems) {
|
|
82
|
-
if (Object.prototype.hasOwnProperty.call(registerItems, regKey)) {
|
|
83
|
-
const register = registerItems[regKey];
|
|
84
|
-
if (register != null && typeof register === 'object') {
|
|
85
|
-
const reg = new Register_1.Register(null);
|
|
86
|
-
reg.parent = device;
|
|
87
|
-
reg.name = regKey;
|
|
88
|
-
if ('bits' in register) {
|
|
89
|
-
reg.bits = register.bits;
|
|
90
|
-
}
|
|
91
|
-
if ('value' in register) {
|
|
92
|
-
reg.value = register.value;
|
|
93
|
-
}
|
|
94
|
-
if ('addr' in register) {
|
|
95
|
-
reg.baseAddr = register.addr;
|
|
96
|
-
}
|
|
97
|
-
if ('offset' in register) {
|
|
98
|
-
reg.offset = register.offset;
|
|
99
|
-
}
|
|
100
|
-
registerMap.set(reg.name, reg);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return registerMap;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
exports.ParseBoardUtils = ParseBoardUtils;
|