birdy slim iot now has real random ID

master
cheetah 2 years ago
parent 7d116cfe95
commit e786715ab3

@ -12,7 +12,7 @@ class BirdySlim extends PagerDevice {
this.name = "birdyslim"
}
RandID() {
return `B${ Str.random(4) }`
return `${ Str.random(5) }`
}
async formatTX(msg) {
msg.id = this.RandID()
@ -38,7 +38,6 @@ class BirdySlim extends PagerDevice {
longitude: data.longitude,
}
stateSet.lastLoRaPacket = data.metadata
console.log(data, stateSet)
/*if (!!data.metadata && !!data.metadata.uplink_message.rx_metadata) {
const rx_metadata = data.metadata.uplink_message.rx_metadata
@ -46,6 +45,7 @@ class BirdySlim extends PagerDevice {
switch (data.type) {
case 'ack': {
try {
switch (data.ack) {
case 'recv':
require('../ConnectorRegistry').reportDelivered({ id: data.msgid }, `lorawan:${ data.device_id }`)
@ -64,6 +64,9 @@ class BirdySlim extends PagerDevice {
date: data.date,
metadata: data.metadata,
})
} catch (e) {
console.error('failed to report lorawan data for message', data.msgid)
}
}
break;
case 'sos':
@ -71,14 +74,11 @@ class BirdySlim extends PagerDevice {
sos: data.sos,
date: data.date,
}
break;
case 'status':
case 'cannedMessage':
case 'low_battery':
case 'power':
case 'battery':
case 'sos':
case 'gps':
require('../DeviceRegistry').deviceEvent(this.name, data.device_id, data)
break;

Loading…
Cancel
Save