before update
This commit is contained in:
parent
2814584831
commit
7eb1aa78ab
10 changed files with 239 additions and 118 deletions
|
@ -26,7 +26,7 @@
|
|||
},
|
||||
"emPuppettering": {
|
||||
"enabled": true,
|
||||
"duplexTimeout": 360
|
||||
"duplexTimeout": "250"
|
||||
},
|
||||
"emessage": {
|
||||
"enabled": true,
|
||||
|
@ -50,6 +50,10 @@
|
|||
"username": "test",
|
||||
"password": "testsucks",
|
||||
"duplexTimeout": 300
|
||||
},
|
||||
"pnet": {
|
||||
"enabled": true,
|
||||
"duplexTimeout": 10
|
||||
}
|
||||
},
|
||||
"pagers": {
|
||||
|
|
|
@ -325,6 +325,8 @@
|
|||
deviceType: [
|
||||
{ k: 'Generic', v: 'generic' },
|
||||
{ k: 'Birdy Slim (IoT)', v: 'birdyslim' },
|
||||
{ k: 'MXP600', v: 'mxp600' },
|
||||
{ k: 'Generic Tetra', v: 'tetra-generic' },
|
||||
],
|
||||
connectorTypes: [
|
||||
{ k: 'Dummy', v: 'dummy' },
|
||||
|
@ -339,6 +341,8 @@
|
|||
{ k: 'e*2wayS alarmManager', v: 'em-a-twoways' },
|
||||
|
||||
{ k: 'LoRaWAN TTNv3', v: 'lorawan' },
|
||||
|
||||
{ k: 'pNET TETRA', v: 'pnet' },
|
||||
],
|
||||
configData: {
|
||||
boskrypt: {
|
||||
|
|
|
@ -217,6 +217,8 @@ Last LoRaWAN Packet:
|
|||
deviceType: [
|
||||
{k: 'Generic', v: 'generic'},
|
||||
{k: 'Birdy Slim (IoT)', v: 'birdyslim'},
|
||||
{ k: 'MXP600', v: 'mxp600' },
|
||||
{ k: 'Generic Tetra', v: 'tetra-generic' },
|
||||
],
|
||||
connectorTypes: [
|
||||
{k: 'Dummy', v: 'dummy'},
|
||||
|
@ -231,6 +233,8 @@ Last LoRaWAN Packet:
|
|||
{k: 'e*2wayS alarmManager', v: 'em-a-twoways'},
|
||||
|
||||
{k: 'LoRaWAN TTNv3', v: 'lorawan'},
|
||||
|
||||
{ k: 'pNET TETRA', v: 'pnet' },
|
||||
],
|
||||
|
||||
newMSGData: {
|
||||
|
|
6
index.js
6
index.js
|
@ -36,6 +36,9 @@ if (!!config.connectors.emPuppettering && config.connectors.emPuppettering.enabl
|
|||
if (!!config.connectors.ecityruf && config.connectors.pagernetzAT.enabled === true) {
|
||||
types.ConnectorRegistry.register(new types.Connectors.PagernetzConnetorAT(connection))
|
||||
}
|
||||
if (!!config.connectors.ecityruf && config.connectors.pnet.enabled === true) {
|
||||
types.ConnectorRegistry.register(new types.Connectors.pNetConnector())
|
||||
}
|
||||
|
||||
types.ConnectorRegistry.register(new types.Connectors.DummyConnector())
|
||||
|
||||
|
@ -43,6 +46,9 @@ types.DeviceRegistry.register(new types.devices.GenericPager())
|
|||
types.DeviceRegistry.register(new types.devices.BirdySlim())
|
||||
types.DeviceRegistry.register(new types.devices.EMessage2Ways())
|
||||
types.DeviceRegistry.register(new types.devices.Skyper())
|
||||
//new tetra devices
|
||||
types.DeviceRegistry.register(new types.devices.TETRA_Generic())
|
||||
types.DeviceRegistry.register(new types.devices.TETRA_MXP600())
|
||||
|
||||
const express = require('express')
|
||||
const { MessageManager } = require('./types')
|
||||
|
|
|
@ -9,7 +9,7 @@ function Decoder(bytes, port) {
|
|||
data.type = 'ack'
|
||||
data.ack = 'recv'
|
||||
data.msgid = bytesToString(bytes.splice(0,5))
|
||||
data.rssi = bytes[0]
|
||||
data.rssi = -bytes[0] / 2
|
||||
break;
|
||||
case 2: // Read and Operational Acknowledgment 'AA|5|' and Operational '33|5|<CustomByte(s)>'
|
||||
// AA 31 32 33 34 35
|
||||
|
|
|
@ -22,6 +22,7 @@ module.exports = {
|
|||
eMessagePuppeteerConnectorTwoWays,
|
||||
|
||||
PagernetzConnetorAT: require('./PagernetzConnetorAT'),
|
||||
pNetConnector: require('./pNetConnector'),
|
||||
|
||||
LoRaWANConnector: require("./LoRaWANConnector"),
|
||||
POCSAGConnector: require("./POCSAGConnector"),
|
||||
|
|
59
types/connectors/pNetConnector.js
Normal file
59
types/connectors/pNetConnector.js
Normal file
|
@ -0,0 +1,59 @@
|
|||
const Connector = require("./Connector")
|
||||
const config = require('../../config.json')
|
||||
const md5 = require('md5')
|
||||
const axios = require('axios')
|
||||
const { io } = require("socket.io-client")
|
||||
|
||||
|
||||
class pNetConnector extends Connector {
|
||||
constructor (amqpConnMngr) {
|
||||
super(amqpConnMngr)
|
||||
this.name = "pnet"
|
||||
this.duplexCapable = true
|
||||
this.managementSocket = false
|
||||
}
|
||||
async transmitMessage(msg, params) {
|
||||
console.log('pnet socket=',this.managementSocket)
|
||||
if (!this.managementSocket) {
|
||||
console.log('starting pnet socket')
|
||||
this.managementSocket = io("wss://<pnet url>")
|
||||
this.managementSocket.on('smartpager:ingress:event', (evt) => {
|
||||
console.log(evt)
|
||||
//this.connectorRegistry.reportState(msg, evt.UUID, evt.state)
|
||||
if (evt.delivered) this.connectorRegistry.reportDelivered({ id: evt.msgid }, `tetra:${ evt.device_id }`)
|
||||
//require('../MessageManager').markMessageRead(data.msgid)
|
||||
if (evt.response) require('../MessageManager').respondToMessage(evt.msgid, evt.response)
|
||||
})
|
||||
await this.managementSocket.connect()
|
||||
}
|
||||
const UUID = this.name+':'+md5(JSON.stringify([this.name,...params]))
|
||||
if (params.length < 1) return false
|
||||
const target = params[0]
|
||||
if (target.split('#').length !== 2) throw 'No valid pNet Parameter <transmitterGroup#callSign>'
|
||||
const contact = target.split('#')[ 0 ], options = target.split('#')[ 1 ]
|
||||
/*const extraParameters = {
|
||||
auth: {
|
||||
username: config.connectors.dapnet.username,
|
||||
password: config.connectors.dapnet.password
|
||||
}
|
||||
}*/
|
||||
this.managementSocket.emit('smartpager:ingress', {
|
||||
UUID,
|
||||
id: msg.id,
|
||||
text: msg.payload,
|
||||
contact,
|
||||
options,
|
||||
})
|
||||
return true
|
||||
/*return axios.post("https://pnet.cheetah.cat/", dapnetRequest, extraParameters)
|
||||
.then(() => {
|
||||
return true
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err.response.data)
|
||||
this.connectorRegistry.reportFail(msg, UUID)
|
||||
return false
|
||||
})*/
|
||||
}
|
||||
}
|
||||
module.exports = pNetConnector
|
20
types/devices/GenericTetra.js
Normal file
20
types/devices/GenericTetra.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
const MessageManager = require("../MessageManager")
|
||||
const PagerDevice = require("./Device")
|
||||
const Str = require('@supercharge/strings')
|
||||
|
||||
class GenericTetra extends PagerDevice {
|
||||
constructor () {
|
||||
super()
|
||||
this.duplex = true
|
||||
this.name = "tetra-generic"
|
||||
}
|
||||
RandID() {
|
||||
return `TETRA${ Str.random(8) }`
|
||||
}
|
||||
async formatTX(msg) {
|
||||
msg.id = this.RandID()
|
||||
await MessageManager.BindMsg(msg)
|
||||
// return msg
|
||||
}
|
||||
}
|
||||
module.exports = GenericTetra
|
20
types/devices/MXP600.js
Normal file
20
types/devices/MXP600.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
const MessageManager = require("../MessageManager")
|
||||
const PagerDevice = require("./Device")
|
||||
const Str = require('@supercharge/strings')
|
||||
|
||||
class TETRA_MXP600 extends PagerDevice {
|
||||
constructor () {
|
||||
super()
|
||||
this.duplex = true
|
||||
this.name = "mxp600"
|
||||
}
|
||||
RandID() {
|
||||
return `MXP${ Str.random(8) }`
|
||||
}
|
||||
async formatTX(msg) {
|
||||
msg.id = this.RandID()
|
||||
await MessageManager.BindMsg(msg)
|
||||
// return msg
|
||||
}
|
||||
}
|
||||
module.exports = TETRA_MXP600
|
|
@ -3,5 +3,8 @@ module.exports = {
|
|||
BirdySlim: require("./BirdySlim"),
|
||||
EMessage2Ways: require("./EMessage2Ways"),
|
||||
Skyper: require("./Skyper"),
|
||||
TETRA_MXP600: require("./MXP600"),
|
||||
TETRA_Generic: require("./GenericTetra"),
|
||||
|
||||
Device: require("./Device"),
|
||||
}
|
Loading…
Add table
Reference in a new issue