UnmarshalJSON implements json.Unmarshaler.
(data []byte)
| 127 | |
| 128 | // UnmarshalJSON implements json.Unmarshaler. |
| 129 | func (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 |
| 148 | type Stat struct { |
nothing calls this directly
no test coverage detected