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)
| 186 | // DevicePingSlotFrequency computes the frequency of the ping slot at time pingAt. |
| 187 | // If no frequency is found, this function returns 0. |
| 188 | func 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. |
| 203 | func DeviceResetsFCnt( |
no test coverage detected