messages

package
v3.7.3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Upstream types for messages from the Gateway.
	TypeUpstreamVersion              = "version"
	TypeUpstreamJoinRequest          = "jreq"
	TypeUpstreamUplinkDataFrame      = "updf"
	TypeUpstreamProprietaryDataFrame = "propdf"
	TypeUpstreamTxConfirmation       = "dntxed"
	TypeUpstreamTimeSync             = "timesync"
	TypeUpstreamRemoteShell          = "rmtsh"

	// Downstream types for messages from the Network
	TypeDownstreamDownlinkMessage           = "dnmsg"
	TypeDownstreamDownlinkMulticastSchedule = "dnsched"
	TypeDownstreamTimeSync                  = "timesync"
	TypeDownstreamRemoteCommand             = "runcmd"
	TypeDownstreamRemoteShell               = "rmtsh"
)

Definition of message types.

Variables

This section is empty.

Functions

func ToTxAcknowledgment

func ToTxAcknowledgment(correlationIDs []string) ttnpb.TxAcknowledgment

ToTxAcknowledgment extracts fields from the basic station TxConfirmation "dntxed" message and converts them into a TxAcknowledgment for the network server.

func Type

func Type(data []byte) (string, error)

Type returns the message type of the given data.

Types

type DiscoverQuery

type DiscoverQuery struct {
	EUI basicstation.EUI `json:"router"`
}

DiscoverQuery contains the unique identifier of the gateway. This message is sent by the gateway.

type DiscoverResponse

type DiscoverResponse struct {
	EUI   basicstation.EUI `json:"router"`
	Muxs  basicstation.EUI `json:"muxs,omitempty"`
	URI   string           `json:"uri,omitempty"`
	Error string           `json:"error,omitempty"`
}

DiscoverResponse contains the response to the discover query. This message is sent by the Gateway Server.

type DownlinkMessage

type DownlinkMessage struct {
	DevEUI      string  `json:"DevEui"`
	DeviceClass uint    `json:"dC"`
	Diid        int64   `json:"diid"`
	Pdu         string  `json:"pdu"`
	RxDelay     int     `json:"RxDelay"`
	Rx1DR       int     `json:"RX1DR"`
	Rx1Freq     int     `json:"RX1Freq"`
	Priority    int     `json:"priority"`
	XTime       int64   `json:"xtime"`
	RCtx        int64   `json:"rctx"`
	MuxTime     float64 `json:"MuxTime"`
}

DownlinkMessage is the LoRaWAN downlink message sent to the basic station.

func FromDownlinkMessage

func FromDownlinkMessage(ids ttnpb.GatewayIdentifiers, rawPayload []byte, scheduledMsg *ttnpb.TxSettings, dlToken int64, dlTime time.Time, xTime int64) DownlinkMessage

FromDownlinkMessage translates the ttnpb.DownlinkMessage to LNS DownlinkMessage "dnmsg".

func (DownlinkMessage) MarshalJSON

func (dnmsg DownlinkMessage) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*DownlinkMessage) ToDownlinkMessage

func (dnmsg *DownlinkMessage) ToDownlinkMessage() ttnpb.DownlinkMessage

ToDownlinkMessage translates the LNS DownlinkMessage "dnmsg" to ttnpb.DownlinkMessage.

type JoinRequest

type JoinRequest struct {
	MHdr     uint             `json:"MHdr"`
	JoinEUI  basicstation.EUI `json:"JoinEui"`
	DevEUI   basicstation.EUI `json:"DevEui"`
	DevNonce uint             `json:"DevNonce"`
	MIC      int32            `json:"MIC"`
	RefTime  float64          `json:"RefTime"`
	RadioMetaData
}

JoinRequest is the LoRaWAN Join Request message from the BasicStation.

func (*JoinRequest) FromUplinkMessage

func (req *JoinRequest) FromUplinkMessage(up *ttnpb.UplinkMessage, bandID string) error

FromUplinkMessage extracts fields from ttnpb.UplinkMessage and creates the Basic Station Join Request Frame.

func (JoinRequest) MarshalJSON

func (req JoinRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*JoinRequest) ToUplinkMessage

func (req *JoinRequest) ToUplinkMessage(ids ttnpb.GatewayIdentifiers, bandID string, receivedAt time.Time) (*ttnpb.UplinkMessage, error)

ToUplinkMessage extracts fields from the basic station Join Request "jreq" message and converts them into an UplinkMessage for the network server.

type RadioMetaData

type RadioMetaData struct {
	DataRate  int    `json:"DR"`
	Frequency uint64 `json:"Freq"`
	UpInfo    UpInfo `json:"upinfo"`
}

RadioMetaData is a the metadata that is received as part of all upstream messages (except Tx Confirmation).

type TxConfirmation

type TxConfirmation struct {
	Diid    int64            `json:"diid"`
	DevEUI  basicstation.EUI `json:"DevEui"`
	RCtx    int64            `json:"rctx"`
	XTime   int64            `json:"xtime"`
	TxTime  float64          `json:"txtime"`
	GpsTime int64            `json:"gpstime"`
	RefTime float64          `json:"RefTime,omitempty"`
}

TxConfirmation is the LoRaWAN Join Request message from the BasicStation.

func (TxConfirmation) MarshalJSON

func (conf TxConfirmation) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

type UpInfo

type UpInfo struct {
	RxTime  float64 `json:"rxtime"`
	RCtx    int64   `json:"rtcx"`
	XTime   int64   `json:"xtime"`
	GPSTime int64   `json:"gpstime"`
	RSSI    float32 `json:"rssi"`
	SNR     float32 `json:"snr"`
}

UpInfo provides additional metadata on each upstream message.

type UplinkDataFrame

type UplinkDataFrame struct {
	MHdr       uint    `json:"MHdr"`
	DevAddr    int32   `json:"DevAddr"`
	FCtrl      uint    `json:"FCtrl"`
	FCnt       uint    `json:"Fcnt"`
	FOpts      string  `json:"FOpts"`
	FPort      int     `json:"FPort"`
	FRMPayload string  `json:"FRMPayload"`
	MIC        int32   `json:"MIC"`
	RefTime    float64 `json:"RefTime"`
	RadioMetaData
}

UplinkDataFrame is the LoRaWAN Uplink message from the BasicStation.

func (*UplinkDataFrame) FromUplinkMessage

func (updf *UplinkDataFrame) FromUplinkMessage(up *ttnpb.UplinkMessage, bandID string) error

FromUplinkMessage extracts fields from ttnpb.UplinkMessage and creates the Basic Station UplinkDataFrame.

func (UplinkDataFrame) MarshalJSON

func (updf UplinkDataFrame) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*UplinkDataFrame) ToUplinkMessage

func (updf *UplinkDataFrame) ToUplinkMessage(ids ttnpb.GatewayIdentifiers, bandID string, receivedAt time.Time) (*ttnpb.UplinkMessage, error)

ToUplinkMessage extracts fields from the basic station Uplink Data Frame "updf" message and converts them into an UplinkMessage for the network server.

type Version

type Version struct {
	Station  string `json:"station"`
	Firmware string `json:"firmware"`
	Package  string `json:"package"`
	Model    string `json:"model"`
	Protocol int    `json:"protocol"`
	Features string `json:"features,omitempty"`
}

Version contains version information. This message is sent by the gateway.

func (Version) IsProduction

func (v Version) IsProduction() bool

IsProduction checks the features field for "prod" and returns true if found. This is then used to set debug options in the router config.

func (Version) MarshalJSON

func (v Version) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

Jump to

Keyboard shortcuts

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