mac

package
v3.30.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 24 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", "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", "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{}),
	)()
	EvtReceivePingSlotChannelAccept = defineReceiveMACAcceptEvent(
		"ping_slot_channel", "ping slot channel",
		events.WithDataType(&ttnpb.MACCommand_PingSlotChannelAns{}),
	)()
	EvtReceivePingSlotChannelReject = defineReceiveMACRejectEvent(
		"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 (
	// EvtEnqueueRelayConfRequest is emitted when a relay configuration request is enqueued.
	EvtEnqueueRelayConfRequest = defineEnqueueMACRequestEvent(
		"relay_conf", "relay configuration",
		events.WithDataType(&ttnpb.MACCommand_RelayConfReq{}),
	)()
	// EvtReceiveRelayConfAccept is emitted when a relay configuration request is accepted.
	EvtReceiveRelayConfAccept = defineReceiveMACAcceptEvent(
		"relay_conf", "relay configuration",
		events.WithDataType(&ttnpb.MACCommand_RelayConfAns{}),
	)()
	// EvtReceiveRelayConfReject is emitted when a relay configuration request is rejected.
	EvtReceiveRelayConfReject = defineReceiveMACRejectEvent(
		"relay_conf", "relay configuration",
		events.WithDataType(&ttnpb.MACCommand_RelayConfAns{}),
	)()
)
View Source
var (

	// EvtEnqueueRelayConfigureFwdLimitRequest is emitted when a relay forward limits configuration request is enqueued.
	EvtEnqueueRelayConfigureFwdLimitRequest = defineEnqueueMACRequestEvent(
		"relay_configure_fwd_limit", "relay configure forward limit",
		events.WithDataType(&ttnpb.MACCommand_RelayConfigureFwdLimitReq{}),
	)()
	// EvtReceiveRelayConfigureFwdLimitAnswer is emitted when a relay forward limits configuration request is answered.
	EvtReceiveRelayConfigureFwdLimitAnswer = defineReceiveMACAnswerEvent(
		"relay_configure_fwd_limit", "relay configure forward limit",
		events.WithDataType(&ttnpb.MACCommand_RelayConfigureFwdLimitAns{}),
	)()
)
View Source
var (
	// EvtEnqueueRelayCtrlUplinkListRequest is emitted when a relay control uplink list request is enqueued.
	EvtEnqueueRelayCtrlUplinkListRequest = defineEnqueueMACRequestEvent(
		"relay_ctrl_uplink_list", "relay control uplink list",
		events.WithDataType(&ttnpb.MACCommand_RelayCtrlUplinkListReq{}),
	)()
	// EvtReceiveRelayCtrlUplinkListAccept is emitted when a relay control uplink list request is accepted.
	EvtReceiveRelayCtrlUplinkListAccept = defineReceiveMACAcceptEvent(
		"relay_ctrl_uplink_list", "relay control uplink list",
		events.WithDataType(&ttnpb.MACCommand_RelayCtrlUplinkListAns{}),
	)()
	// EvtReceiveRelayCtrlUplinkListReject is emitted when a relay control uplink list request is rejected.
	EvtReceiveRelayCtrlUplinkListReject = defineReceiveMACRejectEvent(
		"relay_ctrl_uplink_list", "relay control uplink list",
		events.WithDataType(&ttnpb.MACCommand_RelayCtrlUplinkListAns{}),
	)()
)
View Source
var (
	// EvtEnqueueRelayEndDeviceConfRequest is emitted when a relay end device configuration request is enqueued.
	EvtEnqueueRelayEndDeviceConfRequest = defineEnqueueMACRequestEvent(
		"relay_end_device_conf", "relay end device configuration",
		events.WithDataType(&ttnpb.MACCommand_RelayEndDeviceConfReq{}),
	)()
	// EvtReceiveRelayEndDeviceConfAccept is emitted when a relay end device configuration request is accepted.
	EvtReceiveRelayEndDeviceConfAccept = defineReceiveMACAcceptEvent(
		"relay_end_device_conf", "relay end device configuration",
		events.WithDataType(&ttnpb.MACCommand_RelayEndDeviceConfAns{}),
	)()
	// EvtReceiveRelayEndDeviceConfReject is emitted when a relay end device configuration request is rejected.
	EvtReceiveRelayEndDeviceConfReject = defineReceiveMACRejectEvent(
		"relay_end_device_conf", "relay end device configuration",
		events.WithDataType(&ttnpb.MACCommand_RelayEndDeviceConfAns{}),
	)()
)
View Source
var (

	// EvtEnqueueRelayUpdateUplinkListRequest is emitted when a relay update uplink list request is enqueued.
	EvtEnqueueRelayUpdateUplinkListRequest = defineEnqueueMACRequestEvent(
		"relay_update_uplink_list", "relay update uplink list",
		events.WithDataType(&ttnpb.MACCommand_RelayUpdateUplinkListReq{}),
	)()
	// EvtReceiveRelayUpdateUplinkListAnswer is emitted when a relay update uplink list request is answered.
	EvtReceiveRelayUpdateUplinkListAnswer = defineReceiveMACAnswerEvent(
		"relay_update_uplink_list", "relay update uplink list",
		events.WithDataType(&ttnpb.MACCommand_RelayUpdateUplinkListAns{}),
	)()
)
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")()
View Source
var EvtReceiveRelayNotifyNewEndDeviceIndication = defineReceiveMACIndicationEvent(
	"relay_notify_new_end_device", "relay notify new end device",
)()

