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

Function DevicePingSlotFrequency

pkg/networkserver/mac/utils.go:188–200  ·  view source on GitHub ↗

DevicePingSlotFrequency computes the frequency of the ping slot at time pingAt. If no frequency is found, this function returns 0.

(dev *ttnpb.EndDevice, phy *band.Band, pingAt time.Time)

Source from the content-addressed store, hash-verified

186// DevicePingSlotFrequency computes the frequency of the ping slot at time pingAt.
187// If no frequency is found, this function returns 0.
188func DevicePingSlotFrequency(dev *ttnpb.EndDevice, phy *band.Band, pingAt time.Time) uint64 {
189 switch {
190 case dev.GetMacState().GetCurrentParameters().GetPingSlotFrequency() != 0:
191 return dev.MacState.CurrentParameters.PingSlotFrequency
192 case len(phy.PingSlotFrequencies) > 0:
193 devAddr := types.MustDevAddr(dev.GetSession().GetDevAddr()).OrZero().MarshalNumber()
194 return band.ComputePeriodicFrequency(
195 beaconTimeBefore(pingAt), BeaconPeriod, devAddr, phy.PingSlotFrequencies...,
196 )
197 default:
198 return 0
199 }
200}
201
202// DeviceResetsFCnt returns whether the device resets frame counters on re-join.
203func DeviceResetsFCnt(

Calls 10

MustDevAddrFunction · 0.92
ComputePeriodicFrequencyFunction · 0.92
beaconTimeBeforeFunction · 0.85
GetCurrentParametersMethod · 0.80
GetMacStateMethod · 0.80
GetSessionMethod · 0.65
GetPingSlotFrequencyMethod · 0.45
MarshalNumberMethod · 0.45
OrZeroMethod · 0.45
GetDevAddrMethod · 0.45

Tested by

no test coverage detected