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

Function UnmarshalDLSettings

pkg/encoding/lorawan/messages.go:211–220  ·  view source on GitHub ↗

UnmarshalDLSettings unmarshals b into msg.

(b []byte, msg *ttnpb.DLSettings)

Source from the content-addressed store, hash-verified

209
210// UnmarshalDLSettings unmarshals b into msg.
211func UnmarshalDLSettings(b []byte, msg *ttnpb.DLSettings) error {
212 if len(b) != 1 {
213 return errExpectedLengthEncodedEqual("DLSettings", 1)(len(b))
214 }
215 v := uint32(b[0])
216 msg.OptNeg = (v >> 7) != 0
217 msg.Rx1DrOffset = ttnpb.DataRateOffset((v >> 4) & 0x7)
218 msg.Rx2Dr = ttnpb.DataRateIndex(v & 0xf)
219 return nil
220}
221
222var errMaxCFListFrequency = unexpectedValue(
223 errors.DefineInvalidArgument("max_cflist_frequency", "expected CFList frequency to be less or equal to 0xFFFFFF", valueKey),

Callers 2

JoinRequestMethod · 0.92

Calls 3

DataRateOffsetTypeAlias · 0.92
DataRateIndexTypeAlias · 0.92

Tested by

no test coverage detected