Description
Replace existing protocol buffer message decoding and encoding implementations with an implementation compatible with api-v2
throughout the library. Also, update the function signatures and logic for encoding/decoding as needed.
The list of tasks below is subject to change during this process.
Documentation Tasks
I need to mentally untangle the codebase and map it out before I'm ready to refactor.
- Document the location of each pb_encode/pb_decode call, what it specifically does, and where it is located.
- Identify which PBs from
api-v2
are not presenting any breaking changes - Identify which PBs from
api-v2
will present breaking changes - Organize components with breaking changes from least impact to greatest
- Identify which components we won't be touching or changing - things that don't have anything to do with the PBs.
Non-breaking, refactor Tasks
- Implement a strategy that allows for easy swapping between two WipperSnapper APIs within a single runtime #616
- Update MQTT topics for
api-v2
#618
Refactor for "Top-Level Decoding" Logic
The new API switches us from listening to a unique mqtt topic per component to two "high-level mqtt topics" and a top-level pb message
- Refactor registration process to use new check-in API #619
- Replace old decoding logic with a new, top-level decoder. Similar to the "router" we used in WipperSnapper Python
- Test w/protomq that the new top-level decoder properly sends messages to each of the component types
- May require WITL (Wokwi in the Loop) testing to ensure each component type is successfully decoded
Refactor for "Top Level Encoding" Logic
Similar task to above, but in reverse for encoding
- Replace old encoding logic with a new, top-level encoder.
- Test w/protomq that the new top-level encoder properly sends messages to the broker
- May require WITL (Wokwi in the Loop) testing to ensure each component type is successfully encoded
Update each component
Each component's decoder/encoder will need to be refactored to match the new top-level encoding/decoding logic, new MQTT topics, and refactored PB message structs
- Refactor registration process to use new check-in API #619
- Update Wippersnapper_DigitalGPIO class for V2 API #624
- Refactor AnalogIO Component for API v2 #637
- Refactor DS18x Component for API v2 #638
- [API-v2] Refactor UART #639
- Refactor I2C Component for API v2 #640
- Refactor LEDC, Servo and PWM Components for API v2 #641