direct identifiers for the eMessage network

master
cheetah 2 years ago
parent bf33b59cac
commit 317664677d

@ -22,10 +22,14 @@ if (!!config.connectors.ecityruf && config.connectors.ecityruf.enabled === true)
types.ConnectorRegistry.register(new types.Connectors.eCityrufConnector(connection))
}
if (!!config.connectors.emessage && config.connectors.emessage.enabled === true) {
types.ConnectorRegistry.register(new types.Connectors.eMessageConnector(connection))
types.ConnectorRegistry.register(new types.Connectors.eMessageAlertManagerConnectorBase(connection))
types.ConnectorRegistry.register(new types.Connectors.eMessageAlertManagerConnectorCityruf(connection))
types.ConnectorRegistry.register(new types.Connectors.eMessageAlertManagerConnectorTwoWays(connection))
}
if (!!config.connectors.emPuppettering && config.connectors.emPuppettering.enabled === true) {
types.ConnectorRegistry.register(new types.Connectors.eMessagePuppeteerConnector(connection))
types.ConnectorRegistry.register(new types.Connectors.eMessagePuppeteerConnectorBase(connection))
types.ConnectorRegistry.register(new types.Connectors.eMessagePuppeteerConnectorCityruf(connection))
types.ConnectorRegistry.register(new types.Connectors.eMessagePuppeteerConnectorTwoWays(connection))
}

@ -15,7 +15,6 @@ class eCityrufConnector extends Connector {
const UUID = this.name+':'+md5(JSON.stringify([this.name,...params]))
if (params.length !== 1) return false
const $device = msg.routingParams.device
let payloadBuffer = Buffer.from(msg.payload)
const boskryptSupport = require("../DeviceRegistry").Devices[ $device ].supportBOSkrypt || false
@ -28,7 +27,6 @@ class eCityrufConnector extends Connector {
}
}
const cityrufRequest = require('querystring').stringify({
service: 1,
class: 7,

@ -3,19 +3,22 @@ const config = require('../../config.json')
const md5 = require('md5')
const axios = require('axios')
// [ "ecityruf", "123456789" ]
class eCityrufConnector extends Connector {
class eMessageAlertManagerConnectorBase extends Connector {
constructor (amqpConnMngr) {
super(amqpConnMngr)
this.name = "emessage"
this.defaultServiceName = ""
this.duplexCapable = true
this.supportBOSkrypt = true
}
async transmitMessage(msg, params) {
const UUID = this.name+':'+md5(JSON.stringify([this.name,...params]))
const target = params[0]
if (target.split('#').length !== 2) throw 'No valid eMessage Parameter <serviceName#identifier>'
const serviceName = target.split('#')[ 0 ], identifier = target.split('#')[ 1 ]
// eCityruf#8907737
const overwriteIdentifier = target.indexOf('#') > -1
//if (target.split('#').length !== 2) throw 'No valid eMessage Parameter <serviceName#identifier>'
const serviceName = overwriteIdentifier ? target.split('#')[ 0 ] : this.defaultServiceName,
identifier = overwriteIdentifier ? target.split('#')[ 1 ] : target
const $device = msg.routingParams.device
let payloadBuffer = Buffer.from(msg.payload)
@ -152,4 +155,31 @@ class eCityrufConnector extends Connector {
}
}
module.exports = eCityrufConnector
class eMessageAlertManagerConnectorCityruf extends eMessageAlertManagerConnectorBase {
constructor (amqpConnMngr) {
super(amqpConnMngr)
this.name = "em-a-cityruf"
this.defaultServiceName = "eCityruf"
this.duplexCapable = true
this.supportBOSkrypt = true
}
}
class eMessageAlertManagerConnectorTwoWays extends eMessageAlertManagerConnectorBase {
constructor (amqpConnMngr) {
super(amqpConnMngr)
this.name = "em-a-twoways"
this.defaultServiceName = "2wayS"
this.duplexCapable = true
this.supportBOSkrypt = true
}
}
module.exports = {
eMessageAlertManagerConnectorBase,
eMessageAlertManagerConnectorCityruf,
eMessageAlertManagerConnectorTwoWays
}

@ -6,18 +6,22 @@ const axios = require('axios')
const puppeteer = require('puppeteer')
function sleep(ms) { return new Promise(r=>setTimeout(r, ms))}
// [ "ecityruf", "123456789" ]
class eMessagePuppeteerConnector extends Connector {
class eMessagePuppeteerConnectorBase extends Connector {
constructor (amqpConnMngr) {
super(amqpConnMngr)
this.name = "em-puppet"
this.defaultServiceName = ""
this.duplexCapable = true
this.supportBOSkrypt = true
}
async transmitMessage(msg, params) {
const UUID = this.name+':'+md5(JSON.stringify([this.name,...params]))
const target = params[0]
if (target.split('#').length !== 2) throw 'No valid eMessage Parameter <serviceName#identifier>'
const serviceName = target.split('#')[ 0 ], identifier = target.split('#')[ 1 ]
const overwriteIdentifier = target.indexOf('#') > -1
//if (target.split('#').length !== 2) throw 'No valid eMessage Parameter <serviceName#identifier>'
const serviceName = overwriteIdentifier ? target.split('#')[ 0 ] : this.defaultServiceName,
identifier = overwriteIdentifier ? target.split('#')[ 1 ] : target
const $device = msg.routingParams.device
let payloadBuffer = Buffer.from(msg.payload)
@ -116,4 +120,29 @@ class eMessagePuppeteerConnector extends Connector {
}
}
}
module.exports = eMessagePuppeteerConnector
class eMessagePuppeteerConnectorCityruf extends eMessagePuppeteerConnectorBase {
constructor (amqpConnMngr) {
super(amqpConnMngr)
this.name = "em-p-cityruf"
this.defaultServiceName = "1"
this.duplexCapable = true
this.supportBOSkrypt = true
}
}
class eMessagePuppeteerConnectorTwoWays extends eMessageAlertManagerConnectorBase {
constructor (amqpConnMngr) {
super(amqpConnMngr)
this.name = "em-p-twoways"
this.defaultServiceName = "7"
this.duplexCapable = true
this.supportBOSkrypt = true
}
}
module.exports = {
eMessagePuppeteerConnectorBase,
eMessagePuppeteerConnectorCityruf,
eMessagePuppeteerConnectorTwoWays
}

@ -1,8 +1,26 @@
const {
eMessageAlertManagerConnectorBase,
eMessageAlertManagerConnectorCityruf,
eMessageAlertManagerConnectorTwoWays
} = require('./eMessageConnector')
const {
eMessagePuppeteerConnectorBase,
eMessagePuppeteerConnectorCityruf,
eMessagePuppeteerConnectorTwoWays
} = require('./eMessagePuppeteerConnector')
module.exports = {
DAPNETConnector: require("./DAPNETConnector"),
eCityrufConnector: require('./eCityrufConnector'),
eMessageConnector: require('./eMessageConnector'),
eMessagePuppeteerConnector: require('./eMessagePuppeteerConnector'),
eMessageAlertManagerConnectorBase,
eMessageAlertManagerConnectorCityruf,
eMessageAlertManagerConnectorTwoWays,
eMessagePuppeteerConnectorBase,
eMessagePuppeteerConnectorCityruf,
eMessagePuppeteerConnectorTwoWays,
LoRaWANConnector: require("./LoRaWANConnector"),
POCSAGConnector: require("./POCSAGConnector"),
DummyConnector: require("./DummyConnector"),

Loading…
Cancel
Save