UNPKG

@p2olab/pimad-core

Version:

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

100 lines (99 loc) 3.96 kB
/// <reference types="node" /> import fileSystem = require('fs'); import { Backbone } from '../../Backbone'; import PiMAdResponseVendor = Backbone.PiMAdResponseVendor; import PiMAdResponse = Backbone.PiMAdResponse; /** * AGate is an abstract implementation of the Gate-Interface. Mainly this one reduces the code. */ declare abstract class AGate implements Gate { protected initialized: boolean; protected gateAddress: string | undefined; protected responseVendor: PiMAdResponseVendor; protected constructor(); send(instructions: object, callback: (response: PiMAdResponse) => void): void; abstract receive(instructions: object, callback: (response: PiMAdResponse) => void): void; getGateAddress(): string | undefined; initialize(address: string): boolean; } /** * An AFileSystemGate allows the access to the local file system. */ declare abstract class AFileSystemGate extends AGate { protected fileSystem: typeof fileSystem; /** * This function cuts of the last four characters of the input string. F. ex.: test.xml -\> test * @param fileName - The name of the file as String. */ protected static getFileType(fileName: string): string; constructor(); } /** * A AMLGate is an abstraction layer to interact with AML-Files. */ export declare class AMLGate extends AFileSystemGate { private xmlGateFactory; receive(instructions: object, callback: (response: PiMAdResponse) => void): void; constructor(); } /** * A MockGate let test your implementation and converter logic. It has no relevant function. */ export declare class MockGate extends AGate { send(instructions: object, callback: (response: PiMAdResponse) => void): void; receive(instructions: object, callback: (response: PiMAdResponse) => void): void; constructor(); } /** * A MTPGate is an abstraction layer to interact with MTP-Archives. */ export declare class MTPGate extends AFileSystemGate { private zipGateFactory; receive(instructions: object, callback: (response: PiMAdResponse) => void): void; constructor(); } /** * A XMLGate is an abstraction layer to interact with XML-Files. */ export declare class XMLGate extends AFileSystemGate { receive(instructions: object, callback: (response: PiMAdResponse) => void): void; } /** * A ZIPGate is an abstraction layer to interact with ZIP-Archives. */ export declare class ZIPGate extends AFileSystemGate { private xmlGateFactory; private amlGateFactory; receive(instructions: object, callback: (response: PiMAdResponse) => void): void; constructor(); } /** * Gates allows connections to other realms. Use Gates to connect to different data sources like MTP or TripleStore with * a little API. Every Gate needs an initialisation via initialize() to work in proper manner. */ export interface Gate { /** * Write data to the source via the gate. * @param instructions - A set of instructions, configuring the gate while sending. * @param callback - Concerning asynchronous behaviour, return data via a callback function. */ send(instructions: object, callback: (response: PiMAdResponse) => void): void; /** * Asynchronous: Send a request to the source and receive theirs answer. * @param instructions - A set of instructions, configuring the gate while receiving. * @param callback - Concerning asynchronous behaviour, return data via a callback function. */ receive(instructions: object, callback: (response: PiMAdResponse) => void): void; /** * Get the address of the gate. * @returns Returns the address of the gate. */ getGateAddress(): string | undefined; /** * Initialize the gate. The gates won't work without initialisation. * @param address - The address of the Gate. * @returns A successful initialisation returns a true. A bad one returns a false. */ initialize(address: string): boolean; } export {};