MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / UnmarshalJSON

Method UnmarshalJSON

pkg/ttnpb/udp/packet_data.go:129–145  ·  view source on GitHub ↗

UnmarshalJSON implements json.Unmarshaler.

(data []byte)

Source from the content-addressed store, hash-verified

127
128// UnmarshalJSON implements json.Unmarshaler.
129func (p *TxPacket) UnmarshalJSON(data []byte) error {
130 type Alias TxPacket
131 aux := struct {
132 *Alias
133 }{
134 Alias: (*Alias)(p),
135 }
136 if err := json.Unmarshal(data, &aux); err != nil {
137 return err
138 }
139 switch mod := p.DatR.DataRate.GetModulation().(type) {
140 case *ttnpb.DataRate_Lora:
141 mod.Lora.CodingRate = p.CodR
142 default:
143 }
144 return nil
145}
146
147// Stat contains a status message
148type Stat struct {

Callers

nothing calls this directly

Calls 2

GetModulationMethod · 0.80
UnmarshalMethod · 0.65

Tested by

no test coverage detected