util

package
v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2016 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForceRefreshToken

func ForceRefreshToken(ctx log.Interface)

ForceRefreshToken forces a refresh of the access token

func GetAccount

func GetAccount(ctx log.Interface) *account.Account

GetAccount gets a new Account server client for ttnctl

func GetAppEUI

func GetAppEUI(ctx log.Interface) types.AppEUI

GetAppEUI returns the AppEUI that must be set in the command options or config

func GetAppID

func GetAppID(ctx log.Interface) string

GetAppID returns the AppID that must be set in the command options or config

func GetConfigFile

func GetConfigFile() string

GetConfigFile returns the location of the configuration file. It checks the following (in this order): the --config flag $XDG_CONFIG_HOME/ttnctl/config.yml (if $XDG_CONFIG_HOME is set) $HOME/.ttnctl.yml

func GetContext

func GetContext(ctx log.Interface, extraPairs ...string) context.Context

GetContext returns a new context

func GetDataDir

func GetDataDir() string

GetDataDir returns the location of the data directory used for sotring data. It checks the following (in this order): the --data flag $XDG_DATA_HOME/ttnctl (if $XDG_DATA_HOME is set) $XDG_CACHE_HOME/ttnctl (if $XDG_CACHE_HOME is set) $HOME/.ttnctl

func GetDiscovery

func GetDiscovery(ctx log.Interface) (*grpc.ClientConn, discovery.DiscoveryClient)

GetDiscovery gets the Discovery client for ttnctl

func GetGatewayMetadata

func GetGatewayMetadata(id string, freq uint64) *gateway.RxMetadata

GetGatewayMetadata returns gateway metadata for the given gateway ID and frequency

func GetHandlerManager

func GetHandlerManager(ctx log.Interface, appID string) (*grpc.ClientConn, *handler.ManagerClient)

GetHandlerManager gets a new HandlerManager for ttnctl

func GetID

func GetID() string

GetID retrns the ID of this ttnctl

func GetMQTT

func GetMQTT(ctx log.Interface) mqtt.Client

GetMQTT connects a new MQTT clients with the specified credentials

func GetProtocolMetadata

func GetProtocolMetadata(dataRate string) *protocol.RxMetadata

GetProtocolMetadata returns protocol metadata for the given datarate

func GetRouter

func GetRouter(ctx log.Interface) (*grpc.ClientConn, router.RouterClient)

GetRouter starts a connection with the router

func GetRouterManager

func GetRouterManager(ctx log.Interface) (*grpc.ClientConn, router.RouterManagerClient)

GetRouterManager starts a management connection with the router

func GetTokenCache

func GetTokenCache() cache.Cache

GetCache get's the cache that will store our tokens

func GetTokenManager

func GetTokenManager(accessToken string) tokens.Manager

func GetTokenSource

func GetTokenSource(ctx log.Interface) oauth2.TokenSource

GetTokenSource builds a new oauth2.TokenSource that uses the ttnctl config to store the token

func GetUserAgent

func GetUserAgent() string

func Login

func Login(ctx log.Interface, code string) (*oauth2.Token, error)

Login does a login to the Account server with the given username and password

func Logout

func Logout() error

func ParseLocation

func ParseLocation(locationStr string) (*account.Location, error)

func PrintConfig

func PrintConfig(ctx log.Interface, debug bool)

func SetApp

func SetApp(ctx log.Interface, appID string, appEUI types.AppEUI)

SetApp stores the app ID and app EUI preferences

func SetAppEUI

func SetAppEUI(ctx log.Interface, appEUI types.AppEUI)

SetApp stores the app EUI preference

func TokenForScope

func TokenForScope(ctx log.Interface, scope string) string

Types

type Message

type Message struct {
	FCnt  int
	FPort int

	Payload []byte
	// contains filtered or unexported fields
}

Message struct is used to construct an uplink message

func (*Message) Bytes

func (m *Message) Bytes() []byte

Bytes returns the bytes

func (*Message) SetDevice

func (m *Message) SetDevice(devAddr types.DevAddr, nwkSKey types.NwkSKey, appSKey types.AppSKey)

SetDevice with the LoRaWAN options

func (*Message) SetMessage

func (m *Message) SetMessage(confirmed bool, fCnt int, payload []byte)

SetMessage with some options

func (*Message) Unmarshal

func (m *Message) Unmarshal(bytes []byte) error

Unmarshal a byte slice into a Message

Jump to

Keyboard shortcuts

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