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