meshtastic / js

JS/TS library for interfacing with Meshtastic devices
https://meshtastic.org
GNU General Public License v3.0
74 stars 36 forks source link

Incorrectly set enums in protobuf messages #33

Closed sachaw closed 3 years ago

sachaw commented 3 years ago

I originally discovered an occasional type mismatch in received protobufs when working on the meshtastic.js library, and found that enums are sent as there property name as against there index, i.e. "modemConfig": "Bw125Cr48Sf4096" vs "modemConfig": 3 This has two issues, firstly messages are much larger than they need to be, secondly, some protobuf libraries aren't smart enough to automatically handle these inconsistencies.

image

geeksville commented 3 years ago

Ooh yes. Those should definitely be serialized as ints, not strs. Good find.

geeksville commented 3 years ago

hmm - where did this json come from? the web server inside the device or the python api?

sachaw commented 3 years ago

@geeksville Seems to be an issue in protobufjs which is used by both protoman and meshtastic.js

sachaw commented 3 years ago

No longer using protobufjs