Small cleanup
This commit is contained in:
@@ -11,17 +11,13 @@ export type Config = {
|
||||
}
|
||||
|
||||
export default class HTTPInterfaceServer extends AASInterfaceServer<Config> {
|
||||
protected name: string = "HTTPInterfaceServer";
|
||||
protected supportsSubscriptions: boolean = false; // TODO, longpolling?
|
||||
public readonly name: string = "HTTPInterfaceServer";
|
||||
public readonly supportsSubscriptions: boolean = false; // TODO, longpolling?
|
||||
|
||||
private app: Express = express();
|
||||
private server: any = null;
|
||||
private observers: any[] = [];
|
||||
|
||||
public constructor(config: Config, aas: types.Environment, onRequestCallback: OnRequestCallback) {
|
||||
super(config, aas, onRequestCallback);
|
||||
}
|
||||
|
||||
public prepare(): void {
|
||||
this.app.use(express.json());
|
||||
this.createRoutes();
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
import * as mqtt from "mqtt";
|
||||
import type { Property, Operation, OperationVariable, BasicEventElement } from "@aas-core-works/aas-core3.0-typescript/dist/types/types";
|
||||
import InterfaceConnectionObject from "interfaceConnectionObject";
|
||||
import type { types } from "@aas-core-works/aas-core3.0-typescript";
|
||||
|
||||
export default class MQTTConnector extends InterfaceConnectionObject<mqtt.IClientOptions> {
|
||||
public name: string = "MQTT Connector";
|
||||
public uriProtocol: string[] = ["mqtt", "mqtts"];
|
||||
public connectionType: "ON_DEMAND" | "PERMANENT" = "PERMANENT";
|
||||
public supportsSubscriptions: boolean = true;
|
||||
public readonly name: string = "MQTT Connector";
|
||||
public readonly uriProtocol: string[] = ["mqtt", "mqtts"];
|
||||
public readonly connectionType: "ON_DEMAND" | "PERMANENT" = "PERMANENT";
|
||||
public readonly supportsSubscriptions: boolean = true;
|
||||
|
||||
private client: mqtt.MqttClient|null = null;
|
||||
|
||||
private messageStore: Record<string, any> = {};
|
||||
private readonly messageStore: Record<string, any> = {};
|
||||
|
||||
public connect(): boolean {
|
||||
if (!this.client) this.client = mqtt.connect(this.endpointMetadata.base, this.connectionParameter);
|
||||
@@ -93,7 +92,7 @@ export default class MQTTConnector extends InterfaceConnectionObject<mqtt.IClien
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
|
||||
public subscribeEvent(event: types.BasicEventElement, callback: (event: BasicEventElement) => void): boolean {
|
||||
public subscribeEvent(event: types.BasicEventElement, callback: (event: types.BasicEventElement) => void): boolean {
|
||||
// TODO
|
||||
// Vorher mal ne ordentliche Mapping-Definition
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import type { types } from "@aas-core-works/aas-core3.0-typescript";
|
||||
import { AIMCMapper } from "parser/AIMCMapper";
|
||||
import AIMCMapper from "./parser/AIMCMapper";
|
||||
import { v4 } from "uuid";
|
||||
import type { EndpointMetadata } from "types/aidConf";
|
||||
import { Request } from "types/requests";
|
||||
|
||||
type ConnectionType = "ON_DEMAND" | "PERMANENT";
|
||||
|
||||
@@ -14,9 +13,9 @@ export default abstract class InterfaceConnectionObject<ConfigInterface> {
|
||||
public abstract readonly connectionType: ConnectionType;
|
||||
public abstract readonly supportsSubscriptions: boolean;
|
||||
|
||||
protected observerStore: Record<any, ((value: any) => void)[]> = {};
|
||||
protected eventSubStore: Record<any, ((value: any) => void)[]> = {};
|
||||
protected asyncActionStateStore: Record<any, {finished: boolean, result: any}> = {};
|
||||
protected readonly observerStore: Record<any, ((value: any) => void)[]> = {};
|
||||
protected readonly eventSubStore: Record<any, ((value: any) => void)[]> = {};
|
||||
protected readonly asyncActionStateStore: Record<any, {finished: boolean, result: any}> = {};
|
||||
|
||||
public constructor(
|
||||
protected readonly connectionParameter: ConfigInterface,
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import { types } from "@aas-core-works/aas-core3.0-typescript";
|
||||
import type AASInterfaceServer from "server";
|
||||
import type AASInterfaceServer from "./server";
|
||||
import type { Request } from "types/requests";
|
||||
import type InterfaceConnectionObject from "interfaceConnectionObject";
|
||||
import Traverser from "./helper/traverser";
|
||||
import { AIMCMapper } from "./parser/AIMCMapper";
|
||||
import { AssetInterfacesDescription } from "types/aidConf";
|
||||
import AIMCMapper from "./parser/AIMCMapper";
|
||||
import AIDParser from "./parser/AIDParser";
|
||||
|
||||
type AASRegistration = {
|
||||
|
||||
@@ -5,7 +5,7 @@ import Traverser from "helper/traverser";
|
||||
import AIDParser from "./AIDParser";
|
||||
import { SubmodelElementCollection } from "@aas-core-works/aas-core3.0-typescript/dist/types/types";
|
||||
|
||||
export class AIMCMapper {
|
||||
export default class AIMCMapper {
|
||||
|
||||
private map: AIMCMap = new Map();
|
||||
|
||||
|
||||
+6
-10
@@ -2,17 +2,13 @@ import { types } from "@aas-core-works/aas-core3.0-typescript";
|
||||
import type { Request, OnRequestCallback } from "types/requests";
|
||||
|
||||
export default abstract class AASInterfaceServer<ConfigInterface> {
|
||||
protected abstract readonly name: string;
|
||||
protected config: ConfigInterface;
|
||||
protected abstract readonly supportsSubscriptions: boolean;
|
||||
protected readonly aas: types.Environment;
|
||||
protected onRequestCallback: OnRequestCallback
|
||||
public abstract readonly name: string;
|
||||
public abstract readonly supportsSubscriptions: boolean;
|
||||
|
||||
constructor(config: ConfigInterface, aas: types.Environment, onRequestCallback: OnRequestCallback) {
|
||||
this.config = config;
|
||||
this.aas = aas;
|
||||
this.onRequestCallback = onRequestCallback;
|
||||
}
|
||||
constructor(
|
||||
protected readonly config: ConfigInterface,
|
||||
protected readonly aas: types.Environment,
|
||||
protected readonly onRequestCallback: OnRequestCallback) {}
|
||||
|
||||
public abstract prepare(): void;
|
||||
public abstract run(): void;
|
||||
|
||||
Reference in New Issue
Block a user