Documentation ¶
Index ¶
- Constants
- Variables
- func AdaptDataRate(ctx context.Context, dev *ttnpb.EndDevice, phy *band.Band, ...) error
- func CFList(phy *band.Band, channels ...*ttnpb.MACParameters_Channel) *ttnpb.CFList
- func DeviceADRMargin(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) float32
- func DeviceClassBCDownlinkInterval(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) time.Duration
- func DeviceClassBTimeout(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) time.Duration
- func DeviceClassCTimeout(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) time.Duration
- func DeviceDefaultBeaconFrequency(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) uint64
- func DeviceDefaultChannels(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) []*ttnpb.MACParameters_Channel
- func DeviceDefaultClass(dev *ttnpb.EndDevice) (ttnpb.Class, error)
- func DeviceDefaultLoRaWANVersion(dev *ttnpb.EndDevice) ttnpb.MACVersion
- func DeviceDefaultMaxDutyCycle(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) ttnpb.AggregatedDutyCycle
- func DeviceDefaultPingSlotDataRateIndexValue(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) *ttnpb.DataRateIndexValue
- func DeviceDefaultPingSlotFrequency(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) uint64
- func DeviceDefaultPingSlotPeriodicity(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) *ttnpb.PingSlotPeriodValue
- func DeviceDefaultRX1DataRateOffset(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) ttnpb.DataRateOffset
- func DeviceDefaultRX1Delay(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) ttnpb.RxDelay
- func DeviceDefaultRX2DataRateIndex(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) ttnpb.DataRateIndex
- func DeviceDefaultRX2Frequency(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) uint64
- func DeviceDesiredADRAckDelayExponent(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) *ttnpb.ADRAckDelayExponentValue
- func DeviceDesiredADRAckLimitExponent(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) *ttnpb.ADRAckLimitExponentValue
- func DeviceDesiredBeaconFrequency(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) uint64
- func DeviceDesiredChannels(dev *ttnpb.EndDevice, phy *band.Band, fp *frequencyplans.FrequencyPlan, ...) []*ttnpb.MACParameters_Channel
- func DeviceDesiredDownlinkDwellTime(phy *band.Band, fp *frequencyplans.FrequencyPlan) *ttnpb.BoolValue
- func DeviceDesiredMaxDutyCycle(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) ttnpb.AggregatedDutyCycle
- func DeviceDesiredMaxEIRP(dev *ttnpb.EndDevice, phy *band.Band, fp *frequencyplans.FrequencyPlan, ...) float32
- func DeviceDesiredPingSlotDataRateIndexValue(dev *ttnpb.EndDevice, phy *band.Band, fp *frequencyplans.FrequencyPlan, ...) *ttnpb.DataRateIndexValue
- func DeviceDesiredPingSlotFrequency(dev *ttnpb.EndDevice, phy *band.Band, fp *frequencyplans.FrequencyPlan, ...) uint64
- func DeviceDesiredRX1DataRateOffset(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) ttnpb.DataRateOffset
- func DeviceDesiredRX1Delay(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) ttnpb.RxDelay
- func DeviceDesiredRX2DataRateIndex(dev *ttnpb.EndDevice, phy *band.Band, fp *frequencyplans.FrequencyPlan, ...) ttnpb.DataRateIndex
- func DeviceDesiredRX2Frequency(dev *ttnpb.EndDevice, phy *band.Band, fp *frequencyplans.FrequencyPlan, ...) uint64
- func DeviceDesiredUplinkDwellTime(phy *band.Band, fp *frequencyplans.FrequencyPlan) *ttnpb.BoolValue
- func DeviceDownlinkDwellTime(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) *ttnpb.BoolValue
- func DeviceExpectedDownlinkDwellTime(macState *ttnpb.MACState, fp *frequencyplans.FrequencyPlan, phy *band.Band) bool
- func DeviceExpectedUplinkDwellTime(macState *ttnpb.MACState, fp *frequencyplans.FrequencyPlan, phy *band.Band) bool
- func DeviceNeedsADRParamSetupReq(dev *ttnpb.EndDevice, phy *band.Band) bool
- func DeviceNeedsBeaconFreqReq(dev *ttnpb.EndDevice) bool
- func DeviceNeedsBeaconTimingReq(dev *ttnpb.EndDevice) bool
- func DeviceNeedsDLChannelReq(dev *ttnpb.EndDevice, phy *band.Band) bool
- func DeviceNeedsDLChannelReqAtIndex(dev *ttnpb.EndDevice, i int) bool
- func DeviceNeedsDevStatusReq(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings, transmitAt time.Time) bool
- func DeviceNeedsDevStatusReqAt(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) (time.Time, bool)
- func DeviceNeedsDutyCycleReq(dev *ttnpb.EndDevice) bool
- func DeviceNeedsLinkADRReq(ctx context.Context, dev *ttnpb.EndDevice, phy *band.Band) bool
- func DeviceNeedsNewChannelReq(dev *ttnpb.EndDevice, phy *band.Band) bool
- func DeviceNeedsNewChannelReqAtIndex(dev *ttnpb.EndDevice, i int) bool
- func DeviceNeedsPingSlotChannelReq(dev *ttnpb.EndDevice) bool
- func DeviceNeedsRejoinParamSetupReq(dev *ttnpb.EndDevice) bool
- func DeviceNeedsRxParamSetupReq(dev *ttnpb.EndDevice) bool
- func DeviceNeedsRxTimingSetupReq(dev *ttnpb.EndDevice) bool
- func DeviceNeedsTxParamSetupReq(dev *ttnpb.EndDevice, phy *band.Band) bool
- func DevicePingSlotFrequency(dev *ttnpb.EndDevice, phy *band.Band, pingAt time.Time) uint64
- func DeviceResetsFCnt(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) bool
- func DeviceScheduleDownlinks(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) bool
- func DeviceShouldAdaptDataRate(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings, phy *band.Band) (adaptDataRate bool, resetDesiredParameters bool, ...)
- func DeviceStatusCountPeriodicity(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) uint32
- func DeviceStatusTimePeriodicity(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) time.Duration
- func DeviceSupports32BitFCnt(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) bool
- func DeviceUplinkDwellTime(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) *ttnpb.BoolValue
- func DeviceUseADR(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings, phy *band.Band) bool
- func HandleADRParamSetupAns(ctx context.Context, dev *ttnpb.EndDevice) (events.Builders, error)
- func HandleBeaconFreqAns(ctx context.Context, dev *ttnpb.EndDevice, pld *ttnpb.MACCommand_BeaconFreqAns) (events.Builders, error)
- func HandleBeaconTimingReq(ctx context.Context, dev *ttnpb.EndDevice) (events.Builders, error)
- func HandleDLChannelAns(ctx context.Context, dev *ttnpb.EndDevice, pld *ttnpb.MACCommand_DLChannelAns) (events.Builders, error)
- func HandleDevStatusAns(ctx context.Context, dev *ttnpb.EndDevice, pld *ttnpb.MACCommand_DevStatusAns, ...) (events.Builders, error)
- func HandleDeviceModeInd(ctx context.Context, dev *ttnpb.EndDevice, pld *ttnpb.MACCommand_DeviceModeInd) (events.Builders, error)
- func HandleDeviceTimeReq(ctx context.Context, dev *ttnpb.EndDevice, msg *ttnpb.UplinkMessage) (events.Builders, error)
- func HandleDutyCycleAns(ctx context.Context, dev *ttnpb.EndDevice) (events.Builders, error)
- func HandleLinkADRAns(ctx context.Context, dev *ttnpb.EndDevice, pld *ttnpb.MACCommand_LinkADRAns, ...) (events.Builders, error)
- func HandleLinkCheckReq(ctx context.Context, dev *ttnpb.EndDevice, msg *ttnpb.UplinkMessage) (events.Builders, error)
- func HandleNewChannelAns(ctx context.Context, dev *ttnpb.EndDevice, pld *ttnpb.MACCommand_NewChannelAns) (events.Builders, error)
- func HandlePingSlotChannelAns(ctx context.Context, dev *ttnpb.EndDevice, ...) (events.Builders, error)
- func HandlePingSlotInfoReq(ctx context.Context, dev *ttnpb.EndDevice, ...) (events.Builders, error)
- func HandleRejoinParamSetupAns(ctx context.Context, dev *ttnpb.EndDevice, ...) (events.Builders, error)
- func HandleRekeyInd(ctx context.Context, dev *ttnpb.EndDevice, pld *ttnpb.MACCommand_RekeyInd, ...) (events.Builders, error)
- func HandleResetInd(ctx context.Context, dev *ttnpb.EndDevice, pld *ttnpb.MACCommand_ResetInd, ...) (events.Builders, error)
- func HandleRxParamSetupAns(ctx context.Context, dev *ttnpb.EndDevice, ...) (events.Builders, error)
- func HandleRxTimingSetupAns(ctx context.Context, dev *ttnpb.EndDevice) (events.Builders, error)
- func HandleTxParamSetupAns(ctx context.Context, dev *ttnpb.EndDevice) (events.Builders, error)
- func NewState(dev *ttnpb.EndDevice, fps *frequencyplans.Store, defaults *ttnpb.MACSettings) (*ttnpb.MACState, error)
- func NextPingSlotAt(ctx context.Context, dev *ttnpb.EndDevice, earliestAt time.Time) (time.Time, bool)
- type EnqueueState
- func EnqueueADRParamSetupReq(ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16, ...) EnqueueState
- func EnqueueBeaconFreqReq(ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16) EnqueueState
- func EnqueueDLChannelReq(ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16, ...) EnqueueState
- func EnqueueDevStatusReq(ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16, ...) EnqueueState
- func EnqueueDutyCycleReq(ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16) EnqueueState
- func EnqueueForceRejoinReq(ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16) EnqueueState
- func EnqueueLinkADRReq(ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16, ...) (EnqueueState, error)
- func EnqueueNewChannelReq(ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16, ...) EnqueueState
- func EnqueuePingSlotChannelReq(ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16) EnqueueState
- func EnqueueRejoinParamSetupReq(ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16) EnqueueState
- func EnqueueRxParamSetupReq(ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16) EnqueueState
- func EnqueueRxTimingSetupReq(ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16) EnqueueState
- func EnqueueTxParamSetupReq(ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16, ...) EnqueueState
Constants ¶
const ( // OptimalADRUplinkCount is the amount of uplinks required to ensure optimal results from the ADR algorithm. OptimalADRUplinkCount = 20 // DefaultADRMargin is the default ADR margin used if not specified in MACSettings of the device or NS-wide defaults. DefaultADRMargin = 15 )
const ( DefaultStatusCountPeriodicity uint32 = 200 DefaultStatusTimePeriodicity = 24 * time.Hour )
const (
BeaconPeriod = 128 * time.Second
)
const DefaultClassBTimeout = 10 * time.Minute
DefaultClassBTimeout is the default time-out for the device to respond to class B downlink messages. When waiting for a response times out, the downlink message is considered lost, and the downlink task triggers again.
const DefaultClassCTimeout = 5 * time.Minute
DefaultClassCTimeout is the default time-out for the device to respond to class C downlink messages. When waiting for a response times out, the downlink message is considered lost, and the downlink task triggers again.
Variables ¶
var ( EvtEnqueueADRParamSetupRequest = defineEnqueueMACRequestEvent( "adr_param_setup", "ADR parameter setup", events.WithDataType(&ttnpb.MACCommand_ADRParamSetupReq{}), )() EvtReceiveADRParamSetupAnswer = defineReceiveMACAnswerEvent( "adr_param_setup", "ADR parameter setup", )() )
var ( EvtEnqueueBeaconFreqRequest = defineEnqueueMACRequestEvent( "beacon_freq", "beacon frequency change", events.WithDataType(&ttnpb.MACCommand_BeaconFreqReq{}), )() EvtReceiveBeaconFreqReject = defineReceiveMACRejectEvent( "beacon_freq", "beacon frequency change", events.WithDataType(&ttnpb.MACCommand_BeaconFreqAns{}), )() EvtReceiveBeaconFreqAccept = defineReceiveMACAcceptEvent( "beacon_freq", "beacon frequency change", events.WithDataType(&ttnpb.MACCommand_BeaconFreqAns{}), )() )
var ( EvtEnqueueDevStatusRequest = defineEnqueueMACRequestEvent( "dev_status", "device status", )() EvtReceiveDevStatusAnswer = defineReceiveMACAnswerEvent( "dev_status", "device status", events.WithDataType(&ttnpb.MACCommand_DevStatusAns{}), )() )
var ( EvtReceiveDeviceModeIndication = defineReceiveMACIndicationEvent( "device_mode", "device mode", events.WithDataType(&ttnpb.MACCommand_DeviceModeInd{}), )() EvtEnqueueDeviceModeConfirmation = defineEnqueueMACConfirmationEvent( "device_mode", "device mode", events.WithDataType(&ttnpb.MACCommand_DeviceModeConf{}), )() )
var ( EvtReceiveDeviceTimeRequest = defineReceiveMACRequestEvent( "device_time", "device time", )() EvtEnqueueDeviceTimeAnswer = defineEnqueueMACAnswerEvent( "device_time", "device time", events.WithData(&ttnpb.MACCommand_DeviceTimeAns{}), )() )
var ( EvtEnqueueDLChannelRequest = defineEnqueueMACRequestEvent( "dl_channel", "downlink Rx1 channel frequency modification", events.WithDataType(&ttnpb.MACCommand_DLChannelReq{}), )() EvtReceiveDLChannelAccept = defineReceiveMACAcceptEvent( "dl_channel", "downlink Rx1 channel frequency modification", events.WithDataType(&ttnpb.MACCommand_DLChannelAns{}), )() EvtReceiveDLChannelReject = defineReceiveMACRejectEvent( "dl_channel", "downlink Rx1 channel frequency modification", events.WithDataType(&ttnpb.MACCommand_DLChannelAns{}), )() )
var ( EvtEnqueueDutyCycleRequest = defineEnqueueMACRequestEvent( "duty_cycle", "maximum aggregated transmit duty-cycle change", events.WithDataType(&ttnpb.MACCommand_DutyCycleReq{}), )() EvtReceiveDutyCycleAnswer = defineReceiveMACAnswerEvent( "duty_cycle", "maximum aggregated transmit duty-cycle change", )() )
var ( ErrRequestNotFound = errors.DefineInvalidArgument( "request_not_found", "MAC response received, but corresponding request not found", "cid", ) ErrNoPayload = errors.DefineInvalidArgument("no_payload", "no message payload specified") )
var ( EvtEnqueueLinkADRRequest = defineEnqueueMACRequestEvent( "link_adr", "link ADR", events.WithDataType(&ttnpb.MACCommand_LinkADRReq{}), )() EvtReceiveLinkADRAccept = defineReceiveMACAcceptEvent( "link_adr", "link ADR", events.WithDataType(&ttnpb.MACCommand_LinkADRAns{}), )() EvtReceiveLinkADRReject = defineReceiveMACRejectEvent( "link_adr", "link ADR", events.WithDataType(&ttnpb.MACCommand_LinkADRAns{}), )() )
var ( EvtReceiveLinkCheckRequest = defineReceiveMACRequestEvent( "link_check", "link check", )() EvtEnqueueLinkCheckAnswer = defineEnqueueMACAnswerEvent( "link_check", "link check", events.WithDataType(&ttnpb.MACCommand_LinkCheckAns{}), )() )
var ( EvtEnqueueNewChannelRequest = defineEnqueueMACRequestEvent( "new_channel", "new channel", events.WithDataType(&ttnpb.MACCommand_NewChannelReq{}), )() EvtReceiveNewChannelAccept = defineReceiveMACAcceptEvent( "new_channel", "new channel", events.WithDataType(&ttnpb.MACCommand_NewChannelAns{}), )() EvtReceiveNewChannelReject = defineReceiveMACRejectEvent( "new_channel", "new channel", events.WithDataType(&ttnpb.MACCommand_NewChannelAns{}), )() )
var ( EvtEnqueueProprietaryMACAnswer = defineEnqueueMACAnswerEvent("proprietary", "proprietary MAC command") EvtEnqueueProprietaryMACRequest = defineEnqueueMACRequestEvent("proprietary", "proprietary MAC command") EvtReceiveProprietaryMAC = events.Define( "ns.mac.proprietary.receive", "receive proprietary MAC command", events.WithVisibility(ttnpb.Right_RIGHT_APPLICATION_TRAFFIC_READ), ) EvtClassASwitch = defineClassSwitchEvent('a')() EvtClassBSwitch = defineClassSwitchEvent('b')() EvtClassCSwitch = defineClassSwitchEvent('c')() EvtParseMACCommandFail = events.Define( "ns.mac.command.parse.fail", "failed to parse MAC command", events.WithVisibility(ttnpb.Right_RIGHT_APPLICATION_TRAFFIC_READ), events.WithErrorDataType(), events.WithPropagateToParent(), ) EvtUnknownMACCommand = events.Define( "ns.mac.command.unknown", "unknown MAC command", events.WithVisibility(ttnpb.Right_RIGHT_APPLICATION_TRAFFIC_READ), events.WithDataType(&ttnpb.MACCommand{}), ) EvtProcessMACCommandFail = events.Define( "ns.mac.command.process.fail", "failed to process MAC command", events.WithVisibility(ttnpb.Right_RIGHT_APPLICATION_TRAFFIC_READ), events.WithErrorDataType(), events.WithPropagateToParent(), ) EvtUnansweredMACCommand = events.Define( "ns.mac.command.unanswered", "MAC command answer missing", events.WithVisibility(ttnpb.Right_RIGHT_APPLICATION_TRAFFIC_READ), events.WithDataType(&ttnpb.MACCommands{}), ) )
var ( EvtEnqueuePingSlotChannelRequest = defineEnqueueMACRequestEvent( "ping_slot_channel", "ping slot channel", events.WithDataType(&ttnpb.MACCommand_PingSlotChannelReq{}), )() EvtReceivePingSlotChannelAnswer = defineReceiveMACAcceptEvent( "ping_slot_channel", "ping slot channel", events.WithDataType(&ttnpb.MACCommand_PingSlotChannelAns{}), )() )
var ( EvtEnqueuePingSlotInfoAnswer = defineEnqueueMACAnswerEvent( "ping_slot_info", "ping slot info", )() EvtReceivePingSlotInfoRequest = defineReceiveMACRequestEvent( "ping_slot_info", "ping slot info", events.WithDataType(&ttnpb.MACCommand_PingSlotInfoReq{}), )() )
var ( EvtEnqueueRejoinParamSetupRequest = defineEnqueueMACRequestEvent( "rejoin_param_setup", "rejoin parameter setup", events.WithDataType(&ttnpb.MACCommand_RejoinParamSetupReq{}), )() EvtReceiveRejoinParamSetupAnswer = defineReceiveMACAnswerEvent( "rejoin_param_setup", "rejoin parameter setup", events.WithDataType(&ttnpb.MACCommand_RejoinParamSetupAns{}), )() )
var ( EvtReceiveRekeyIndication = defineReceiveMACIndicationEvent( "rekey", "device rekey", events.WithDataType(&ttnpb.MACCommand_RekeyInd{}), )() EvtEnqueueRekeyConfirmation = defineEnqueueMACConfirmationEvent( "rekey", "device rekey", events.WithDataType(&ttnpb.MACCommand_RekeyConf{}), )() )
var ( EvtReceiveResetIndication = defineReceiveMACIndicationEvent( "reset", "device reset", events.WithDataType(&ttnpb.MACCommand_ResetInd{}), )() EvtEnqueueResetConfirmation = defineEnqueueMACConfirmationEvent( "reset", "device reset", events.WithDataType(&ttnpb.MACCommand_ResetConf{}), )() )
var ( EvtEnqueueRxParamSetupRequest = defineEnqueueMACRequestEvent( "rx_param_setup", "Rx parameter setup", events.WithDataType(&ttnpb.MACCommand_RxParamSetupReq{}), )() EvtReceiveRxParamSetupAccept = defineReceiveMACAcceptEvent( "rx_param_setup", "Rx parameter setup", events.WithDataType(&ttnpb.MACCommand_RxParamSetupAns{}), )() EvtReceiveRxParamSetupReject = defineReceiveMACRejectEvent( "rx_param_setup", "Rx parameter setup", events.WithDataType(&ttnpb.MACCommand_RxParamSetupAns{}), )() )
var ( EvtEnqueueRxTimingSetupRequest = defineEnqueueMACRequestEvent( "rx_timing_setup", "Rx timing setup", events.WithDataType(&ttnpb.MACCommand_RxTimingSetupReq{}), )() EvtReceiveRxTimingSetupAnswer = defineReceiveMACAnswerEvent( "rx_timing_setup", "Rx timing setup", )() )
var ( EvtEnqueueTxParamSetupRequest = defineEnqueueMACRequestEvent( "tx_param_setup", "Tx parameter setup", events.WithDataType(&ttnpb.MACCommand_TxParamSetupReq{}), )() EvtReceiveTxParamSetupAnswer = defineReceiveMACAnswerEvent( "tx_param_setup", "Tx parameter setup", )() )
var ContainsStickyMACCommand = containsAnyMACCommandIdentifier( ttnpb.MACCommandIdentifier_CID_DL_CHANNEL, ttnpb.MACCommandIdentifier_CID_RX_PARAM_SETUP, ttnpb.MACCommandIdentifier_CID_RX_TIMING_SETUP, ttnpb.MACCommandIdentifier_CID_TX_PARAM_SETUP, )
ContainsStickyMACCommand checks if any of the provided MAC command identifiers exhibit sticky behavior. See STICKY.md.
var EvtEnqueueForceRejoinRequest = defineEnqueueMACRequestEvent("force_rejoin", "force rejoin")()
Functions ¶
func AdaptDataRate ¶
func AdaptDataRate(ctx context.Context, dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) error
AdaptDataRate adapts the end device desired ADR parameters based on previous transmissions and device settings.
func CFList ¶ added in v3.25.2
CFList generated by this frequency plan, for the version used by a device. This function returns nil if the CFList could not be computed, or if the device does not support CFLists.
func DeviceADRMargin ¶ added in v3.14.0
func DeviceADRMargin(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) float32
DeviceADRMargin returns the margin to be used by the ADR algorithm.
func DeviceClassBCDownlinkInterval ¶ added in v3.14.2
func DeviceClassBTimeout ¶
func DeviceClassCTimeout ¶
func DeviceDefaultChannels ¶
func DeviceDefaultChannels( dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings, ) []*ttnpb.MACParameters_Channel
func DeviceDefaultLoRaWANVersion ¶
func DeviceDefaultLoRaWANVersion(dev *ttnpb.EndDevice) ttnpb.MACVersion
func DeviceDefaultMaxDutyCycle ¶
func DeviceDefaultMaxDutyCycle(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) ttnpb.AggregatedDutyCycle
func DeviceDefaultPingSlotDataRateIndexValue ¶
func DeviceDefaultPingSlotDataRateIndexValue(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) *ttnpb.DataRateIndexValue
func DeviceDefaultPingSlotPeriodicity ¶
func DeviceDefaultPingSlotPeriodicity(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) *ttnpb.PingSlotPeriodValue
func DeviceDefaultRX1DataRateOffset ¶
func DeviceDefaultRX1DataRateOffset(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) ttnpb.DataRateOffset
func DeviceDefaultRX1Delay ¶
func DeviceDefaultRX2DataRateIndex ¶
func DeviceDefaultRX2DataRateIndex(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) ttnpb.DataRateIndex
func DeviceDesiredADRAckDelayExponent ¶
func DeviceDesiredADRAckDelayExponent(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) *ttnpb.ADRAckDelayExponentValue
func DeviceDesiredADRAckLimitExponent ¶
func DeviceDesiredADRAckLimitExponent(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) *ttnpb.ADRAckLimitExponentValue
func DeviceDesiredChannels ¶
func DeviceDesiredChannels( dev *ttnpb.EndDevice, phy *band.Band, fp *frequencyplans.FrequencyPlan, defaults *ttnpb.MACSettings, ) []*ttnpb.MACParameters_Channel
func DeviceDesiredDownlinkDwellTime ¶
func DeviceDesiredDownlinkDwellTime(phy *band.Band, fp *frequencyplans.FrequencyPlan) *ttnpb.BoolValue
func DeviceDesiredMaxDutyCycle ¶
func DeviceDesiredMaxDutyCycle(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) ttnpb.AggregatedDutyCycle
func DeviceDesiredMaxEIRP ¶
func DeviceDesiredMaxEIRP(dev *ttnpb.EndDevice, phy *band.Band, fp *frequencyplans.FrequencyPlan, defaults *ttnpb.MACSettings) float32
func DeviceDesiredPingSlotDataRateIndexValue ¶
func DeviceDesiredPingSlotDataRateIndexValue(dev *ttnpb.EndDevice, phy *band.Band, fp *frequencyplans.FrequencyPlan, defaults *ttnpb.MACSettings) *ttnpb.DataRateIndexValue
func DeviceDesiredPingSlotFrequency ¶
func DeviceDesiredPingSlotFrequency(dev *ttnpb.EndDevice, phy *band.Band, fp *frequencyplans.FrequencyPlan, defaults *ttnpb.MACSettings) uint64
func DeviceDesiredRX1DataRateOffset ¶
func DeviceDesiredRX1DataRateOffset(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) ttnpb.DataRateOffset
func DeviceDesiredRX1Delay ¶
func DeviceDesiredRX2DataRateIndex ¶
func DeviceDesiredRX2DataRateIndex(dev *ttnpb.EndDevice, phy *band.Band, fp *frequencyplans.FrequencyPlan, defaults *ttnpb.MACSettings) ttnpb.DataRateIndex
func DeviceDesiredRX2Frequency ¶
func DeviceDesiredRX2Frequency(dev *ttnpb.EndDevice, phy *band.Band, fp *frequencyplans.FrequencyPlan, defaults *ttnpb.MACSettings) uint64
func DeviceDesiredUplinkDwellTime ¶
func DeviceDesiredUplinkDwellTime(phy *band.Band, fp *frequencyplans.FrequencyPlan) *ttnpb.BoolValue
func DeviceDownlinkDwellTime ¶ added in v3.18.0
func DeviceExpectedDownlinkDwellTime ¶ added in v3.18.0
func DeviceExpectedDownlinkDwellTime(macState *ttnpb.MACState, fp *frequencyplans.FrequencyPlan, phy *band.Band) bool
func DeviceExpectedUplinkDwellTime ¶ added in v3.18.0
func DeviceExpectedUplinkDwellTime(macState *ttnpb.MACState, fp *frequencyplans.FrequencyPlan, phy *band.Band) bool
func DeviceNeedsDLChannelReq ¶
func DeviceNeedsDevStatusReq ¶
func DeviceNeedsDutyCycleReq ¶
func DeviceNeedsLinkADRReq ¶
func DevicePingSlotFrequency ¶ added in v3.21.2
DevicePingSlotFrequency computes the frequency of the ping slot at time pingAt. If no frequency is found, this function returns 0.
func DeviceResetsFCnt ¶
func DeviceResetsFCnt(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) bool
func DeviceScheduleDownlinks ¶ added in v3.21.0
func DeviceScheduleDownlinks(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) bool
DeviceScheduleDownlinks checks if the Network Server should schedule downlinks for the provided end device.
func DeviceShouldAdaptDataRate ¶ added in v3.19.0
func DeviceShouldAdaptDataRate(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings, phy *band.Band) (adaptDataRate bool, resetDesiredParameters bool, staticSettings *ttnpb.ADRSettings_StaticMode)
DeviceShouldAdaptDataRate returns if the ADR algorithm should be run for the end device.
func DeviceStatusCountPeriodicity ¶ added in v3.14.0
func DeviceStatusCountPeriodicity(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) uint32
func DeviceStatusTimePeriodicity ¶ added in v3.14.0
func DeviceSupports32BitFCnt ¶
func DeviceSupports32BitFCnt(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) bool
func DeviceUplinkDwellTime ¶ added in v3.18.0
func DeviceUseADR ¶
DeviceUseADR returns if the Network Server uses the ADR algorithm for the end device.
func HandleADRParamSetupAns ¶
func HandleBeaconFreqAns ¶
func HandleBeaconTimingReq ¶
func HandleDLChannelAns ¶
func HandleDevStatusAns ¶
func HandleDeviceModeInd ¶
func HandleDeviceTimeReq ¶
func HandleDutyCycleAns ¶
func HandleLinkADRAns ¶
func HandleLinkCheckReq ¶
func HandleNewChannelAns ¶
func HandlePingSlotInfoReq ¶
func HandleRekeyInd ¶
func HandleResetInd ¶
func HandleResetInd(ctx context.Context, dev *ttnpb.EndDevice, pld *ttnpb.MACCommand_ResetInd, fps *frequencyplans.Store, defaults *ttnpb.MACSettings) (events.Builders, error)
func HandleRxParamSetupAns ¶
func HandleRxTimingSetupAns ¶
func HandleTxParamSetupAns ¶
func NewState ¶
func NewState(dev *ttnpb.EndDevice, fps *frequencyplans.Store, defaults *ttnpb.MACSettings) (*ttnpb.MACState, error)
func NextPingSlotAt ¶
func NextPingSlotAt(ctx context.Context, dev *ttnpb.EndDevice, earliestAt time.Time) (time.Time, bool)
NextPingSlotAt returns the exact time instant before or at earliestAt when next ping slot can be open given the data known by Network Server and true, if such time instant exists, otherwise it returns time.Time{} and false.
Types ¶
type EnqueueState ¶
func EnqueueADRParamSetupReq ¶
func EnqueueBeaconFreqReq ¶
func EnqueueDLChannelReq ¶
func EnqueueDevStatusReq ¶
func EnqueueDevStatusReq(ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16, defaults *ttnpb.MACSettings, transmitAt time.Time) EnqueueState
func EnqueueDutyCycleReq ¶
func EnqueueForceRejoinReq ¶
func EnqueueLinkADRReq ¶
func EnqueueNewChannelReq ¶
func EnqueueRxParamSetupReq ¶
func EnqueueRxTimingSetupReq ¶
func EnqueueTxParamSetupReq ¶
Source Files ¶
- adr.go
- adr_legacy.go
- adr_param_setup.go
- beacon_freq.go
- beacon_timing.go
- cflist.go
- dev_status.go
- device_mode.go
- device_time.go
- dl_channel.go
- duty_cycle.go
- errors.go
- force_rejoin.go
- link_adr.go
- link_check.go
- mac.go
- new_channel.go
- observability.go
- ping_slot_channel.go
- ping_slot_info.go
- rejoin_param_setup.go
- rekey.go
- reset.go
- rx_param_setup.go
- rx_timing_setup.go
- tx_param_setup.go
- utils.go