More protocols

This commit is contained in:
2026-02-17 23:30:49 +01:00
parent 62a90a468d
commit 74a517a22a
15 changed files with 2268 additions and 21 deletions

View File

@@ -1,6 +1,7 @@
package aprs
import (
"encoding/json"
"errors"
"fmt"
"strings"
@@ -46,6 +47,25 @@ func (a Address) Secret() int16 {
return h & 0x7fff
}
func (a Address) MarshalJSON() ([]byte, error) {
return json.Marshal(a.String())
}
func (a *Address) UnmarshalJSON(b []byte) error {
var s string
if err := json.Unmarshal(b, &s); err != nil {
return err
}
p, err := ParseAddress(s)
if err != nil {
return err
}
a.Call = p.Call
a.SSID = p.SSID
a.IsRepeated = p.IsRepeated
return nil
}
func ParseAddress(s string) (Address, error) {
r := strings.HasSuffix(s, "*")
if r {