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

Method EndDeviceIdentifiers

pkg/ttnpb/lorawan.go:1171–1199  ·  view source on GitHub ↗

EndDeviceIdentifiers returns the end device identifiers (DevEUI/JoinEUI/DevAddr) available for the message payload. Note that if the payload is nil, the end device identifiers will be nil.

()

Source from the content-addressed store, hash-verified

1169// EndDeviceIdentifiers returns the end device identifiers (DevEUI/JoinEUI/DevAddr) available for the message payload.
1170// Note that if the payload is nil, the end device identifiers will be nil.
1171func (m *Message) EndDeviceIdentifiers() *EndDeviceIdentifiers {
1172 if h := m.GetMacPayload().GetFHdr(); h != nil {
1173 devAddr := types.MustDevAddr(h.DevAddr).OrZero()
1174 return &EndDeviceIdentifiers{
1175 DevAddr: devAddr.Bytes(),
1176 }
1177 }
1178 if p := m.GetJoinRequestPayload(); p != nil {
1179 devEUI, joinEUI := types.MustEUI64(p.DevEui).OrZero(), types.MustEUI64(p.JoinEui).OrZero()
1180 return &EndDeviceIdentifiers{
1181 DevEui: devEUI.Bytes(),
1182 JoinEui: joinEUI.Bytes(),
1183 }
1184 }
1185 if p := m.GetJoinAcceptPayload(); p != nil {
1186 devAddr := types.MustDevAddr(p.DevAddr).OrZero()
1187 return &EndDeviceIdentifiers{
1188 DevAddr: devAddr.Bytes(),
1189 }
1190 }
1191 if p := m.GetRejoinRequestPayload(); p != nil {
1192 devEUI, joinEUI := types.MustEUI64(p.DevEui).OrZero(), types.MustEUI64(p.JoinEui).OrZero()
1193 return &EndDeviceIdentifiers{
1194 DevEui: devEUI.Bytes(),
1195 JoinEui: joinEUI.Bytes(),
1196 }
1197 }
1198 return nil
1199}
1200
1201// FieldIsZero returns whether path p is zero.
1202func (v *RelaySecondChannel) FieldIsZero(p string) bool {

Callers 1

handlePacketMethod · 0.80

Calls 9

GetMacPayloadMethod · 0.95
GetJoinRequestPayloadMethod · 0.95
GetJoinAcceptPayloadMethod · 0.95
MustDevAddrFunction · 0.92
MustEUI64Function · 0.92
GetFHdrMethod · 0.80
BytesMethod · 0.65
OrZeroMethod · 0.45

Tested by

no test coverage detected