@p2olab/pimad-core
Version:
PiMAd (Process-industry-Modular-Automation-description) High level access to automation of modular plants.
137 lines (134 loc) • 5.12 kB
TypeScript
import { NodeId } from './NodeId';
import { Backbone } from '../Backbone';
import { AModuleAutomationObject, ModuleAutomationObject } from './ModuleAutomationObject';
/**
* This interface generalises the interaction with interface descriptions of communication systems. It's only data.
* There are no client functionality, etc.
*/
export interface CommunicationInterfaceData extends ModuleAutomationObject {
initialize(instructions: InitializeCommunicationInterfaceData | undefined): boolean;
}
export declare type InitializeCommunicationInterfaceData = {
dataSourceIdentifier: string;
interfaceDescription: InterfaceDescription;
metaModelRef: string;
pimadIdentifier: string;
name: string;
};
/**
* Generalisation of interface data. This is based on the approach that the addresses of the interfaces resemble a
* postal address. So street and house number are similar to IP and port.
*/
export declare type InterfaceDescription = {
/**
* Macro identifier: F.ex. IP or namespace.
*/
macrocosm: string;
/**
* micro identifier: F.ex. port
*/
microcosm: string;
};
/**
* Implements the {@link CommunicationInterfaceData}-Interface. Generalize variables, methods, etc. Reduce code
* duplication.
*/
declare abstract class ACommunicationInterfaceData extends AModuleAutomationObject implements CommunicationInterfaceData {
/**
* The general part of the interface address. F.ex. an IP.
* @protected
*/
protected macrocosm?: string;
/**
* The more specific part of the interface address. F.ex. a port.
* @protected
*/
protected microcosm?: string;
protected constructor();
/**
* @inheritDoc {@link CommunicationInterfaceData.getInterfaceDescription}
*!/
getInterfaceDescription(callback: (response: Backbone.PiMAdResponse, interfaceDescription: InterfaceDescription) => void): void {
this.genericPiMAdGetter<InterfaceDescription | undefined>({macrocosm: this.macrocosm, microcosm: this.microcosm}, callback);
}
/!**
* @inheritDoc {@link CommunicationInterfaceData.getMacrocosm}
*!/
getMacrocosm(callback: (response: Backbone.PiMAdResponse, macrocosm: string) => void): void {
// this.genericPiMAdGetter<string>(this.macrocosm, callback);
}
/!**
* @inheritDoc {@link CommunicationInterfaceData.getMicrocosm}
*!/
getMicrocosm(callback: (response: Backbone.PiMAdResponse, microcosm: string) => void): void {
//this.genericPiMAdGetter<string>(this.microcosm, callback);
}*/
/**
* Initialize this instance with interface description data. Caution: After a successful initialisation one cannot
* initialize it again. Spawn a new object instead.
* @param instructions - Most params a standard. In the context of opc-ua the macrocosm is the namespace and the
* microcosm is the identifier of the opc-ua-server.
*/
initialize(instructions: InitializeCommunicationInterfaceData): boolean;
}
/**
* This class models the interface description of opc-ua-servers.
*/
export declare class OPCUAServerCommunication extends ACommunicationInterfaceData {
constructor();
}
/**
* This class models the interface description of opc-ua-nodes.
*/
export declare class OPCUANodeCommunication extends ACommunicationInterfaceData {
protected nodeId: NodeId;
/**
* Getter. Maybe use a TODO: new interface
* @param callback
*/
getNodeId(callback: (response: Backbone.PiMAdResponse, nodeId: NodeId) => void): void;
/**
* Initialize this instance with interface description data. Caution: After a successful initialisation one cannot
* initialize it again. Spawn a new object instead.
* @param instructions - Most params a standard. In the context of opc-ua the macrocosm is the namespace and the
* microcosm is the identifier of the opc-ua-node.
*/
initialize(instructions: InitializeCommunicationInterfaceData): boolean;
constructor();
}
/**
* Factory interface for instances of {@link CommunicationInterfaceData}
*/
export interface CommunicationInterfaceDataFactory {
/**
* Create an instance of the {@link CommunicationInterfaceData} interface.
*/
create(): CommunicationInterfaceData;
}
/**
* Enum of different communication interface data classes.
*/
export declare enum CommunicationInterfaceDataEnum {
/**
* {@link OPCUAServerCommunication}
*/
OPCUAServer = 0,
/**
* {@link OPCUANodeCommunication}
*/
OPCUANode = 1
}
/**
* This class allows you to purchase different instances of the {@link CommunicationInterfaceData} interface.
*/
export declare class CommunicationInterfaceDataVendor {
private opcuaNodeCommunicationFactory;
private opcuaServerCommunicationFactory;
constructor();
/**
* Buy a specific instance of CommunicationInterfaceData interface.
* @param interfaceDataClass - Define via parameter which interface you want to buy.
*/
buy(interfaceDataClass: CommunicationInterfaceDataEnum): CommunicationInterfaceData;
}
export {};