structs

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: Apache-2.0, MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownlinkTransmittedToProto

func DownlinkTransmittedToProto(gatewayID lorawan.EUI64, dt DownlinkTransmitted) (gw.DownlinkTxAck, error)

DownlinkTransmittedToProto converts the DownlinkTransmitted to the protobuf struct.

func JoinRequestToProto

func JoinRequestToProto(loraBand band.Band, gatewayID lorawan.EUI64, jr JoinRequest) (*gw.UplinkFrame, error)

JoinRequestToProto converts the JoinRequest to the protobuf struct.

func SetRadioMetaDataToProto

func SetRadioMetaDataToProto(loraBand band.Band, gatewayID lorawan.EUI64, rmd RadioMetaData, pb *gw.UplinkFrame) error

SetRadioMetaDataToProto sets the given parameters to the given protobuf struct.

func UplinkDataFrameToProto

func UplinkDataFrameToProto(loraBand band.Band, gatewayID lorawan.EUI64, updf UplinkDataFrame) (*gw.UplinkFrame, error)

UplinkDataFrameToProto converts the UplinkDataFrame to the protobuf struct.

func UplinkProprietaryFrameToProto

func UplinkProprietaryFrameToProto(loraBand band.Band, gatewayID lorawan.EUI64, uppf UplinkProprietaryFrame) (*gw.UplinkFrame, error)

UplinkProprietaryFrameToProto converts the UplinkProprietaryFrame to the protobuf struct.

Types

type DownlinkFrame

type DownlinkFrame struct {
	MessageType MessageType `json:"msgtype"`

	DevEui   string  `json:"DevEui"`
	DC       int     `json:"dC"`
	DIID     uint32  `json:"diid"`
	PDU      string  `json:"pdu"`
	Priority int     `json:"priority"`
	RxDelay  *int    `json:"RxDelay,omitempty"`
	RX1DR    *int    `json:"RX1DR,omitempty"`
	RX1Freq  *uint32 `json:"RX1Freq,omitempty"`
	RX2DR    *int    `json:"RX2DR,omitempty"`
	RX2Freq  *uint32 `json:"RX2Freq,omitempty"`
	DR       *int    `json:"DR,omitempty"`
	Freq     *uint32 `json:"Freq,omitempty"`
	GPSTime  *uint64 `json:"gpstime,omitempty"`
	XTime    *uint64 `json:"xtime,omitempty"`
	RCtx     *uint64 `json:"rctx,omitempty"`
}

DownlinkFrame implements the downlink message.

func DownlinkFrameFromProto

func DownlinkFrameFromProto(loraBand band.Band, pb *gw.DownlinkFrame) (DownlinkFrame, error)

DownlinkFrameFromProto convers the given protobuf message to a DownlinkFrame.

type DownlinkTransmitted

type DownlinkTransmitted struct {
	MessageType MessageType `json:"msgtype"`

	DIID uint32 `json:"diid"`
}

DownlinkTransmitted implements the downlink transmitted message.

type EUI64

type EUI64 lorawan.EUI64

EUI64 implements the BasicStation EUI64 type.

func (EUI64) MarshalText

func (e EUI64) MarshalText() ([]byte, error)

MarshalText encodes the EUI64 to a ID6 string.

func (*EUI64) UnmarshalText

func (e *EUI64) UnmarshalText(text []byte) error

UnmarshalText decodes the EUI64 from an ID6 or EUI string.

type JoinRequest

type JoinRequest struct {
	RadioMetaData

	MessageType MessageType `json:"msgType"`
	MHDR        uint8       `json:"Mhdr"`
	JoinEUI     EUI64       `json:"JoinEui"`
	DevEUI      EUI64       `json:"DevEui"`
	DevNonce    uint16      `json:"DevNonce"`
	MIC         int32       `json:"MIC"`
}

JoinRequest implements the join-request message.

type MessageType

type MessageType string

MessageType defines the message type.

const (
	VersionMessage              MessageType = "version"
	RouterConfigMessage         MessageType = "router_config"
	JoinRequestMessage          MessageType = "jreq"
	UplinkDataFrameMessage      MessageType = "updf"
	ProprietaryDataFrameMessage MessageType = "propdf"
	DownlinkMessage             MessageType = "dnmsg"
	DownlinkTransmittedMessage  MessageType = "dntxed"
	TimeSyncMessage             MessageType = "timesync"
)

Message types.

func GetMessageType

func GetMessageType(b []byte) (MessageType, error)

GetMessageType returns the message type for the given paylaod.

type RadioMetaData

type RadioMetaData struct {
	DR        int                 `json:"DR"`
	Frequency uint32              `json:"Freq"`
	UpInfo    RadioMetaDataUpInfo `json:"upinfo"`
}

RadioMetaData contains the radio meta-data.

type RadioMetaDataUpInfo

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

RadioMetaDataUpInfo contains the radio meta-data uplink info.

type RouterConfig

type RouterConfig struct {
	MessageType MessageType  `json:"msgtype"`
	NetID       []uint32     `json:"NetID"`
	JoinEui     [][]uint64   `json:"JoinEui"`
	Region      string       `json:"region"`
	HWSpec      string       `json:"hwspec"`
	FreqRange   []uint32     `json:"freq_range"`
	DRs         [][]int      `json:"DRs"`
	SX1301Conf  []SX1301Conf `json:"sx1301_conf"`
}

