UNPKG

@p2olab/pimad-core

Version:

PiMAd (Process-industry-Modular-Automation-description) High level access to automation of modular plants.

170 lines (165 loc) 7.84 kB
import { DataItemModel } from './DataItemModel'; import { Backbone } from '../Backbone'; import PiMAdResponseVendor = Backbone.PiMAdResponseVendor; import PiMAdResponse = Backbone.PiMAdResponse; import PiMAdResponseHandler = Backbone.PiMAdResponseHandler; declare abstract class ADataAssembly implements ModuleAutomation.DataAssembly { protected dataItems: DataItemModel[]; protected description: string; protected dataSourceIdentifier: string; protected name: string; protected initialized: boolean; protected metaModelRef: string; protected pimadIdentifier: string; protected responseVendor: PiMAdResponseVendor; protected responseHandler: PiMAdResponseHandler; constructor(); getAllDataItems(callback: GetAllDataItems): void; getDataSourceIdentifier(callback: (response: PiMAdResponse, identifier: string) => void): void; getDataItem(name: string, callback: (response: PiMAdResponse, dataItems: DataItemModel) => void): void; getInterfaceClass(callback: (response: PiMAdResponse, interfaceClass: string) => void): void; getHumanReadableDescription(callback: (response: PiMAdResponse, tagDescription: string) => void): void; getName(callback: (response: PiMAdResponse, name: string) => void): void; getMetaModelRef(callback: (response: PiMAdResponse, metaModelRef: string) => void): void; getPiMAdIdentifier(callback: (response: PiMAdResponse, identifier: string) => void): void; abstract initialize(instructions: object): boolean; } export declare class BasicDataAssembly extends ADataAssembly { initialize(instructions: { tag: string; dataSourceIdentifier: string; description: string; dataItems: DataItemModel[]; metaModelRef: string; pimadIdentifier: string; }): boolean; } export declare namespace ModuleAutomation { /** * Ein DataAssembly ist eine funktionale Einheit innerhalb von PEAs. Sie ermöglichen das Steuern, Regeln und * Überwachen von Prozessen. * <uml> abstract class ADataAssemblyFactory abstract class ADataAssembly { #dataItems: DataItemModel[] #description: string #name: string #initialized: boolean = false #pimadIdentifier: string #metaModelRef: string #responseVendor: ResponseVendor #responseHandler: PiMAdResponseHandler } class BasicDataAssemblyFactory class BasicDataAssembly { +initialize(instructions: {tag: string; description: string; dataItems: DataItemModel[]; identifier: string; metaModelRef: string}): boolean } class DataAssemblyVendor { +buy(type: DataAssemblyType): DataAssembly } enum DataAssemblyType { BASIC = 0 } interface DataAssemblyFactory interface DataAssembly { +getAllDataItems(callback: (response: PiMAdResponse, dataItems: DataItemModel[]) => void): void +getDataItem(name: string,callback: (response: PiMAdResponse, dataItems: DataItemModel) => void): void +getDataSourceIdentifier(callback: (response: PiMAdResponse, identifier: string) => void): void +getInterfaceClass(callback: (response: PiMAdResponse, interfaceClass: string) => void): void +getHumanReadableDescription(callback: (response: PiMAdResponse, tagDescription: string) => void): void +getName(callback: (response: PiMAdResponse, name: string) => void): void +getPiMAdIdentifier(callback: (response: PiMAdResponse, identifier: string) => void): void +getMetaModelRef(callback: (response: PiMAdResponse, metaModelRef: string) => void): void +initialize(instructions: object): boolean } DataAssembly <|.. ADataAssembly DataAssemblyFactory <|.. ADataAssemblyFactory ADataAssembly <|-- BasicDataAssembly ADataAssemblyFactory <|-- BasicDataAssemblyFactory DataAssembly <-- DataAssemblyFactory DataAssemblyVendor "1" o-- "1..*" DataAssemblyFactory </uml> */ interface DataAssembly { /** * Getter for this.dataItems. Returns all {@link DataItemModel}s aggregated in this instance. * @param callback - Accessing the {@link DataItemModel}s-Array via callback function. */ getAllDataItems(callback: (response: PiMAdResponse, dataItems: DataItemModel[]) => void): void; /** * Get a single {@link DataItemModel} via it's name. * @param name - The name of the {@link DataItemModel} * @param callback - Accessing the matching {@link DataItemModel} via callback function. */ getDataItem(name: string, callback: (response: PiMAdResponse, dataItems: DataItemModel) => void): void; /** * Getter for this.dataSourceIdentifier. This variable contains the identifier of the previous data source. It's * mostly for debugging purpose and an assembling reference while importing the data. * @param callback - Accessing the identifier via callback function. */ getDataSourceIdentifier(callback: (response: PiMAdResponse, identifier: string) => void): void; /** * Not implemented yet! * @param callback - Accessing the InterfaceClass via callback function. */ getInterfaceClass(callback: (response: PiMAdResponse, interfaceClass: string) => void): void; /** * Getter for this.description. Hopefully understandable for all human kind. * @param callback - Accessing the description via callback function. */ getHumanReadableDescription(callback: (response: PiMAdResponse, description: string) => void): void; /** * Getter for this.name. The name of this instance. * @param callback - Accessing the name via callback function. */ getName(callback: (response: PiMAdResponse, name: string) => void): void; /** * Getter for this.pimadIdentifier. A unique identifier in the PiMAd-core data model. Use this one while * interacting with PiMAd-objects. * @param callback - Accessing the identifier via callback function. */ getPiMAdIdentifier(callback: (response: PiMAdResponse, identifier: string) => void): void; /** * Getter for this.metaModelRef. It's a link to the meta model description of the instance. * @param callback - Accessing the meta model reference via callback function. */ getMetaModelRef(callback: (response: PiMAdResponse, metaModelRef: string) => void): void; /** * Initialize the new DataAssembly object. * @param instructions - A set with different kind of data. */ initialize(instructions: object): boolean; } /** * This enum referencing to all implementations of {@link DataAssembly}. */ enum DataAssemblyType { /** * Referencing a {@link BasicDataAssembly}. */ BASIC = 0 } /** * This vendor sells various {@link DataAssembly}-Instances. */ class DataAssemblyVendor { private basicDataAssemblyFactory; /** * This one initialize various {@link DataAssemblyFactory}. */ constructor(); /** * Buy an uninitialized {@link DataAssembly}. * @param type - The type of the {@link DataAssembly} as {@link DataAssemblyType}. */ buy(type: DataAssemblyType): DataAssembly; } } /** * Callback for {@link ModuleAutomation.DataAssembly.getAllDataItems}. * @param response - Indicates the status of the result. F.ex. a {@link SuccessResponse} for a successful ?. * @param dataItems - An Array with {@link DataItemModel}s. */ declare type GetAllDataItems = (response: PiMAdResponse, dataItems: DataItemModel[]) => void; export {};