mtech_lora

package
v0.0.0-...-9b3e15a Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_PACKET_SIZE_IN = 2048
View Source
const MAX_PACKET_SIZE_OUT = 256
View Source
const UDP_RX_PORT = 1784
View Source
const UDP_TX_PORT = 1786

Variables

View Source
var LoraDataRateMapUS = map[string]int{
	"SF12BW500": 33,
	"SF11BW500": 109,
	"SF10BW500": 222,
	"SF9BW500":  222,
	"SF8BW500":  222,
	"SF7BW500":  222,
}

* This maps datarate string into a max mtu we can use

Functions

func DenormalizeAddr

func DenormalizeAddr(addr string) string

func NormalizeAddr

func NormalizeAddr(addr string) (string, error)

Types

type Listener

type Listener struct {
	MsgChan  chan []byte
	MtuChan  chan int
	ConnChan chan *LoraSesn

	RefCnt   int
	Data     *bytes.Buffer
	NextFrag uint8
	Crc      uint16
}

func NewListener

func NewListener() *Listener

func (*Listener) Close

func (ll *Listener) Close()

type ListenerKey

type ListenerKey struct {
	Target string
	Type   string
}

func TgtKey

func TgtKey(tgt string, msgType string) ListenerKey

func TgtPortKey

func TgtPortKey(tgt string, port uint8, msgType string) ListenerKey

func TypeKey

func TypeKey(msgType string) ListenerKey

type ListenerMap

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

Not thread safe.

func NewListenerMap

func NewListenerMap() *ListenerMap

func (*ListenerMap) AddListener

func (lm *ListenerMap) AddListener(key ListenerKey, listener *Listener) error

func (*ListenerMap) Dump

func (lm *ListenerMap) Dump()

func (*ListenerMap) FindListener

func (lm *ListenerMap) FindListener(tgt string, port uint8, msgType string) (
	ListenerKey, *Listener)

func (*ListenerMap) RemoveKey

func (lm *ListenerMap) RemoveKey(key ListenerKey) *Listener

func (*ListenerMap) RemoveListener

func (lm *ListenerMap) RemoveListener(listener *Listener) *ListenerKey

type ListenerSlice

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

not thread safe

func NewListenerSlice

func NewListenerSlice() *ListenerSlice

func (*ListenerSlice) AddListener

func (lm *ListenerSlice) AddListener(key ListenerKey, listener *Listener) error

func (*ListenerSlice) Dump

func (ls *ListenerSlice) Dump()

func (*ListenerSlice) FindListener

func (lm *ListenerSlice) FindListener(tgt string, msgType string) (
	ListenerKey, []*Listener)

func (*ListenerSlice) RemoveListener

func (lm *ListenerSlice) RemoveListener(listener *Listener) *ListenerKey

type LoraConfig

type LoraConfig struct {
	Addr        string
	SegSz       int
	ConfirmedTx bool
	Port        uint8
}

type LoraData

type LoraData struct {
	Data string `codec:"data"`
	Port uint8  `codec:"port"`
}

type LoraJoinedCb

type LoraJoinedCb func(dev LoraConfig)

type LoraPacketSent

type LoraPacketSent struct {
	DataRate string `codec:"datr"`
}

type LoraSesn

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

func NewLoraSesn

func NewLoraSesn(cfg sesn.SesnCfg, lx *LoraXport) (*LoraSesn, error)

func (*LoraSesn) AbortRx

func (s *LoraSesn) AbortRx(seq uint8) error

func (*LoraSesn) Close

func (s *LoraSesn) Close() error

func (*LoraSesn) CoapIsTcp

func (s *LoraSesn) CoapIsTcp() bool

func (*LoraSesn) Filters

func (s *LoraSesn) Filters() (nmcoap.TxMsgFilter, nmcoap.RxMsgFilter)

func (*LoraSesn) IsOpen

func (s *LoraSesn) IsOpen() bool

func (*LoraSesn) ListenCoap

func (s *LoraSesn) ListenCoap(mc nmcoap.MsgCriteria) (*nmcoap.Listener, error)

func (*LoraSesn) MgmtProto

func (s *LoraSesn) MgmtProto() sesn.MgmtProto

func (*LoraSesn) Mtu

func (s *LoraSesn) Mtu() int

func (*LoraSesn) MtuIn

func (s *LoraSesn) MtuIn() int

func (*LoraSesn) MtuOut

func (s *LoraSesn) MtuOut() int

func (*LoraSesn) Open

func (s *LoraSesn) Open() error

func (*LoraSesn) RxAccept

func (s *LoraSesn) RxAccept() (sesn.Sesn, *sesn.SesnCfg, error)

func (*LoraSesn) RxCoap

func (s *LoraSesn) RxCoap(opt sesn.TxOptions) (coap.Message, error)

func (*LoraSesn) SetFilters

func (s *LoraSesn) SetFilters(txFilter nmcoap.TxMsgFilter,
	rxFilter nmcoap.RxMsgFilter)

func (*LoraSesn) StopListenCoap

func (s *LoraSesn) StopListenCoap(mc nmcoap.MsgCriteria)

func (*LoraSesn) TxCoap

func (s *LoraSesn) TxCoap(m coap.Message) error

func (*LoraSesn) TxRxMgmt

func (s *LoraSesn) TxRxMgmt(m *nmp.NmpMsg,
	timeout time.Duration) (nmp.NmpRsp, error)

func (*LoraSesn) TxRxMgmtAsync

func (s *LoraSesn) TxRxMgmtAsync(m *nmp.NmpMsg,
	timeout time.Duration, ch chan nmp.NmpRsp, errc chan error) error

type LoraXport

type LoraXport struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewLoraXport

func NewLoraXport(cfg *LoraXportCfg) *LoraXport

func (*LoraXport) BuildSesn

func (lx *LoraXport) BuildSesn(cfg sesn.SesnCfg) (sesn.Sesn, error)

func (*LoraXport) DumpListeners

func (lx *LoraXport) DumpListeners()

func (*LoraXport) SetJoinCb

func (lx *LoraXport) SetJoinCb(joinCb LoraJoinedCb)

func (*LoraXport) Start

func (lx *LoraXport) Start() error

func (*LoraXport) Stop

func (lx *LoraXport) Stop() error

func (*LoraXport) Tx

func (lx *LoraXport) Tx(bytes []byte) error

type LoraXportCfg

type LoraXportCfg struct {
	AppPortDown int // UDP TX port
	AppPortUp   int // UDP RX port
}

func NewXportCfg

func NewXportCfg() *LoraXportCfg

Jump to

Keyboard shortcuts

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