skyeye-sdk-js 1.4.13 → 1.4.15

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/test.js CHANGED
@@ -1,4 +1,8 @@
1
1
  "use strict";
2
+ // import { JSONResponse } from "./src/proto/skyeye_rpc_pb";
3
+ // import { GrpcUtil } from "./src/GrpcUtil";
4
+ // import { ServiceError } from "@grpc/grpc-js";
5
+ // import { Enum } from "protobufjs";
2
6
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
7
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
8
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -10,13 +14,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
14
  };
11
15
  Object.defineProperty(exports, "__esModule", { value: true });
12
16
  const { SkyEyeClientFactory } = require('./src/SkyEyeClientFactory');
13
- const { SkyEyeClient } = require('./src/SkyEyeClient');
14
- const { Cpu } = require('./src/models/Cpu');
15
- var RegisterType;
16
- (function (RegisterType) {
17
- RegisterType[RegisterType["CPU"] = 0] = "CPU";
18
- RegisterType[RegisterType["Device"] = 1] = "Device";
19
- })(RegisterType || (RegisterType = {}));
17
+ // const { SkyEyeClient } = require('./src/SkyEyeClient')
18
+ // const { Cpu } = require('./src/models/Cpu')
19
+ // enum RegisterType {
20
+ // CPU,
21
+ // Device
22
+ // }
23
+ // let call
20
24
  function test() {
21
25
  return __awaiter(this, void 0, void 0, function* () {
22
26
  // console.log("Connected to SkyEye server");
@@ -45,39 +49,56 @@ function test() {
45
49
  // console.log("response:", response)
46
50
  // console.log("response:", response.boardMap)
47
51
  // console.log("response:", response.boardMap.keys[0])
48
- // await client.initSkyEyeAndRun(pathSkyEye,fileName,port,skyeyeDir);
49
52
  // const pathSkyEye = "D:/data/case/FMQL45T900_SylixOS";
50
53
  // const fileName = "FMQL45T900_SylixOS.skyeye";
51
54
  // const skyeyeDir = "D:/install/SkyEye/opt/skyeye/bin/skyeye.exe"
52
55
  // const port = "50066"
53
- // const pathSkyEye = "G:/SkyEye/demo/c6713_demo";
54
- // const fileName = "G:/SkyEye/demo/c6713_demo/c6713_demo.skyeye";
55
- // const skyeyeDir = "G:/SkyEye/opt/skyeye/bin/skyeye.exe"
56
+ const pathSkyEye = "C:/Users/lingt/Downloads/SkyTest_Double_rm_28335";
57
+ const fileName = "C:/Users/lingt/Downloads/SkyTest_Double_rm_28335/SkyTest_Double.skyeye";
58
+ const skyeyeDir = "G:/SkyEye/opt/skyeye/bin/skyeye.exe";
56
59
  const port = "50051";
57
- const client = yield SkyEyeClientFactory.instance.createConnectedClient('127.0.0.1', port);
58
- yield client.registerTimeMonitor({
59
- time: 10,
60
- cpu_name: 'c67x_core_0',
61
- items: [
62
- {
63
- id: '1',
64
- cpu_name: 'c67x_core_0',
65
- var_name: 'int1',
66
- var_type: 'int',
67
- var_bytes: 4,
68
- type: 'global'
69
- }
70
- ]
71
- });
72
- yield client.startTimeMonitor();
73
- const response = yield client.getTimeMonitorConfig();
74
- console.log(response);
75
- yield client.stopTimeMonitor();
76
- // await client.stopTimeMonitor()
77
- const call = client.timeDataReceive('');
78
- call.on('data', (response) => {
60
+ // const client = await SkyEyeClientFactory.instance.createConnectedClient('127.0.0.1', port);
61
+ const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', port);
62
+ const t = yield client.initSkyEyeAndRun2(pathSkyEye, fileName, port, skyeyeDir);
63
+ yield client.runCommand();
64
+ setTimeout(() => __awaiter(this, void 0, void 0, function* () {
65
+ yield client.stopCommand();
66
+ let response = yield client.getGlobalVarValue("c67x_core_0", "li1", 8, "int");
67
+ console.log(response);
68
+ response = yield client.setGlobalVarValue("c67x_core_0", "li1", 8, "int", "1234567890123456789");
79
69
  console.log(response);
80
- });
70
+ response = yield client.getGlobalVarValue("c67x_core_0", "li1", 8, "int");
71
+ console.log(response);
72
+ }), 3000);
73
+ // await client.registerTimeMonitor({
74
+ // "id": "1",
75
+ // "time": 50,
76
+ // "cpu_name": "c67x_core_0",
77
+ // "direction":"recv",
78
+ // "cycle":-1,
79
+ // "items": [
80
+ // {
81
+ // "id": "cc5f450b-6fbb-7bb3-4544-e761a907b46d",
82
+ // "cpu_name": "c67x_core_0",
83
+ // "var_name": "int1",
84
+ // "var_type": "int",
85
+ // "var_bytes": 4,
86
+ // "type": "global",
87
+ // "value": "111"
88
+ // }
89
+ // ],
90
+ // })
91
+ // await client.startTimeMonitor("1")
92
+ // // await client.getTimeMonitorConfig()
93
+ // console.log('bbbbbbbbbbbb')
94
+ // call = client.timeDataReceive("1")
95
+ // call.on('data',(response)=> {
96
+ // const ackObj = response.getResponse();
97
+ // console.log(ackObj)
98
+ // })
99
+ // console.log('gggggggggggggg')
100
+ // console.log(call)
101
+ // await client.stopTimeMonitor()
81
102
  // response = client.setBitValue('c67x_core_0', '0x1000','1', 8)
82
103
  // console.log("response:", response)
83
104
  // const responseCpuList = await client.getCpuList()
@@ -89,3 +110,343 @@ function test() {
89
110
  });
90
111
  }
91
112
  test();
113
+ // const protobuf = require("protobufjs");
114
+ // const root = protobuf.loadSync("./src/proto/line_chart.proto");
115
+ // const Series = root.lookupType("Series");
116
+ // // const { UserData } = require('.src/proto/line_chart_pb'); // 预编译生成
117
+ // // const fs = require('fs');
118
+ // // JSON对象数据
119
+ // const jsonData = {
120
+ // series: [
121
+ // ],
122
+ // time: [
123
+ // ]
124
+ // };
125
+ // for (let i = 0; i < 50; i++) {
126
+ // jsonData.series.push({
127
+ // name: 'test' + i,
128
+ // value: []
129
+ // })
130
+ // }
131
+ // function getRandomDouble(min, max) {
132
+ // return Math.random() * (max - min) + min;
133
+ // }
134
+ // function getRandomInt(max) {
135
+ // return Math.floor(Math.random() * max);
136
+ // }
137
+ // jsonData.series.forEach((item, index) => {
138
+ // for (let i = 0; i < 300; i++) {
139
+ // item.value.push(getRandomDouble(0,10000))
140
+ // }
141
+ // })
142
+ // for (let i = 0; i < 300; i++) {
143
+ // jsonData.time.push({
144
+ // "realTime": getRandomDouble(0, 10000),
145
+ // "simulationTime": getRandomDouble(0, 10000),
146
+ // "customTime": getRandomDouble(0, 10000),
147
+ // })
148
+ // }
149
+ // console.log(jsonData.series.length)
150
+ // console.log(jsonData.series[0].value.length)
151
+ // // function getSerializedSize(obj) {
152
+ // // const jsonString = JSON.stringify(obj);
153
+ // // return Buffer.byteLength(jsonString, 'utf8'); // 精确计算 UTF-8 字节数
154
+ // // }
155
+ // // console.log(getSerializedSize(jsonData))
156
+ // // 序列化为Protobuf二进制Buffer
157
+ // // const d1 = new Date();
158
+ // // const protoBuffer = Series.encode(Series.create(jsonData)).finish();
159
+ // // const d2 = new Date();
160
+ // // console.log("序列化时间:", (d2.getTime() - d1.getTime()) / 1000);
161
+ // // const zlib = require("zlib");
162
+ // // // Gzip压缩(同步示例)
163
+ // // const compressedData = zlib.gzipSync(protoBuffer);
164
+ // // const d3 = new Date();
165
+ // // console.log("压缩时间:", (d3.getTime() - d2.getTime()) / 1000);
166
+ // // const fs = require("fs");
167
+ // // const outputStream = fs.createWriteStream('test.dat');
168
+ // // outputStream.write(compressedData);
169
+ // // const d4 = new Date();
170
+ // // console.log("存储时间:", (d4.getTime() - d3.getTime()) / 1000);
171
+ // // console.log("压缩数据已存储");
172
+ // // const zlib = require("zlib");
173
+ // // const fs = require("fs");
174
+ // // const { pipeline } = require('stream');
175
+ // // const path = require("path");
176
+ // // const d1 = new Date();
177
+ // // // 1. 创建转换流:JSON → Protobuf 二进制
178
+ // // const buffer = Series.encode(Series.create(jsonData)).finish();
179
+ // // console.log('压缩')
180
+ // // // 2. 创建压缩流(Brotli 高压缩率)
181
+ // // const compress = zlib.createGzip({ level: 9 })
182
+ // // const writeStream = fs.createWriteStream( "test.dat"); // 1MB 缓冲区
183
+ // // // 5. 管道连接:序列化数据 → 压缩 → 写入文件
184
+ // // const dataStream = require("stream").Readable.from(buffer); // 将 Buffer 转为可读流
185
+ // // dataStream
186
+ // // .pipe(compress) // 压缩数据
187
+ // // .pipe(writeStream) // 写入文件
188
+ // // .on("finish", () => {
189
+ // // const d2 = new Date();
190
+ // // console.log("序列化时间:", (d2.getTime() - d1.getTime()) / 1000);
191
+ // // console.log("数据已压缩存储成功")
192
+ // // })
193
+ // // .on("error", (err) => console.error("❌ 写入失败:", err));
194
+ // // const compressedInput = fs.readFileSync("user.dat");
195
+ // // const decompressedData = zlib.gunzipSync(compressedInput);
196
+ // // const decodedProto = Series.decode(decompressedData);
197
+ // // const originalJson = Series.toObject(decodedProto, { arrays: true }); // 保留数组类型
198
+ // // // console.log("还原的JSON:", originalJson);
199
+ // // console.log("还原的JSON:", originalJson.series[0].data[0]);
200
+ // const zlib = require("zlib");
201
+ // const fs = require("fs");
202
+ // class SplitFileWriter {
203
+ // constructor() {
204
+ // this.currentFile = null;
205
+ // this.currentSize = 0;
206
+ // this.fileIndex = 0;
207
+ // this.filename = `test_111.dat`;
208
+ // this.fd = null;
209
+ // this.createNewFile();
210
+ // }
211
+ // createNewFile() {
212
+ // if (this.currentFile) this.currentFile.end();
213
+ // this.currentFile = fs.createWriteStream(this.filename,{flags: 'a', start: 4 });
214
+ // this.currentSize = 0;
215
+ // }
216
+ // async writeHeader() {
217
+ // // 1. 读取并修改前4字节整数
218
+ // const readStream = fs.createReadStream(this.filename, { start: 0, end: 3 });
219
+ // let headerBuffer = Buffer.alloc(0);
220
+ // // 收集前4字节数据
221
+ // readStream.on('data', (chunk) => {
222
+ // headerBuffer = Buffer.concat([headerBuffer, chunk]);
223
+ // });
224
+ // // 等待头部读取完成
225
+ // await new Promise((resolve, reject) => {
226
+ // readStream.on('end', resolve);
227
+ // readStream.on('error', reject);
228
+ // });
229
+ // const newHeaderBuffer = Buffer.alloc(4);
230
+ // console.log(headerBuffer)
231
+ // if (headerBuffer.length < 4) {
232
+ // newHeaderBuffer.writeUInt32BE(0);
233
+ // } else {
234
+ // // 解析为整数并修改(小端序)
235
+ // const originalInt = headerBuffer.readUInt32BE();
236
+ // const modifiedInt = originalInt + 1;
237
+ // newHeaderBuffer.writeUInt32BE(modifiedInt);
238
+ // }
239
+ // console.log(newHeaderBuffer.readUint32BE());
240
+ // const compressedData = zlib.gzipSync(newHeaderBuffer)
241
+ // console.log(compressedData)
242
+ // // 2. 修改文件头部(覆盖写入前4字节)
243
+ // const writeHeaderStream = fs.createWriteStream(this.filename, { flags: 'r+', start: 0, end:3 });
244
+ // writeHeaderStream.write(newHeaderBuffer);
245
+ // await new Promise((resolve) => writeHeaderStream.end(resolve));
246
+ // }
247
+ // async write(chunk) {
248
+ // // 100MB限制(含压缩后数据)
249
+ // if (this.currentSize + chunk.length > 1000 * 1024 * 1024 ) {
250
+ // await this.createNewFile();
251
+ // }
252
+ // if(this.currentSize === 0) {
253
+ // await this.writeHeader()
254
+ // }
255
+ // this.currentFile.write(chunk, 'binary',async ()=>{
256
+ // const fd = this.currentFile.fd;
257
+ // fs.fsyncSync(fd);
258
+ // await this.writeHeader()
259
+ // date2 = new Date()
260
+ // console.log('存储时间:', (date2.getTime() - date1.getTime()) / 1000);
261
+ // });
262
+ // this.currentSize += chunk.length;
263
+ // }
264
+ // }
265
+ // // 3. 每30秒处理数据的管道
266
+ // const writer = new SplitFileWriter()
267
+ // function handleData(data) {
268
+ // let temp = {
269
+ // series: [],
270
+ // time: []}
271
+ // temp.series =data.series.map(series => {
272
+ // return {
273
+ // name: series.name,
274
+ // value: series.value.map(value => {
275
+ // return handleDataValue(value)
276
+ // })
277
+ // }
278
+ // })
279
+ // temp.time.map(time => {
280
+ // time.customTime = handleDataValue(time.customTime)
281
+ // time.realTime = handleDataValue(time.realTime)
282
+ // time.simulationTime = handleDataValue(time.simulationTime)
283
+ // })
284
+ // return temp
285
+ // }
286
+ // function handleDataValue(value) {
287
+ // if (typeof value === 'string') {
288
+ // return {
289
+ // type: 'str',
290
+ // stringValue: value
291
+ // }
292
+ // } else if (typeof value === 'number') {
293
+ // if (Number.isInteger(value)) {
294
+ // return {
295
+ // type: 'int',
296
+ // intValue: value
297
+ // }
298
+ // } else {
299
+ // return {
300
+ // type: 'dbl',
301
+ // doubleValue: value
302
+ // }
303
+ // }
304
+ // } else {
305
+ // return {
306
+ // type: 'str',
307
+ // stringValue: 'undefined'
308
+ // }
309
+ // }
310
+ // }
311
+ // // let date1 = new Date();
312
+ // // let date2 = new Date();
313
+ // // const handled = handleData(jsonData)
314
+ // // setInterval(async () => {
315
+ // // console.log('下一次循环')
316
+ // // date1 = new Date()
317
+ // // const chunk = Series.create(handled);
318
+ // // const serialized = Series.encode(chunk).finish();
319
+ // // // 4. 创建带长度头的消息(解决边界问题)
320
+ // // const header = Buffer.alloc(4);
321
+ // // header.writeUInt32BE(serialized.length);
322
+ // // const dataWithHeader = Buffer.concat([header, serialized]);
323
+ // // const compressedData = zlib.gzipSync(dataWithHeader);
324
+ // // await writer.write(compressedData)
325
+ // // }, 5000);
326
+ // function readAndProcessGzip(filePath) {
327
+ // try {
328
+ // // 1. 同步读取GZIP压缩文件
329
+ // let compressedData = fs.readFileSync(filePath);
330
+ // const header = Buffer.from(compressedData, 0, 4);
331
+ // compressedData = compressedData.subarray(4);
332
+ // const chunkSize = header.readUInt32BE();
333
+ // // 2. 同步解压GZIP数据
334
+ // let decompressedData = zlib.gunzipSync(compressedData);
335
+ // // console.log(decompressedData)
336
+ // // 3. 分块解析数据(假设格式为:[4字节长度头] + [序列化数据])
337
+ // let offset = 0;
338
+ // const chunks = [];
339
+ // console.log(decompressedData.length)
340
+ // console.log('chunkSize',chunkSize)
341
+ // while (offset < decompressedData.length) {
342
+ // // 3.1 检查长度头完整性(需4字节)
343
+ // if (offset + 4 > decompressedData.length) {
344
+ // throw new Error("Incomplete header at end of file");
345
+ // }
346
+ // // 3.2 读取消息长度(大端序)
347
+ // const msgLength = decompressedData.readUInt32BE(offset);
348
+ // offset += 4;
349
+ // // 3.3 检查消息体完整性
350
+ // // if (offset + msgLength > decompressedData.length) {
351
+ // // throw new Error(`Incomplete data: expected ${msgLength} bytes, got ${decompressedData.length - offset}`);
352
+ // // }
353
+ // // 3.4 提取单条消息的Buffer
354
+ // const msgBuffer = decompressedData.slice(offset, msgLength + offset);
355
+ // decompressedData = decompressedData.slice(msgLength + offset);
356
+ // offset= 0;
357
+ // chunks.push(msgBuffer);
358
+ // }
359
+ // return chunks; // 返回解析后的Buffer数组
360
+ // } catch (err) {
361
+ // console.error("Processing failed:", err);
362
+ // throw err; // 向上抛出异常
363
+ // }
364
+ // }
365
+ // // // 使用示例
366
+ // // const filePath = 'test_111.dat';
367
+ // // // const filePath = 'test_1755569497065_0.dat';
368
+ // // const date1 = new Date()
369
+ // // const parsedChunks = readAndProcessGzip(filePath);
370
+ // // const date2 = new Date()
371
+ // // console.log("读取时间:", (date2.getTime() - date1.getTime()) / 1000);
372
+ // // console.log(`Parsed ${parsedChunks.length} chunks`);
373
+ // // parsedChunks.forEach((buf, i) => {
374
+ // // // console.log(buf)
375
+ // // const decoded = Series.decode(buf);
376
+ // // console.log('读取数据长度:', decoded.series[0].value.length);
377
+ // // console.log('读取数据第一个数据:', decoded.series[0].value[0]);
378
+ // // console.log('读取数据:', decoded.time[0]);
379
+ // // });
380
+ // // console.log('处理时间:', (new Date().getTime() - date2.getTime()) / 1000);
381
+ // const filePath = 'G:\\testchunk\\双板测试通讯_线性图_Z2ooQ_20250827_150827.dat';
382
+ // const { pipeline } = require('stream');
383
+ // const readHeaderStream = fs.createReadStream(filePath,{start:0, end:3});
384
+ // let headerBuffer = Buffer.alloc(0);
385
+ // // 收集前4字节数据
386
+ // readHeaderStream.on('data', (chunk) => {
387
+ // headerBuffer = Buffer.concat([headerBuffer, chunk]);
388
+ // console.log('chunkkkkkkSize',headerBuffer.readUInt32BE())
389
+ // });
390
+ // // 等待头部读取完成
391
+ // const readStream = fs.createReadStream(filePath,{start:4});
392
+ // // 2. 创建解压流(Gunzip)
393
+ // const gunzipStream = zlib.createGunzip();
394
+ // // 3. 初始化数组存储解压后的数据块
395
+ // const decompressedData = Buffer.alloc(0)
396
+ // const chunks = [];
397
+ // // 4. 监听解压流的数据事件,收集数据块
398
+ // class ChunkProcessor extends Transform {
399
+ // constructor(decompressedData) {
400
+ // super();
401
+ // this.arr = decompressedData
402
+ // }
403
+ // _transform(chunk, encoding, callback) {
404
+ // // 将当前 chunk 加入阻塞队列
405
+ // // console.log(chunk.length)
406
+ // // console.log(this.arr)
407
+ // try {
408
+ // this.arr = Buffer.concat([this.arr, chunk]);
409
+ // let offset = 0;
410
+ // while (offset <= this.arr.length) {
411
+ // // 3.1 检查长度头完整性(需4字节)
412
+ // if (offset + 4 > this.arr.length) {
413
+ // break
414
+ // }
415
+ // // 3.2 读取消息长度(大端序)
416
+ // const msgLength = this.arr.readUInt32BE(offset);
417
+ // offset += 4;
418
+ // // console.log(msgLength)
419
+ // // 3.3 检查消息体完整性
420
+ // if (offset + msgLength > this.arr.length) {
421
+ // break;
422
+ // }
423
+ // // 3.4 提取单条消息的Buffer
424
+ // const msgBuffer = this.arr.slice(offset, msgLength + offset);
425
+ // this.arr = this.arr.slice(msgLength + offset);
426
+ // offset= 0;
427
+ // // console.log(msgBuffer.length)
428
+ // chunks.push(msgBuffer);
429
+ // }
430
+ // callback();
431
+ // } catch (err) {
432
+ // console.error("Pipeline error:", err);
433
+ // callback(err);
434
+ // }
435
+ // }
436
+ // }
437
+ // readStream.pipe(gunzipStream).pipe(new ChunkProcessor(decompressedData)).on('error', err => console.error('Pipeline error:', err)).on('finish', () => {
438
+ // console.log('读取chunk个:', chunks.length);
439
+ // let sum = 0
440
+ // chunks.forEach((buf, i) => {
441
+ // // console.log(buf)
442
+ // const decoded = Series.decode(buf);
443
+ // decoded.series.forEach((item, index) => {
444
+ // console.log(item.value[item.value.length - 1].intValue)
445
+ // })
446
+ // console.log('读取数据长度:', decoded.series[0].value.length);
447
+ // sum += decoded.series[0].value.length
448
+ // // console.log('读取数据第一个数据:', decoded.series[0].value[0]);
449
+ // // console.log('读取数据:', decoded.time[0]);
450
+ // });
451
+ // console.log('读取数据总长度:', sum);
452
+ // });
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "skyeye-sdk-js",
3
- "version": "1.4.13",
3
+ "version": "1.4.15",
4
4
  "description": "gRPC to SkyEye",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
8
  "test": "echo \"Error: no test specified\" && exit 1",
9
9
  "build": "tsc",
10
- "dev": "tsc & node dist/test.js",
10
+ "dev": "tsc & node --max-old-space-size=4096 dist/test.js",
11
11
  "release": "tsc && npm publish"
12
12
  },
13
13
  "keywords": [],
@@ -25,8 +25,10 @@
25
25
  "@grpc/grpc-js": "^1.10.4",
26
26
  "async": "^1.5.2",
27
27
  "google-protobuf": "^3.21.2",
28
+ "json-bigint": "^1.0.0",
28
29
  "lodash": "^4.6.1",
29
30
  "minimist": "^1.2.0",
30
- "protobufjs": "^7.2.6"
31
+ "protobufjs": "^7.2.6",
32
+ "split2": "^4.2.0"
31
33
  }