EvtReceiveRelayNotifyNewEndDeviceIndication is emitted when a relay notify new end device indication is received.

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 DataRateIndexOverridesOf added in v3.30.0

DataRateIndexOverridesOf returns the per-data rate index overrides of the given dynamic ADR settings.

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 DeviceDefaultRelaySettings added in v3.29.0

func DeviceDefaultRelaySettings(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) *ttnpb.RelaySettings

DeviceDefaultRelaySettings returns the default relay parameters for the given device.

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 DeviceDesiredRelaySettings added in v3.29.0

func DeviceDesiredRelaySettings(dev *ttnpb.EndDevice, defaults *ttnpb.MACSettings) *ttnpb.RelaySettings

DeviceDesiredRelaySettings returns the desired relay parameters for the given device.

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 DeviceNeedsRelayConfReq added in v3.28.1

func DeviceNeedsRelayConfReq(dev *ttnpb.EndDevice) bool

DeviceNeedsRelayConfReq returns true iff the device needs a relay configuration request.

func DeviceNeedsRelayConfigureFwdLimitReq added in v3.28.1

func DeviceNeedsRelayConfigureFwdLimitReq(dev *ttnpb.EndDevice) bool

DeviceNeedsRelayConfigureFwdLimitReq returns true iff the device needs a relay forward limits configuration request.

func DeviceNeedsRelayCtrlUplinkListReq added in v3.28.1

func DeviceNeedsRelayCtrlUplinkListReq(dev *ttnpb.EndDevice) bool

DeviceNeedsRelayCtrlUplinkListReq returns true iff the device needs a relay control uplink list request.

func DeviceNeedsRelayCtrlUplinkListReqAtIndex added in v3.28.1

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

DeviceNeedsRelayCtrlUplinkListReqAtIndex returns true iff the device needs a relay control uplink list request at the given index.

func DeviceNeedsRelayEndDeviceConfReq added in v3.28.1

func DeviceNeedsRelayEndDeviceConfReq(dev *ttnpb.EndDevice) bool

DeviceNeedsRelayEndDeviceConfReq returns true iff the device needs a relay end device configuration request.

func DeviceNeedsRelayUpdateUplinkListReq added in v3.28.1

func DeviceNeedsRelayUpdateUplinkListReq(dev *ttnpb.EndDevice) bool

DeviceNeedsRelayUpdateUplinkListReq returns true iff the device needs a relay update uplink list request.

func DeviceNeedsRelayUpdateUplinkListReqAtIndex added in v3.28.1

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

DeviceNeedsRelayUpdateUplinkListReqAtIndex returns true iff the device needs a relay update uplink list request at the given index.

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 HandleRelayConfAns added in v3.28.1

func HandleRelayConfAns(
	_ context.Context, dev *ttnpb.EndDevice, pld *ttnpb.MACCommand_RelayConfAns,
) (events.Builders, error)

HandleRelayConfAns handles a relay configuration answer.

func HandleRelayConfigureFwdLimitAns added in v3.28.1

