AppendDLSettings appends encoded msg to dst.
(dst []byte, msg *ttnpb.DLSettings)
| 188 | |
| 189 | // AppendDLSettings appends encoded msg to dst. |
| 190 | func AppendDLSettings(dst []byte, msg *ttnpb.DLSettings) ([]byte, error) { |
| 191 | if msg.GetRx1DrOffset() > 7 { |
| 192 | return nil, errExpectedLowerOrEqual("Rx1DROffset", 7)(msg.GetRx1DrOffset()) |
| 193 | } |
| 194 | if msg.GetRx2Dr() > 15 { |
| 195 | return nil, errExpectedLowerOrEqual("Rx2DR", 15)(msg.GetRx2Dr()) |
| 196 | } |
| 197 | b := byte(msg.GetRx2Dr()) |
| 198 | b |= byte(msg.GetRx1DrOffset() << 4) |
| 199 | if msg.GetOptNeg() { |
| 200 | b |= (1 << 7) |
| 201 | } |
| 202 | return append(dst, b), nil |
| 203 | } |
| 204 | |
| 205 | // MarshalDLSettings returns encoded msg. |
| 206 | func MarshalDLSettings(msg *ttnpb.DLSettings) ([]byte, error) { |
no test coverage detected