RouterConfig implements the router-config message.

func GetRouterConfig

func GetRouterConfig(region band.Name, netIDs []lorawan.NetID, joinEUIs [][2]lorawan.EUI64, freqMin, freqMax uint32, concentrators []config.BasicStationConcentrator) (RouterConfig, error)

GetRouterConfig returns the router-config message.

type RouterInfoRequest

type RouterInfoRequest struct {
	Router EUI64 `json:"router"`
}

RouterInfoRequest implements the router-info request.

type RouterInfoResponse

type RouterInfoResponse struct {
	Router EUI64  `json:"router"`
	Muxs   EUI64  `json:"muxs"`
	URI    string `json:"uri"`
	Error  string `json:"error,omitempty"` // only in case of error
}

RouterInfoResponse implements the router-info response.

type SX1301Conf

type SX1301Conf struct {
	Radio0       SX1301ConfRadio       `json:"radio_0"`
	Radio1       SX1301ConfRadio       `json:"radio_1"`
	ChanFSK      SX1301ConfChanFSK     `json:"chan_FSK"`
	ChanLoRaStd  SX1301ConfChanLoRaStd `json:"chan_Lora_std"`
	ChanMultiSF0 SX1301ConfChanMultiSF `json:"chan_multiSF_0"`
	ChanMultiSF1 SX1301ConfChanMultiSF `json:"chan_multiSF_1"`
	ChanMultiSF2 SX1301ConfChanMultiSF `json:"chan_multiSF_2"`
	ChanMultiSF3 SX1301ConfChanMultiSF `json:"chan_multiSF_3"`
	ChanMultiSF4 SX1301ConfChanMultiSF `json:"chan_multiSF_4"`
	ChanMultiSF5 SX1301ConfChanMultiSF `json:"chan_multiSF_5"`
	ChanMultiSF6 SX1301ConfChanMultiSF `json:"chan_multiSF_6"`
	ChanMultiSF7 SX1301ConfChanMultiSF `json:"chan_multiSF_7"`
}

SX1301Conf implements a single SX1301 configuration.

type SX1301ConfChanFSK

type SX1301ConfChanFSK struct {
	Enable bool `json:"enable"`
}

SX1301ConfChanFSK implements the FSK channel configuration.

type SX1301ConfChanLoRaStd

type SX1301ConfChanLoRaStd struct {
	Enable          bool   `json:"enable"`
	Radio           int    `json:"radio"`
	IF              int    `json:"if"`
	Bandwidth       uint32 `json:"bandwidth,omitempty"`
	SpreadingFactor uint32 `json:"spread_factor,omitempty"`
}

SX1301ConfChanLoRaStd implements the LoRa (single SF) configuration.

type SX1301ConfChanMultiSF

type SX1301ConfChanMultiSF struct {
	Enable bool `json:"enable"`
	Radio  int  `json:"radio"`
	IF     int  `json:"if"`
}

SX1301ConfChanMultiSF implements the LoRa multi SF configuration.

type SX1301ConfRadio

type SX1301ConfRadio struct {
	Enable bool   `json:"enable"`
	Freq   uint32 `json:"freq"`
}

SX1301ConfRadio implements a SX1301 radio configuration.

type TimeSyncGPSTimeTransfer

type TimeSyncGPSTimeTransfer struct {
	MessageType MessageType `json:"msgtype"`
	XTime       uint64      `json:"xtime"`
	GPSTime     int64       `json:"gpstime"`
}

TimeSyncGPSTimeTransfer implements the GPS time transfer that is initiated by the NS.

type TimeSyncRequest

type TimeSyncRequest struct {
	MessageType MessageType `json:"msgtype"`
	TxTime      int64       `json:"txtime"`
}

TimeSyncRequest implements the router-info request.

type TimeSyncResponse

type TimeSyncResponse struct {
	MessageType MessageType `json:"msgtype"`
	TxTime      int64       `json:"txtime"`
	GPSTime     int64       `json:"gpstime"`
}

TimeSyncResponse implements the router-info response.

type UplinkDataFrame

type UplinkDataFrame struct {
	RadioMetaData

	MessageType MessageType `json:"msgtype"`
	MHDR        uint8       `json:"Mhdr"`
	DevAddr     int32       `json:"DevAddr"`
	FCtrl       uint8       `json:"FCtrl"`
	FCnt        uint16      `json:"FCnt"`
	FOpts       string      `json:"FOpts"`
	FPort       int         `json:"FPort"`
	FRMPayload  string      `json:"FRMPayload"`
	MIC         int32       `json:"MIC"`
}

UplinkDataFrame implements the uplink data-frame message.

type UplinkProprietaryFrame

type UplinkProprietaryFrame struct {
	RadioMetaData

	MessageType MessageType `json:"msgType"`
	FRMPayload  string      `json:"FRMPayload"`
}

UplinkProprietaryFrame implements the uplink proprietary frame.

type Version

type Version struct {
	MessageType MessageType `json:"msgtype"`
	Station     string      `json:"station"`
	Firmware    string      `json:"firmware"`
	Package     string      `json:"package"`
	Model       string      `json:"model"`
	Protocol    int         `json:"protocol"`
}

Version implements the version message.

Jump to

Keyboard shortcuts

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