Add MapReport decoding and formatting support

- Added DecodeMapReport function to decode protobuf MapReport messages
- Added FormatMapReport function to display MapReport data in human-readable format
- Updated FormatTopicAndMapData to use the proper decoder and formatter
- Improved error handling with fallback to raw display

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Daniel Pupius
2025-04-20 16:07:46 -07:00
parent 42304465a3
commit 2a7bc97a80
2 changed files with 215 additions and 122 deletions
+9
View File
@@ -288,6 +288,15 @@ func DecodeJSONMessage(payload []byte) (map[string]interface{}, error) {
return jsonData, nil
}
// DecodeMapReport decodes a MapReport protobuf message (format "map")
func DecodeMapReport(payload []byte) (*pb.MapReport, error) {
var mapReport pb.MapReport
if err := proto.Unmarshal(payload, &mapReport); err != nil {
return nil, fmt.Errorf("failed to unmarshal MapReport: %v", err)
}
return &mapReport, nil
}
// IsASCII checks if the given byte array contains only ASCII characters
func IsASCII(data []byte) bool {
for _, b := range data {