pktfwd

package
v2.0.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2017 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchConfig

func FetchConfig(ctx log.Interface, ttnConfig *TTNConfig) (*util.Config, error)

FetchConfig reads the configuration from the distant server

func NewMultipleBootTimeSetter

func NewMultipleBootTimeSetter() multipleBootTimeSetter

func ResetPin

func ResetPin(pinNumber int) error

ResetPin resets the specified pin

func Run

func Run(ctx log.Interface, conf util.Config, ttnConfig TTNConfig, gpsPath string) error

Init initiates the configuration, the network connection, and handles the manager

Types

type BootTimeSetter

type BootTimeSetter interface {
	SetBootTime(t time.Time)
}

BootTimeSetter is an interface that implements every type that needs receive boot time (mostly to determine uptime afterwards)

type DownlinkManager

type DownlinkManager interface {
	BootTimeSetter
	ScheduleDownlink(d *router.DownlinkMessage)
}

DownlinkManager is an interface that starts scheduling every downlink that is given to it

func NewDownlinkManager

func NewDownlinkManager(bgCtx context.Context, ctx log.Interface, conf util.Config, statusMgr StatusManager, sendingTimeMargin time.Duration) DownlinkManager

NewDownlinkManager returns a new downlink manager that runs as long as the context doesn't close

type Manager

type Manager struct {
	// contains filtered or unexported fields
}
Manager struct manages the routines during runtime, once the gateways and network

configuration have been set up. It startes a routine, that it only stopped when the users wants to close the program or that an error occurs.

func NewManager

func NewManager(ctx log.Interface, conf util.Config, netClient NetworkClient, gpsPath string, runConfig TTNConfig) Manager

type NetworkClient

type NetworkClient interface {
	SendStatus(status gateway.Status) error
	SendUplinks(messages []router.UplinkMessage)
	FrequencyPlan() string
	Downlinks() <-chan *router.DownlinkMessage
	GatewayID() string
	Ping() (time.Duration, error)
	DefaultLocation() *account.AntennaLocation
	Stop()
	RefreshRoutine(ctx context.Context) error
}

func CreateNetworkClient

func CreateNetworkClient(ctx log.Interface, ttnConfig TTNConfig) (NetworkClient, error)

type RouterHealthCheck

type RouterHealthCheck struct {
	Conn     *grpc.ClientConn
	Duration time.Duration
	Err      error
}

type StatusManager

type StatusManager interface {
	BootTimeSetter
	HandledRXBatch(received, valid int)
	ReceivedTX()
	SentTX()
	GenerateStatus(rtt time.Duration) (*gateway.Status, error)
}

func NewStatusManager

func NewStatusManager(ctx log.Interface, frequencyPlan string, gatewayDescription string, isGPSChip bool, antennaLocation *account.AntennaLocation) StatusManager

type TTNClient

type TTNClient struct {
	// contains filtered or unexported fields
}

func (*TTNClient) DefaultLocation

func (c *TTNClient) DefaultLocation() *account.AntennaLocation
func (c *TTNClient) Downlinks() <-chan *router.DownlinkMessage

func (*TTNClient) FrequencyPlan

func (c *TTNClient) FrequencyPlan() string

func (*TTNClient) GatewayID

func (c *TTNClient) GatewayID() string

func (*TTNClient) Ping

func (c *TTNClient) Ping() (time.Duration, error)

func (*TTNClient) RefreshRoutine

func (c *TTNClient) RefreshRoutine(ctx context.Context) error

func (*TTNClient) SendStatus

func (c *TTNClient) SendStatus(status gateway.Status) error
func (c *TTNClient) SendUplinks(messages []router.UplinkMessage)

func (*TTNClient) Stop

func (c *TTNClient) Stop()

Stop a running network client

type TTNConfig

type TTNConfig struct {
	ID                  string
	Key                 string
	AuthServer          string
	DiscoveryServer     string
	Router              string
	Version             string
	GatewayDescription  string
	DownlinksSendMargin time.Duration
	IgnoreCRC           bool
}

Jump to

Keyboard shortcuts

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