fix: 修复示波器修改后无法配置的问题;修复无法生成api的问题;feat: 新增全局控制七段数码管

This commit is contained in:
2025-08-22 02:17:30 +08:00
parent 8fbd30e69f
commit 7d3ef598de
13 changed files with 204 additions and 58 deletions

View File

@@ -0,0 +1,8 @@
/* THIS (.ts) FILE IS GENERATED BY Tapper */
/* eslint-disable */
/* tslint:disable */
/** Transpiled from Database.ResourceTypes */
export type ResourceTypes = {
}

View File

@@ -0,0 +1,14 @@
/* THIS (.ts) FILE IS GENERATED BY Tapper */
/* eslint-disable */
/* tslint:disable */
/** Transpiled from Peripherals.WS2812Client.RGBColor */
export type RGBColor = {
/** Transpiled from byte */
red: number;
/** Transpiled from byte */
green: number;
/** Transpiled from byte */
blue: number;
}

View File

@@ -3,9 +3,10 @@
/* tslint:disable */
// @ts-nocheck
import type { HubConnection, IStreamResult, Subject } from '@microsoft/signalr';
import type { IDigitalTubesHub, IJtagHub, IOscilloscopeHub, IProgressHub, IRotaryEncoderHub, IDigitalTubesReceiver, IJtagReceiver, IOscilloscopeReceiver, IProgressReceiver, IRotaryEncoderReceiver } from './server.Hubs';
import type { IDigitalTubesHub, IJtagHub, IOscilloscopeHub, IProgressHub, IRotaryEncoderHub, IWS2812Hub, IDigitalTubesReceiver, IJtagReceiver, IOscilloscopeReceiver, IProgressReceiver, IRotaryEncoderReceiver, IWS2812Receiver } from './server.Hubs';
import type { DigitalTubeTaskStatus, OscilloscopeFullConfig, OscilloscopeDataResponse, ProgressInfo } from '../server.Hubs';
import type { RotaryEncoderDirection } from '../Peripherals.RotaryEncoderClient';
import type { RGBColor } from '../Peripherals.WS2812Client';
// components
@@ -49,6 +50,7 @@ export type HubProxyFactoryProvider = {
(hubType: "IOscilloscopeHub"): HubProxyFactory<IOscilloscopeHub>;
(hubType: "IProgressHub"): HubProxyFactory<IProgressHub>;
(hubType: "IRotaryEncoderHub"): HubProxyFactory<IRotaryEncoderHub>;
(hubType: "IWS2812Hub"): HubProxyFactory<IWS2812Hub>;
}
export const getHubProxyFactory = ((hubType: string) => {
@@ -67,6 +69,9 @@ export const getHubProxyFactory = ((hubType: string) => {
if(hubType === "IRotaryEncoderHub") {
return IRotaryEncoderHub_HubProxyFactory.Instance;
}
if(hubType === "IWS2812Hub") {
return IWS2812Hub_HubProxyFactory.Instance;
}
}) as HubProxyFactoryProvider;
export type ReceiverRegisterProvider = {
@@ -75,6 +80,7 @@ export type ReceiverRegisterProvider = {
(receiverType: "IOscilloscopeReceiver"): ReceiverRegister<IOscilloscopeReceiver>;
(receiverType: "IProgressReceiver"): ReceiverRegister<IProgressReceiver>;
(receiverType: "IRotaryEncoderReceiver"): ReceiverRegister<IRotaryEncoderReceiver>;
(receiverType: "IWS2812Receiver"): ReceiverRegister<IWS2812Receiver>;
}
export const getReceiverRegister = ((receiverType: string) => {
@@ -93,6 +99,9 @@ export const getReceiverRegister = ((receiverType: string) => {
if(receiverType === "IRotaryEncoderReceiver") {
return IRotaryEncoderReceiver_Binder.Instance;
}
if(receiverType === "IWS2812Receiver") {
return IWS2812Receiver_Binder.Instance;
}
}) as ReceiverRegisterProvider;
// HubProxy
@@ -270,6 +279,31 @@ class IRotaryEncoderHub_HubProxy implements IRotaryEncoderHub {
}
}
class IWS2812Hub_HubProxyFactory implements HubProxyFactory<IWS2812Hub> {
public static Instance = new IWS2812Hub_HubProxyFactory();
private constructor() {
}
public readonly createHubProxy = (connection: HubConnection): IWS2812Hub => {
return new IWS2812Hub_HubProxy(connection);
}
}
class IWS2812Hub_HubProxy implements IWS2812Hub {
public constructor(private connection: HubConnection) {
}
public readonly getAllLedColors = async (): Promise<RGBColor[]> => {
return await this.connection.invoke("GetAllLedColors");
}
public readonly getLedColor = async (ledIndex: number): Promise<RGBColor> => {
return await this.connection.invoke("GetLedColor", ledIndex);
}
}
// Receiver
@@ -378,3 +412,24 @@ class IRotaryEncoderReceiver_Binder implements ReceiverRegister<IRotaryEncoderRe
}
}
class IWS2812Receiver_Binder implements ReceiverRegister<IWS2812Receiver> {
public static Instance = new IWS2812Receiver_Binder();
private constructor() {
}
public readonly register = (connection: HubConnection, receiver: IWS2812Receiver): Disposable => {
const __onReceive = (...args: [RGBColor[]]) => receiver.onReceive(...args);
connection.on("OnReceive", __onReceive);
const methodList: ReceiverMethod[] = [
{ methodName: "OnReceive", method: __onReceive }
]
return new ReceiverMethodSubscription(connection, methodList);
}
}

View File

@@ -5,6 +5,7 @@
import type { IStreamResult, Subject } from '@microsoft/signalr';
import type { DigitalTubeTaskStatus, OscilloscopeFullConfig, OscilloscopeDataResponse, ProgressInfo } from '../server.Hubs';
import type { RotaryEncoderDirection } from '../Peripherals.RotaryEncoderClient';
import type { RGBColor } from '../Peripherals.WS2812Client';
export type IDigitalTubesHub = {
/**
@@ -126,6 +127,18 @@ export type IRotaryEncoderHub = {
disableCycleRotateEncoder(): Promise<boolean>;
}
export type IWS2812Hub = {
/**
* @returns Transpiled from System.Threading.Tasks.Task<Peripherals.WS2812Client.RGBColor[]?>
*/
getAllLedColors(): Promise<RGBColor[]>;
/**
* @param ledIndex Transpiled from int
* @returns Transpiled from System.Threading.Tasks.Task<Peripherals.WS2812Client.RGBColor?>
*/
getLedColor(ledIndex: number): Promise<RGBColor>;
}
export type IDigitalTubesReceiver = {
/**
* @param data Transpiled from byte[]
@@ -167,3 +180,11 @@ export type IRotaryEncoderReceiver = {
onReceiveRotate(num: number, direction: RotaryEncoderDirection): Promise<void>;
}
export type IWS2812Receiver = {
/**
* @param data Transpiled from Peripherals.WS2812Client.RGBColor[]
* @returns Transpiled from System.Threading.Tasks.Task
*/
onReceive(data: RGBColor[]): Promise<void>;
}

View File

@@ -60,3 +60,9 @@ export type ProgressInfo = {
errorMessage: string;
}
/** Transpiled from server.Hubs.WS2812TaskStatus */
export type WS2812TaskStatus = {
/** Transpiled from bool */
isRunning: boolean;
}