mirror of
https://github.com/dpup/meshstream.git
synced 2026-08-02 06:53:11 +02:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user