diff --git a/README.md b/README.md index 4c71a17..5a2855e 100644 --- a/README.md +++ b/README.md @@ -4,5 +4,5 @@ A python client for using Meshtastic devices. This small library (and example ap You probably don't want this yet because it is a pre-alpha WIP. -For the rough notes/implementation plan see [TODO.md]. +For the rough notes/implementation plan see [TODO](./TODO.md). diff --git a/TODO.md b/TODO.md index 6dac9c4..e862105 100644 --- a/TODO.md +++ b/TODO.md @@ -1,40 +1,41 @@ # TODO -* protobuf docs https://developers.google.com/protocol-buffers/docs/pythontutorial +- protobuf docs https://developers.google.com/protocol-buffers/docs/pythontutorial ## Primary API: MeshInterface + Contains a reader thread that is always trying to read on the serial port. methods: -constructor(serialPort) -send(meshPacket) - throws errors if we have errors talking to the device -close() - shuts down the interface -init() - starts the enumeration process to download nodedb etc... - we will not publish to topics until this enumeration completes -radioConfig -nodeDB -myNodeInfo -myNodeId -## PubSub topics: +- constructor(serialPort) +- send(meshPacket) - throws errors if we have errors talking to the device +- close() - shuts down the interface +- init() - starts the enumeration process to download NodeDB etc... - we will not publish to topics until this enumeration completes +- radioConfig +- nodeDB +- myNodeInfo +- myNodeId + +## PubSub topics + Use a pubsub model to communicate events [https://pypubsub.readthedocs.io/en/v4.0.3/ ] -meshtastic.send(MeshPacket) - Not implemented, instead call send(packet) on MeshInterface -meshtastic.connection.established - published once we've successfully connected to the radio and downloaded the node DB -meshtastic.connection.lost - published once we've lost our link to the radio -meshtastic.receive.position(MeshPacket) -meshtastic.receive.user(MeshPacket) -meshtastic.receive.data(MeshPacket) -meshtastic.debugMessage(string) +- meshtastic.send(MeshPacket) - Not implemented, instead call send(packet) on MeshInterface +- meshtastic.connection.established - published once we've successfully connected to the radio and downloaded the node DB +- meshtastic.connection.lost - published once we've lost our link to the radio +- meshtastic.receive.position(MeshPacket) +- meshtastic.receive.user(MeshPacket) +- meshtastic.receive.data(MeshPacket) +- meshtastic.debugMessage(string) ## Wire encoding -When sending protobuf packets over serial or TCP each packet is preceeded by uint32_t sent in network byte order (big endian). -The upper 16 bits must be 0x4403. The lower 16 bits are packet length (this encoding gives room to eventually allow quite large packets). +When sending protobuf packets over serial or TCP each packet is preceded by uint32_t sent in network byte order (big endian). +The upper 16 bits must be 0x4403. The lower 16 bits are packet length (this encoding gives room to eventually allow quite large packets). -Implementations validate length against the maximum possible size of a BLE packet (our lowest common denominator) of 512 bytes. If the +Implementations validate length against the maximum possible size of a BLE packet (our lowest common denominator) of 512 bytes. If the length provided is larger than that we assume the packet is corrupted and begin again looking for 0x4403 framing. The packets flowing towards the device are ToRadio protobufs, the packets flowing from the device are FromRadio protobufs. The 0x4403 marker can be used as framing to (eventually) resync if packets are corrupted over the wire. - -