mac

package
v3.27.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2023 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

View Source
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
)
View Source
const (
	DefaultStatusCountPeriodicity uint32 = 200
	DefaultStatusTimePeriodicity         = 24 * time.Hour
)
View Source
const (
	BeaconPeriod = 128 * time.Second
)
View Source
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.

View Source
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

View Source
var (
	EvtEnqueueADRParamSetupRequest = defineEnqueueMACRequestEvent(
		"adr_param_setup", "ADR parameter setup",
		events.WithDataType(&ttnpb.MACCommand_ADRParamSetupReq{}),
	)()
	EvtReceiveADRParamSetupAnswer = defineReceiveMACAnswerEvent(
		"adr_param_setup", "ADR parameter setup",
	)()
)
View Source
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{}),
	)()
)
View Source
var (
	EvtEnqueueDevStatusRequest = defineEnqueueMACRequestEvent(
		"dev_status", "device status",
	)()
	EvtReceiveDevStatusAnswer = defineReceiveMACAnswerEvent(
		"dev_status", "device status",
		events.WithDataType(&ttnpb.MACCommand_DevStatusAns{}),
	)()
)
View Source
var (
	EvtReceiveDeviceModeIndication = defineReceiveMACIndicationEvent(
		"device_mode", "device mode",
		events.WithDataType(&ttnpb.MACCommand_DeviceModeInd{}),
	)()
	EvtEnqueueDeviceModeConfirmation = defineEnqueueMACConfirmationEvent(
		"device_mode", "device mode",
		events.WithDataType(&ttnpb.MACCommand_DeviceModeConf{}),
	)()
)
View Source
var (
	EvtReceiveDeviceTimeRequest = defineReceiveMACRequestEvent(
		"device_time", "device time",
	)()
	EvtEnqueueDeviceTimeAnswer = defineEnqueueMACAnswerEvent(
		"device_time", "device time",
		events.WithData(&ttnpb.MACCommand_DeviceTimeAns{}),
	)()
)
View Source
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{}),
	)()
)
View Source
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",
	)()
)
View Source
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")
)
View Source
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{}),
	)()
)
View Source
var (
	EvtReceiveLinkCheckRequest = defineReceiveMACRequestEvent(
		"link_check", "link check",
	)()
	EvtEnqueueLinkCheckAnswer = defineEnqueueMACAnswerEvent(
		"link_check", "link check",
		events.WithDataType(&ttnpb.MACCommand_LinkCheckAns{}),
	)()
)
View Source
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{}),
	)()
)
View Source
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{}),
	)
)
View Source
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{}),
	)()
)
View Source
var (
	EvtEnqueuePingSlotInfoAnswer = defineEnqueueMACAnswerEvent(
		"ping_slot_info", "ping slot info",
	)()
	EvtReceivePingSlotInfoRequest = defineReceiveMACRequestEvent(
		"ping_slot_info", "ping slot info",
		events.WithDataType(&ttnpb.MACCommand_PingSlotInfoReq{}),
	)()
)
View Source
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{}),
	)()
)
View Source
var (
	EvtReceiveRekeyIndication = defineReceiveMACIndicationEvent(
		"rekey", "device rekey",
		events.WithDataType(&ttnpb.MACCommand_RekeyInd{}),
	)()
	EvtEnqueueRekeyConfirmation = defineEnqueueMACConfirmationEvent(
		"rekey", "device rekey",
		events.WithDataType(&ttnpb.MACCommand_RekeyConf{}),
	)()
)
View Source
var (
	EvtReceiveResetIndication = defineReceiveMACIndicationEvent(
		"reset", "device reset",
		events.WithDataType(&ttnpb.MACCommand_ResetInd{}),
	)()
	EvtEnqueueResetConfirmation = defineEnqueueMACConfirmationEvent(
		"reset", "device reset",
		events.WithDataType(&ttnpb.MACCommand_ResetConf{}),
	)()
)
View Source
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{}),
	)()
)
View Source
var (
	EvtEnqueueRxTimingSetupRequest = defineEnqueueMACRequestEvent(
		"rx_timing_setup", "Rx timing setup",
		events.WithDataType(&ttnpb.MACCommand_RxTimingSetupReq{}),
	)()
	EvtReceiveRxTimingSetupAnswer = defineReceiveMACAnswerEvent(
		"rx_timing_setup", "Rx timing setup",
	)()
)
View Source
var (
	EvtEnqueueTxParamSetupRequest = defineEnqueueMACRequestEvent(
		"tx_param_setup", "Tx parameter setup",
		events.WithDataType(&ttnpb.MACCommand_TxParamSetupReq{}),
	)()
	EvtReceiveTxParamSetupAnswer = defineReceiveMACAnswerEvent(
		"tx_param_setup", "Tx parameter setup",
	)()
)

