2020-08-30 07:45:44 +00:00
|
|
|
/**
|
|
|
|
* @author Martin Karkowski
|
|
|
|
* @email m.karkowski@zema.de
|
|
|
|
* @create date 2018-06-11 01:49:04
|
2020-09-08 14:59:06 +00:00
|
|
|
* @modify date 2020-09-08 16:26:47
|
2020-08-30 07:45:44 +00:00
|
|
|
* @desc [description]
|
|
|
|
*/
|
|
|
|
|
2020-09-08 14:59:06 +00:00
|
|
|
import * as mqtt from 'mqtt';
|
|
|
|
import { IModuleDescription } from '../../mod-Assembly-Builder/type/interfaces';
|
|
|
|
import { ITopicMatcher } from '../../mod-Publish-And-Subscribe-System/type/interfaces';
|
|
|
|
import { MQTTConverter } from '../src/mqtt-converter';
|
|
|
|
import { ExternalMQTTServerWithConverter } from '../src/mqtt-interface-with-converter';
|
2020-08-30 07:45:44 +00:00
|
|
|
import { MQTTMatcher } from '../src/mqtt-matching';
|
|
|
|
import * as MQTT from '../type/types';
|
|
|
|
|
|
|
|
|
|
|
|
export const TYPES = {
|
|
|
|
MQTTMatcher: MQTT.TYPES.MQTTMatcher,
|
|
|
|
MQTTInterface: Symbol('MQTTExternalBroker'),
|
|
|
|
MQTTConverter: MQTT.TYPES.MQTTConverter,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-09-08 14:59:06 +00:00
|
|
|
export const DESCRIPTION: IModuleDescription<typeof TYPES> = {
|
|
|
|
AUTOSTART: {
|
|
|
|
broker: [
|
|
|
|
]
|
2020-08-30 07:45:44 +00:00
|
|
|
},
|
2020-09-08 14:59:06 +00:00
|
|
|
DEFAULT_INSTANCES: ['broker'],
|
|
|
|
NAME: 'MQTT',
|
|
|
|
PROVIDED_CLASSES: [
|
|
|
|
{
|
|
|
|
selector: TYPES.MQTTMatcher,
|
|
|
|
type: MQTTMatcher,
|
|
|
|
options: {
|
|
|
|
scope: 'inSingletonScope',
|
|
|
|
},
|
2020-08-30 07:45:44 +00:00
|
|
|
},
|
2020-09-08 14:59:06 +00:00
|
|
|
{
|
|
|
|
selector: TYPES.MQTTInterface,
|
|
|
|
type: ExternalMQTTServerWithConverter,
|
|
|
|
options: {
|
|
|
|
scope: 'inSingletonScope',
|
|
|
|
},
|
2020-08-30 07:45:44 +00:00
|
|
|
},
|
2020-09-08 14:59:06 +00:00
|
|
|
{
|
|
|
|
selector: TYPES.MQTTConverter,
|
|
|
|
type: MQTTConverter,
|
|
|
|
options: {
|
|
|
|
scope: 'inSingletonScope',
|
|
|
|
},
|
2020-08-30 07:45:44 +00:00
|
|
|
},
|
2020-09-08 14:59:06 +00:00
|
|
|
{
|
|
|
|
selector: MQTT.TYPES.MQTTLibrary,
|
|
|
|
type: mqtt,
|
|
|
|
options: {
|
|
|
|
toConstant: true
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
PROVIDED_FUNCTIONS: [],
|
|
|
|
REQURIES: ["PUBSUB", "CONVERTER"],
|
|
|
|
TYPES,
|
|
|
|
ACTIVATIONHANDLERS: []
|
|
|
|
}
|
2020-08-30 07:45:44 +00:00
|
|
|
|
2020-09-08 14:59:06 +00:00
|
|
|
export default DESCRIPTION;
|
2020-08-30 07:45:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
/** Export the Type */
|
|
|
|
export type Matcher = ITopicMatcher;
|
|
|
|
export type MQTTInterface = ExternalMQTTServerWithConverter;
|