feat: 前端七段数码管添加数字孪生功能
This commit is contained in:
@@ -229,6 +229,15 @@ export class AuthManager {
|
||||
.build();
|
||||
}
|
||||
|
||||
public static createAuthenticatedDigitalTubesHubConnection() {
|
||||
return new HubConnectionBuilder()
|
||||
.withUrl("http://127.0.0.1:5000/hubs/DigitalTubesHub", {
|
||||
accessTokenFactory: () => this.getToken() ?? "",
|
||||
})
|
||||
.withAutomaticReconnect()
|
||||
.build();
|
||||
}
|
||||
|
||||
// 登录函数
|
||||
public static async login(
|
||||
username: string,
|
||||
|
||||
@@ -59,3 +59,12 @@ export function formatDate(date: Date | string) {
|
||||
minute: "2-digit",
|
||||
});
|
||||
}
|
||||
|
||||
export function base64ToArrayBuffer(base64: string) {
|
||||
var binaryString = atob(base64);
|
||||
var bytes = new Uint8Array(binaryString.length);
|
||||
for (var i = 0; i < binaryString.length; i++) {
|
||||
bytes[i] = binaryString.charCodeAt(i);
|
||||
}
|
||||
return bytes.buffer;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// @ts-nocheck
|
||||
import type { HubConnection, IStreamResult, Subject } from '@microsoft/signalr';
|
||||
import type { IDigitalTubesHub, IJtagHub, IProgressHub, IDigitalTubesReceiver, IJtagReceiver, IProgressReceiver } from './server.Hubs';
|
||||
import type { ProgressInfo } from '../server.Hubs';
|
||||
import type { DigitalTubeTaskStatus, ProgressInfo } from '../server.Hubs';
|
||||
|
||||
|
||||
// components
|
||||
@@ -107,6 +107,10 @@ class IDigitalTubesHub_HubProxy implements IDigitalTubesHub {
|
||||
public readonly setFrequency = async (frequency: number): Promise<boolean> => {
|
||||
return await this.connection.invoke("SetFrequency", frequency);
|
||||
}
|
||||
|
||||
public readonly getStatus = async (): Promise<DigitalTubeTaskStatus> => {
|
||||
return await this.connection.invoke("GetStatus");
|
||||
}
|
||||
}
|
||||
|
||||
class IJtagHub_HubProxyFactory implements HubProxyFactory<IJtagHub> {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/* tslint:disable */
|
||||
// @ts-nocheck
|
||||
import type { IStreamResult, Subject } from '@microsoft/signalr';
|
||||
import type { ProgressInfo } from '../server.Hubs';
|
||||
import type { DigitalTubeTaskStatus, ProgressInfo } from '../server.Hubs';
|
||||
|
||||
export type IDigitalTubesHub = {
|
||||
/**
|
||||
@@ -19,6 +19,10 @@ export type IDigitalTubesHub = {
|
||||
* @returns Transpiled from System.Threading.Tasks.Task<bool>
|
||||
*/
|
||||
setFrequency(frequency: number): Promise<boolean>;
|
||||
/**
|
||||
* @returns Transpiled from System.Threading.Tasks.Task<server.Hubs.DigitalTubeTaskStatus>
|
||||
*/
|
||||
getStatus(): Promise<DigitalTubeTaskStatus>;
|
||||
}
|
||||
|
||||
export type IJtagHub = {
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
/* eslint-disable */
|
||||
/* tslint:disable */
|
||||
|
||||
/** Transpiled from server.Hubs.DigitalTubeTaskStatus */
|
||||
export type DigitalTubeTaskStatus = {
|
||||
/** Transpiled from int */
|
||||
frequency: number;
|
||||
/** Transpiled from bool */
|
||||
isRunning: boolean;
|
||||
}
|
||||
|
||||
/** Transpiled from server.Hubs.ProgressStatus */
|
||||
export enum ProgressStatus {
|
||||
Pending = 0,
|
||||
|
||||
Reference in New Issue
Block a user