ContainsStickyMACCommand checks if any of the provided MAC command identifiers exhibit sticky behavior. See STICKY.md.

View Source
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

func CFList(phy *band.Band, channels ...*ttnpb.MACParameters_Channel) *ttnpb.CFList

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 DeviceClassBCDownlinkInterval(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) time.Duration

func DeviceClassBTimeout

func DeviceClassBTimeout(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) time.Duration

func DeviceClassCTimeout

func DeviceClassCTimeout(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) time.Duration

func DeviceDefaultBeaconFrequency

func DeviceDefaultBeaconFrequency(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) uint64

func DeviceDefaultChannels

func DeviceDefaultChannels(
	dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings,
) []*ttnpb.MACParameters_Channel

func DeviceDefaultClass

func DeviceDefaultClass(dev *ttnpb.EndDevice) (ttnpb.Class, error)

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 DeviceDefaultPingSlotFrequency

func DeviceDefaultPingSlotFrequency(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) uint64

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 DeviceDefaultRX1Delay(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) ttnpb.RxDelay

func DeviceDefaultRX2DataRateIndex

func DeviceDefaultRX2DataRateIndex(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) ttnpb.DataRateIndex

func DeviceDefaultRX2Frequency

func DeviceDefaultRX2Frequency(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) uint64

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 DeviceDesiredBeaconFrequency

func DeviceDesiredBeaconFrequency(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) uint64

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 DeviceDesiredRX1Delay(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) ttnpb.RxDelay

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 DeviceDownlinkDwellTime(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) *ttnpb.BoolValue

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 DeviceNeedsADRParamSetupReq

func DeviceNeedsADRParamSetupReq(dev *ttnpb.EndDevice, phy *band.Band) bool

func DeviceNeedsBeaconFreqReq

func DeviceNeedsBeaconFreqReq(dev *ttnpb.EndDevice) bool

func DeviceNeedsBeaconTimingReq

func DeviceNeedsBeaconTimingReq(dev *ttnpb.EndDevice) bool

func DeviceNeedsDLChannelReq

func DeviceNeedsDLChannelReq(dev *ttnpb.EndDevice, phy *band.Band) bool

func DeviceNeedsDLChannelReqAtIndex

func DeviceNeedsDLChannelReqAtIndex(dev *ttnpb.EndDevice, i int) bool

func DeviceNeedsDevStatusReq

func DeviceNeedsDevStatusReq(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings, transmitAt time.Time) bool

func DeviceNeedsDevStatusReqAt

func DeviceNeedsDevStatusReqAt(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) (time.Time, bool)

func DeviceNeedsDutyCycleReq

func DeviceNeedsDutyCycleReq(dev *ttnpb.EndDevice) bool

func DeviceNeedsLinkADRReq

func DeviceNeedsLinkADRReq(ctx context.Context, dev *ttnpb.EndDevice, phy *band.Band) bool

func DeviceNeedsNewChannelReq

func DeviceNeedsNewChannelReq(dev *ttnpb.EndDevice, phy *band.Band) bool

func DeviceNeedsNewChannelReqAtIndex

func DeviceNeedsNewChannelReqAtIndex(dev *ttnpb.EndDevice, i int) bool

func DeviceNeedsPingSlotChannelReq

func DeviceNeedsPingSlotChannelReq(dev *ttnpb.EndDevice) bool

func DeviceNeedsRejoinParamSetupReq

func DeviceNeedsRejoinParamSetupReq(dev *ttnpb.EndDevice) bool

func DeviceNeedsRxParamSetupReq

func DeviceNeedsRxParamSetupReq(dev *ttnpb.EndDevice) bool

func DeviceNeedsRxTimingSetupReq

func DeviceNeedsRxTimingSetupReq(dev *ttnpb.EndDevice) bool

func DeviceNeedsTxParamSetupReq

func DeviceNeedsTxParamSetupReq(dev *ttnpb.EndDevice, phy *band.Band) bool

