You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
624 B
JavaScript
22 lines
624 B
JavaScript
const { POCSAGConnector } = require("./connectors")
|
|
|
|
class ConnectorRegistry {
|
|
constructor() {
|
|
this.Connectors = {}
|
|
}
|
|
register(connector) {
|
|
this.Connectors[ connector.name ] = connector
|
|
}
|
|
transmit(name, msg, params) {
|
|
if (!this.Connectors[ name ]) throw "not registred"
|
|
this.Connectors[ name ].transmitMessage(msg, params)
|
|
}
|
|
supportDuplex(name) {
|
|
if (!this.Connectors[ name ]) throw "not registred"
|
|
return this.Connectors[ name ].duplexCapable
|
|
}
|
|
receive(id, data) {
|
|
}
|
|
}
|
|
const registry = new ConnectorRegistry()
|
|
module.exports = registry |