32
34
  }
@@ -421,15 +421,21 @@ export class RequestFactory {
421
421
  return request;
422
422
  }
423
423
 
424
- public startTimeMonitor() {
424
+ public startTimeMonitor(id?: string) {
425
425
  const baseRequest = new BaseRequest("SE_start_time_monitor");
426
+ const args: { [key: string]: string } = {};
427
+ args.id = id;
428
+ baseRequest.setArgs(args)
426
429
  const request = new JSONRequest()
427
430
  request.setRequest(baseRequest.toJSONString());
428
431
  return request;
429
432
  }
430
433
 
431
- public stopTimeMonitor() {
434
+ public stopTimeMonitor(id?: string) {
432
435
  const baseRequest = new BaseRequest("SE_stop_time_monitor");
436
+ const args: { [key: string]: string } = {};
437
+ args.id = id;
438
+ baseRequest.setArgs(args)
433
439
  const request = new JSONRequest()
434
440
  request.setRequest(baseRequest.toJSONString());
435
441
  return request;
@@ -445,8 +451,11 @@ export class RequestFactory {
445
451
  return request;
446
452
  }
447
453
 
448
- public getTimeMonitorConfig() {
454
+ public getTimeMonitorConfig(id?: string) {
449
455
  const baseRequest = new BaseRequest("SE_get_time_monitor_config");
456
+ const args: { [key: string]: string } = {};
457
+ args.id = id;
458
+ baseRequest.setArgs(args)
450
459
  const request = new JSONRequest()
451
460
  request.setRequest(baseRequest.toJSONString());
452
461
  return request;
@@ -28,6 +28,12 @@ import { Board } from './models/Board';
28
28
  import { BaseResponse } from './response/BaseResponse';
29
29
  import { GetAddressWidthResponse } from './response/GetAddressWidthResponse';
30
30
  import { GetFaultInjectListResponse2 } from './response/GetFaultInjectListResponse2';
31
+ const JSONbig = require('json-bigint')({
32
+ // 建议配置此项,将大数字存储为字符串,避免后续操作中的潜在问题
33
+ storeAsString: true
34
+ // 或者使用 'strict' 模式将其解析为 BigInt 类型 (ES2020)
35
+ // useNativeBigInt: true
36
+ });
31
37
  let client: JSONTransmissionClient | any = null;
32
38
 
33
39
 
@@ -95,10 +101,11 @@ export class SkyEyeClient extends JSONTransmissionClient {
95
101
  }
96
102
 
97
103
 
98
- public timeDataReceive(json: string) {
104
+ public timeDataReceive(id: string) {
99
105
  try {
100
106
  const request = new JSONRequest();
101
- request.setRequest(json);
107
+
108
+ request.setRequest(JSON.stringify({id: id}));
102
109
  const stream = super.timeDataReceive(request);
103
110
  return stream;
104
111
  } catch (error) {
@@ -121,7 +128,7 @@ export class SkyEyeClient extends JSONTransmissionClient {
121
128
  });
122
129
  // const res = JSON.parse(response.toString());
123
130
  // console.log("res:",res)
124
- const ackObj = JSON.parse(response.toString()).ack;
131
+ const ackObj = JSONbig.parse(response.toString()).ack;
125
132
  // this.printResponseLog(ackObj)
126
133
  if (ackObj.result === 'false') ackObj.result = false
127
134
  return ackObj;
@@ -1239,18 +1246,18 @@ export class SkyEyeClient extends JSONTransmissionClient {
1239
1246
  });
1240
1247
  }
1241
1248
 
1242
- public async startTimeMonitor() {
1249
+ public async startTimeMonitor(id?:string) {
1243
1250
  try {
1244
- return await this.call(RequestFactory.getInstance().startTimeMonitor());
1251
+ return await this.call(RequestFactory.getInstance().startTimeMonitor(id));
1245
1252
  } catch (error) {
1246
1253
  console.error("Error during stopCommand:", error);
1247
1254
  throw error;
1248
1255
  }
1249
1256
  }
1250
1257
 
1251
- public async stopTimeMonitor() {
1258
+ public async stopTimeMonitor(id?:string) {
1252
1259
  try {
1253
- return await this.call(RequestFactory.getInstance().stopTimeMonitor());
1260
+ return await this.call(RequestFactory.getInstance().stopTimeMonitor(id));
1254
1261
  } catch (error) {
1255
1262
  console.error("Error during stopCommand:", error);
1256
1263
  throw error;
@@ -1266,9 +1273,9 @@ export class SkyEyeClient extends JSONTransmissionClient {
1266
1273
  }
1267
1274
  }
1268
1275
 
1269
- public async getTimeMonitorConfig() {
1276
+ public async getTimeMonitorConfig(id?:string) {
1270
1277
  try {
1271
- return await this.call(RequestFactory.getInstance().getTimeMonitorConfig());
1278
+ return await this.call(RequestFactory.getInstance().getTimeMonitorConfig(id));
1272
1279
  } catch (error) {
1273
1280
  console.error("Error during stopCommand:", error);
1274
1281
  throw error;
@@ -0,0 +1,25 @@
1
+ syntax = "proto3";
2
+
3
+ message Value {
4
+ string type = 1;
5
+ double doubleValue = 2;
6
+ int64 intValue = 3;
7
+ string stringValue = 4;
8
+ }
9
+
10
+ message TimeData {
11
+ Value realTime = 1;
12
+ Value simulationTime = 2;
13
+ Value customTime = 3;
14
+ }
15
+
16
+ message SeriesData {
17
+ string id = 1;
18
+ string name = 2;
19
+ repeated Value value = 3;
20
+ }
21
+
22
+ message Series {
23
+ repeated SeriesData series = 1;
24
+ repeated TimeData time = 2;
25
+ }
@@ -0,0 +1 @@
1
+ // GENERATED CODE -- NO SERVICES IN PROTO