func DevicePingSlotFrequency added in v3.21.2

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

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(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 DeviceStatusTimePeriodicity(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) time.Duration

func DeviceSupports32BitFCnt

func DeviceSupports32BitFCnt(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) bool

func DeviceUplinkDwellTime added in v3.18.0

func DeviceUplinkDwellTime(dev *ttnpb.EndDevice, phy *band.Band, defaults *ttnpb.MACSettings) *ttnpb.BoolValue

func DeviceUseADR

func DeviceUseADR(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings, phy *band.Band) bool

DeviceUseADR returns if the Network Server uses the ADR algorithm for the end device.

func HandleADRParamSetupAns

func HandleADRParamSetupAns(ctx context.Context, dev *ttnpb.EndDevice) (events.Builders, error)

func HandleBeaconTimingReq

func HandleBeaconTimingReq(ctx context.Context, dev *ttnpb.EndDevice) (events.Builders, error)

func HandleDevStatusAns

func HandleDevStatusAns(ctx context.Context, dev *ttnpb.EndDevice, pld *ttnpb.MACCommand_DevStatusAns, fCntUp uint32, recvAt time.Time) (events.Builders, error)

func HandleDeviceTimeReq

func HandleDeviceTimeReq(ctx context.Context, dev *ttnpb.EndDevice, msg *ttnpb.UplinkMessage) (events.Builders, error)

func HandleDutyCycleAns

func HandleDutyCycleAns(ctx context.Context, dev *ttnpb.EndDevice) (events.Builders, error)

func HandleLinkADRAns

func HandleLinkADRAns(
	ctx context.Context,
	dev *ttnpb.EndDevice,
	pld *ttnpb.MACCommand_LinkADRAns,
	dupCount uint,
	fCntUp uint32,
	fps *frequencyplans.Store,
) (events.Builders, error)

func HandleLinkCheckReq

func HandleLinkCheckReq(ctx context.Context, dev *ttnpb.EndDevice, msg *ttnpb.UplinkMessage) (events.Builders, error)

func HandleRekeyInd

func HandleRekeyInd(ctx context.Context, dev *ttnpb.EndDevice, pld *ttnpb.MACCommand_RekeyInd, devAddr types.DevAddr) (events.Builders, error)

func HandleRxTimingSetupAns

func HandleRxTimingSetupAns(ctx context.Context, dev *ttnpb.EndDevice) (events.Builders, error)

func HandleTxParamSetupAns

func HandleTxParamSetupAns(ctx context.Context, dev *ttnpb.EndDevice) (events.Builders, error)

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

type EnqueueState struct {
	MaxDownLen, MaxUpLen uint16
	QueuedEvents         events.Builders
	Ok                   bool
}

func EnqueueADRParamSetupReq

func EnqueueADRParamSetupReq(ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16, phy *band.Band) EnqueueState

func EnqueueBeaconFreqReq

func EnqueueBeaconFreqReq(ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16) EnqueueState

func EnqueueDLChannelReq

func EnqueueDLChannelReq(
	ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16, phy *band.Band,
) EnqueueState

func EnqueueDevStatusReq

func EnqueueDevStatusReq(ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16, defaults *ttnpb.MACSettings, transmitAt time.Time) EnqueueState

func EnqueueDutyCycleReq

func EnqueueDutyCycleReq(ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16) EnqueueState

func EnqueueForceRejoinReq

func EnqueueForceRejoinReq(ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16) EnqueueState

func EnqueueLinkADRReq

func EnqueueLinkADRReq(
	ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16, phy *band.Band,
) (EnqueueState, error)

func EnqueueNewChannelReq

func EnqueueNewChannelReq(
	ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16, phy *band.Band,
) EnqueueState

func EnqueuePingSlotChannelReq

func EnqueuePingSlotChannelReq(ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16) EnqueueState

func EnqueueRejoinParamSetupReq

func EnqueueRejoinParamSetupReq(ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16) EnqueueState

func EnqueueRxParamSetupReq

func EnqueueRxParamSetupReq(ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16) EnqueueState

func EnqueueRxTimingSetupReq

func EnqueueRxTimingSetupReq(ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16) EnqueueState

func EnqueueTxParamSetupReq

func EnqueueTxParamSetupReq(ctx context.Context, dev *ttnpb.EndDevice, maxDownLen, maxUpLen uint16, phy *band.Band) EnqueueState

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL