From 54321600019a77acc21e518fd7bfdcc9b5dc1f0f Mon Sep 17 00:00:00 2001 From: cheetah Date: Sun, 27 Nov 2022 23:55:20 +0100 Subject: [PATCH] added pagernetz.at dummy for later use --- config.json | 4 ++++ index.js | 3 +++ types/connectors/PagernetzConnetorAT.js | 17 +++++++++++++++++ types/connectors/index.js | 2 ++ 4 files changed, 26 insertions(+) create mode 100644 types/connectors/PagernetzConnetorAT.js diff --git a/config.json b/config.json index 545b487..463df95 100644 --- a/config.json +++ b/config.json @@ -12,6 +12,10 @@ "enabled": true, "duplexTimeout": 300 }, + "pagernetzAT": { + "enabled": true, + "duplexTimeout": 300 + }, "pocsag": { "enabled": true, "duplexTimeout": 300 diff --git a/index.js b/index.js index a1bb843..d4012b7 100644 --- a/index.js +++ b/index.js @@ -32,6 +32,9 @@ if (!!config.connectors.emPuppettering && config.connectors.emPuppettering.enabl types.ConnectorRegistry.register(new types.Connectors.eMessagePuppeteerConnectorTwoWays(connection)) } +if (!!config.connectors.ecityruf && config.connectors.pagernetzAT.enabled === true) { + types.ConnectorRegistry.register(new types.Connectors.PagernetzConnetorAT(connection)) +} types.ConnectorRegistry.register(new types.Connectors.DummyConnector()) diff --git a/types/connectors/PagernetzConnetorAT.js b/types/connectors/PagernetzConnetorAT.js new file mode 100644 index 0000000..7e27709 --- /dev/null +++ b/types/connectors/PagernetzConnetorAT.js @@ -0,0 +1,17 @@ +const Connector = require("./Connector") +const md5 = require('md5') + +const config = require('../../config.json') +class PagernetzConnetorAT extends Connector { + constructor (amqpConnMngr) { + super(amqpConnMngr) + this.name = "pagernetz-at" + this.duplexCapable = true + } + async transmitMessage(msg, params) { + const UUID = this.name+':'+md5(JSON.stringify([ this.name, ...params ])) // uuid=name+hash of name+args + await new Promise((res)=>setTimeout(res,3e3)) + this.connectorRegistry.reportFail(msg, UUID) + } +} +module.exports = PagernetzConnetorAT \ No newline at end of file diff --git a/types/connectors/index.js b/types/connectors/index.js index 1ef641d..6f29b74 100644 --- a/types/connectors/index.js +++ b/types/connectors/index.js @@ -21,6 +21,8 @@ module.exports = { eMessagePuppeteerConnectorCityruf, eMessagePuppeteerConnectorTwoWays, + PagernetzConnetorAT: require('./PagernetzConnetorAT'), + LoRaWANConnector: require("./LoRaWANConnector"), POCSAGConnector: require("./POCSAGConnector"), DummyConnector: require("./DummyConnector"),