feat: 使用SignalR实时发送示波器数据,并美化示波器界面

This commit is contained in:
2025-08-19 12:55:18 +08:00
parent 1b5b0e28e3
commit 7e53b805ae
13 changed files with 1664 additions and 347 deletions

View File

@@ -299,7 +299,7 @@ export class VideoStreamClient {
return Promise.resolve<boolean>(null as any);
}
setVideoStreamEnable(enable: boolean | undefined, cancelToken?: CancelToken): Promise<any> {
setVideoStreamEnable(enable: boolean | undefined, cancelToken?: CancelToken): Promise<string> {
let url_ = this.baseUrl + "/api/VideoStream/SetVideoStreamEnable?";
if (enable === null)
throw new Error("The parameter 'enable' cannot be null.");
@@ -327,7 +327,7 @@ export class VideoStreamClient {
});
}
protected processSetVideoStreamEnable(response: AxiosResponse): Promise<any> {
protected processSetVideoStreamEnable(response: AxiosResponse): Promise<string> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
@@ -343,7 +343,7 @@ export class VideoStreamClient {
let resultData200 = _responseText;
result200 = resultData200 !== undefined ? resultData200 : <any>null;
return Promise.resolve<any>(result200);
return Promise.resolve<string>(result200);
} else if (status === 500) {
const _responseText = response.data;
@@ -357,7 +357,7 @@ export class VideoStreamClient {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<any>(null as any);
return Promise.resolve<string>(null as any);
}
/**
@@ -5569,7 +5569,7 @@ export class OscilloscopeApiClient {
* @param config 示波器配置
* @return 操作结果
*/
initialize(config: OscilloscopeFullConfig, cancelToken?: CancelToken): Promise<boolean> {
initialize(config: OscilloscopeConfig, cancelToken?: CancelToken): Promise<boolean> {
let url_ = this.baseUrl + "/api/OscilloscopeApi/Initialize";
url_ = url_.replace(/[?&]$/, "");
@@ -9090,22 +9090,14 @@ export interface INetworkInterfaceDto {
macAddress: string;
}
/** 示波器完整配置 */
export class OscilloscopeFullConfig implements IOscilloscopeFullConfig {
/** 是否启动捕获 */
export class OscilloscopeConfig implements IOscilloscopeConfig {
captureEnabled!: boolean;
/** 触发电平0-255 */
triggerLevel!: number;
/** 触发边沿true为上升沿false为下降沿 */
triggerRisingEdge!: boolean;
/** 水平偏移量0-1023 */
horizontalShift!: number;
/** 抽样率0-1023 */
decimationRate!: number;
/** 是否自动刷新RAM */
autoRefreshRAM!: boolean;
constructor(data?: IOscilloscopeFullConfig) {
constructor(data?: IOscilloscopeConfig) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
@@ -9121,13 +9113,12 @@ export class OscilloscopeFullConfig implements IOscilloscopeFullConfig {
this.triggerRisingEdge = _data["triggerRisingEdge"];
this.horizontalShift = _data["horizontalShift"];
this.decimationRate = _data["decimationRate"];
this.autoRefreshRAM = _data["autoRefreshRAM"];
}
}
static fromJS(data: any): OscilloscopeFullConfig {
static fromJS(data: any): OscilloscopeConfig {
data = typeof data === 'object' ? data : {};
let result = new OscilloscopeFullConfig();
let result = new OscilloscopeConfig();
result.init(data);
return result;
}
@@ -9139,38 +9130,23 @@ export class OscilloscopeFullConfig implements IOscilloscopeFullConfig {
data["triggerRisingEdge"] = this.triggerRisingEdge;
data["horizontalShift"] = this.horizontalShift;
data["decimationRate"] = this.decimationRate;
data["autoRefreshRAM"] = this.autoRefreshRAM;
return data;
}
}
/** 示波器完整配置 */
export interface IOscilloscopeFullConfig {
/** 是否启动捕获 */
export interface IOscilloscopeConfig {
captureEnabled: boolean;
/** 触发电平0-255 */
triggerLevel: number;
/** 触发边沿true为上升沿false为下降沿 */
triggerRisingEdge: boolean;
/** 水平偏移量0-1023 */
horizontalShift: number;
/** 抽样率0-1023 */
decimationRate: number;
/** 是否自动刷新RAM */
autoRefreshRAM: boolean;
}
/** 示波器状态和数据 */
export class OscilloscopeDataResponse implements IOscilloscopeDataResponse {
/** AD采样频率 */
adFrequency!: number;
/** AD采样幅度 */
adVpp!: number;
/** AD采样最大值 */
adMax!: number;
/** AD采样最小值 */
adMin!: number;
/** 波形数据Base64编码 */
waveformData!: string;
constructor(data?: IOscilloscopeDataResponse) {
@@ -9210,17 +9186,11 @@ export class OscilloscopeDataResponse implements IOscilloscopeDataResponse {
}
}
/** 示波器状态和数据 */
export interface IOscilloscopeDataResponse {
/** AD采样频率 */
adFrequency: number;
/** AD采样幅度 */
adVpp: number;
/** AD采样最大值 */
adMax: number;
/** AD采样最小值 */
adMin: number;
/** 波形数据Base64编码 */
waveformData: string;
}