func HandleRelayConfigureFwdLimitAns(
	_ context.Context, dev *ttnpb.EndDevice, pld *ttnpb.MACCommand_RelayConfigureFwdLimitAns,
) (events.Builders, error)

HandleRelayConfigureFwdLimitAns handles a relay forward limits configuration answer.

func HandleRelayCtrlUplinkListAns added in v3.28.1

func HandleRelayCtrlUplinkListAns(
	_ context.Context, dev *ttnpb.EndDevice, pld *ttnpb.MACCommand_RelayCtrlUplinkListAns,
) (events.Builders, error)

HandleRelayCtrlUplinkListAns handles a relay control uplink list answer.

func HandleRelayEndDeviceConfAns added in v3.28.1

func HandleRelayEndDeviceConfAns(
	_ context.Context, dev *ttnpb.EndDevice, pld *ttnpb.MACCommand_RelayEndDeviceConfAns,
) (events.Builders, error)

HandleRelayEndDeviceConfAns handles a relay end device configuration answer.

func HandleRelayNotifyNewEndDeviceReq added in v3.28.1

func HandleRelayNotifyNewEndDeviceReq(
	_ context.Context, _ *ttnpb.EndDevice, pld *ttnpb.MACCommand_RelayNotifyNewEndDeviceReq,
) (events.Builders, error)

HandleRelayNotifyNewEndDeviceReq handles a relay notify new end device request.

func HandleRelayUpdateUplinkListAns added in v3.28.1

func HandleRelayUpdateUplinkListAns(
	_ context.Context, dev *ttnpb.EndDevice, pld *ttnpb.MACCommand_RelayUpdateUplinkListAns,
) (events.Builders, error)

HandleRelayUpdateUplinkListAns handles a relay update uplink list answer.

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.

func RelayParametersFromRelaySettings added in v3.29.0

func RelayParametersFromRelaySettings(settings *ttnpb.RelaySettings, phy *band.Band) *ttnpb.RelayParameters

RelayParametersFromRelaySettings returns the relay parameters for the given settings.

func ServedRelayParametersFromServedRelaySettings added in v3.29.0

func ServedRelayParametersFromServedRelaySettings(
	settings *ttnpb.ServedRelaySettings, phy *band.Band,
) *ttnpb.ServedRelayParameters

ServedRelayParametersFromServedRelaySettings returns the served relay parameters for the given settings.

func ServingRelayParametersFromServingRelaySettings added in v3.29.0

func ServingRelayParametersFromServingRelaySettings(
	settings *ttnpb.ServingRelaySettings,
) *ttnpb.ServingRelayParameters

ServingRelayParametersFromServingRelaySettings returns the serving relay parameters for the given settings.

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 EnqueueRelayConfReq added in v3.28.1

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

EnqueueRelayConfReq enqueues a relay configuration request if needed.

func EnqueueRelayConfigureFwdLimitReq added in v3.28.1

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

EnqueueRelayConfigureFwdLimitReq enqueues a relay forward limits configuration request if needed.

func EnqueueRelayCtrlUplinkListReq added in v3.28.1

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

EnqueueRelayCtrlUplinkListReq enqueues a relay control uplink list request.

func EnqueueRelayEndDeviceConfReq added in v3.28.1

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

EnqueueRelayEndDeviceConfReq enqueues a relay end device configuration request if needed.

func EnqueueRelayUpdateUplinkListReq added in v3.28.1

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

EnqueueRelayUpdateUplinkListReq enqueues a relay update uplink list request.

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

type RelayKeyService added in v3.28.1

type RelayKeyService interface {
	// BatchDeriveRootWorSKey derives the RootWorSKey for the provided end devices.
	// For devices with a pending session, the derived RootWorSKey is derived rom the
	// pending NwkSEncKey. For devices with an active session, the derived RootWorSKey
	// is derived from the active NwkSEncKey.
	BatchDeriveRootWorSKey(
		ctx context.Context, appID *ttnpb.ApplicationIdentifiers, deviceIDs []string, sessionKeyIDs [][]byte,
	) (devAddrs []*types.DevAddr, keys []*types.AES128Key, err error)
}

RelayKeyService provides common relay related cryptographic operations.

Jump to

Keyboard shortcuts

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