aboutsummaryrefslogtreecommitdiff
path: root/util.go
diff options
context:
space:
mode:
authorNoah Stride <[email protected]>2024-02-01 00:28:09 +0000
committerGitHub <[email protected]>2024-01-31 14:28:09 -1000
commit463760ccf1cb99f387f5bf99ed83e31772744671 (patch)
tree99feec624d4f04542e0c4aaab037b4e0b937a9f4 /util.go
parent202889338e29c416e810de888734a2d41c6b1069 (diff)
Rough initial radio emulator (#1)
* Super rough initial subscription to channels and sending node info * Very ugly hacky FromRadio subscription * Add more TODOs :weary: * Add log message before we try to broadcast NodeInfo * Add basic positioning broadcasting * demo sending message from consumer * Use const for BroadcastNodeID * Config validation and defaults * Tidy up examples/TODOs * Tidy up example * Handle position and devicetelemetry updates * Fix dodgy merge * Allow configuring interval for nodeinfo/position seperately * Make broadcasted position configurable * Add MQTTProtoTopic constant rather than modifying topic root * Allow altitude of broadcasted position to be configured * static check ignore
Diffstat (limited to 'util.go')
-rw-r--r--util.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/util.go b/util.go
index 0de4297..ef2c61f 100644
--- a/util.go
+++ b/util.go
@@ -4,6 +4,7 @@ import (
pbuf "buf.build/gen/go/meshtastic/protobufs/protocolbuffers/go/meshtastic"
"encoding/binary"
"fmt"
+ "math"
)
type NodeID uint32
@@ -23,6 +24,9 @@ func (n NodeID) Bytes() []byte {
return bytes
}
+// BroadcastNodeID is the special NodeID used when broadcasting a packet to a channel.
+const BroadcastNodeID NodeID = math.MaxUint32
+
type Node struct {
LongName string
ShortName string