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

Function AppendDLSettings

pkg/encoding/lorawan/messages.go:190–203  ·  view source on GitHub ↗

AppendDLSettings appends encoded msg to dst.

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

Source from the content-addressed store, hash-verified

188
189// AppendDLSettings appends encoded msg to dst.
190func 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.
206func MarshalDLSettings(msg *ttnpb.DLSettings) ([]byte, error) {

Callers 2

MarshalDLSettingsFunction · 0.85
AppendJoinAcceptPayloadFunction · 0.85

Calls 4

GetRx1DrOffsetMethod · 0.80
GetRx2DrMethod · 0.80
GetOptNegMethod · 0.80
errExpectedLowerOrEqualFunction · 0.70

Tested by

no test coverage detected