lora

package
v0.0.0-...-72abf97 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2015 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PUSH_DATA = iota
	PUSH_ACK  = iota
	PULL_DATA = iota
	PULL_ACK  = iota
	PULL_RESP = iota
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	Raw *net.UDPConn
}

func NewConn

func NewConn(r *net.UDPConn) *Conn

func (*Conn) ReadMessage

func (c *Conn) ReadMessage() (*Message, error)

type Message

type Message struct {
	SourceAddr *net.UDPAddr
	Conn       *Conn
	Header     *MessageHeader
	GatewayEui []byte
	Payload    interface{}
}

func (*Message) Ack

func (m *Message) Ack() error

type MessageHeader

type MessageHeader struct {
	ProtocolVersion byte
	Token           uint16
	Identifier      byte
}

type PHYPayload

type PHYPayload struct {
	MHDR       byte
	MACPayload []byte
	MIC        []byte
	FCtrl      byte
	FCnt       uint16
	FOpts      []byte
	FPort      byte
	DevAddr    uint32
}

func ParsePHYPayload

func ParsePHYPayload(buf []byte) (*PHYPayload, error)

func (*PHYPayload) DecryptPayload

func (d *PHYPayload) DecryptPayload(key []byte) ([]byte, error)

func (*PHYPayload) TestIntegrity

func (d *PHYPayload) TestIntegrity(key []byte) (bool, error)

type PushMessagePayload

type PushMessagePayload struct {
	RXPK []*RXPK `json:"rxpk,omitempty"`
	Stat *Stat   `json:"stat,omitempty"`
}

type RXPK

type RXPK struct {
	Time time.Time `json:"time"`
	Tmst uint      `json:"tmst"`
	Chan uint      `json:"chan"`
	Rfch uint      `json:"rfch"`
	Freq float64   `json:"freq"`
	Stat int       `json:"stat"`
	Modu string    `json:"modu"`
	Datr string    `json:"datr"`
	Codr string    `json:"codr"`
	Rssi int       `json:"rssi"`
	Lsnr float64   `json:"lsnr"`
	Size uint      `json:"size"`
	Data string    `json:"data"`
}

func (*RXPK) ParseData

func (rxpk *RXPK) ParseData() (*PHYPayload, error)

type Stat

type Stat struct {
	Time string  `json:"time"`
	Lati float64 `json:"lati"`
	Long float64 `json:"long"`
	Alti float64 `json:"alti"`
	Rxnb uint    `json:"rxnb"`
	Rxok uint    `json:"rxok"`
	Rxfw uint    `json:"rxfw"`
	Ackr float64 `json:"ackr"`
	Dwnb uint    `json:"dwnb"`
	Txnb uint    `json:"txnb"`
}

type TXPX

type TXPX struct {
	Imme bool    `json:"imme"`
	Freq float64 `json:"freq"`
	Rfch uint    `json:"rfch"`
	Powe uint    `json:"powe"`
	Modu string  `json:"modu"`
	Datr uint    `json:"datr"`
	Fdev uint    `json:"fdev"`
	Size uint    `json:"size"`
	Data string  `json:"data"`
}

Jump to

Keyboard shortcuts

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