Use DecodeMessage for map format packets

- Simplify design by using DecodeMessage for map format too
- Remove redundant DecodeMapReport function
- Update FormatTopicAndMapData to format decoded packets
- Improve handling of map format packets

🤖 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:53:51 -07:00
parent 2a7bc97a80
commit 2f8ee3c9e1
3 changed files with 153 additions and 217 deletions
-9
View File
@@ -288,15 +288,6 @@ 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 {