Documentation
¶
Index ¶
- Constants
- Variables
- func GetRand16() ([2]uint8, error)
- func Join(otaa *Otaa, session *Session) error
- func ListenDownlink() error
- func Msb(buf []byte) uint8
- func NewCmac(key []byte) (hash.Hash, error)
- func PadBlock(block []byte) []byte
- func SendUplink(data []uint8, session *Session) error
- func SetPublicNetwork(enabled bool)
- func ShiftLeft(b []byte) []byte
- func UseRadio(r lora.Radio)
- func UseRegionSettings(rs region.Settings)
- func Xor(dst []byte, a []byte, b []byte) error
- type Otaa
- func (o *Otaa) DecodeJoinAccept(phyPload []uint8, s *Session) error
- func (o *Otaa) GenerateJoinRequest() ([]uint8, error)
- func (o *Otaa) GetAppEUI() string
- func (o *Otaa) GetAppKey() string
- func (o *Otaa) GetDevEUI() string
- func (o *Otaa) GetNetID() string
- func (o *Otaa) Init()
- func (o *Otaa) Set(appEUI []uint8, devEUI []uint8, appKey []uint8)
- func (o *Otaa) SetAppEUI(appEUI []uint8) error
- func (o *Otaa) SetAppKey(appKey []uint8) error
- func (o *Otaa) SetDevEUI(devEUI []uint8) error
- func (o *Otaa) SetNetID(netID []uint8) error
- type Session
- func (s *Session) GenMessage(dir uint8, payload []uint8) ([]uint8, error)
- func (s *Session) GetAppSKey() string
- func (s *Session) GetDevAddr() string
- func (s *Session) GetNwkSKey() string
- func (s *Session) SetAppSKey(appSKey []uint8) error
- func (s *Session) SetDevAddr(devAddr []uint8) error
- func (s *Session) SetNwkSKey(nwkSKey []uint8) error
Constants ¶
const ( LORA_TX_TIMEOUT = 2000 LORA_RX_TIMEOUT = 10000 )
const (
Size = aes.BlockSize
)
Variables ¶
var ( ErrNoJoinAcceptReceived = errors.New("no JoinAccept packet received") ErrNoRadioAttached = errors.New("no LoRa radio attached") ErrInvalidEuiLength = errors.New("invalid EUI length") ErrInvalidAppKeyLength = errors.New("invalid AppKey length") ErrInvalidPacketLength = errors.New("invalid packet length") ErrInvalidDevAddrLength = errors.New("invalid DevAddr length") ErrInvalidMic = errors.New("invalid Mic") ErrFrmPayloadTooLarge = errors.New("FRM payload too large") ErrInvalidNetIDLength = errors.New("invalid NetID length") ErrInvalidNwkSKeyLength = errors.New("invalid NwkSKey length") ErrInvalidAppSKeyLength = errors.New("invalid AppSKey length") ErrUndefinedRegionSettings = errors.New("undefined Regionnal Settings ") )
var ( ActiveRadio lora.Radio Retries = 15 )
Functions ¶
func ListenDownlink ¶
func ListenDownlink() error
func Msb ¶
Msb returns the most significant bit of the supplied data (which must be non-empty). This is the MSB(L) function of RFC 4493.
func NewCmac ¶
New returns an AES-CMAC hash using the supplied key. The key must be 16, 24, or 32 bytes long.
func SendUplink ¶
SendUplink sends Lorawan Uplink message
func SetPublicNetwork ¶
func SetPublicNetwork(enabled bool)
SetPublicNetwork defines Lora Sync Word according to network type (public/private)
func UseRegionSettings ¶
UseRegionSettings sets current Lorawan Regional parameters
Types ¶
type Otaa ¶
type Otaa struct { DevEUI [8]uint8 AppEUI [8]uint8 AppKey [16]uint8 NetID [3]uint8 // contains filtered or unexported fields }
Otaa is used to store Over The Air Activation data of a LoRaWAN session
func (*Otaa) DecodeJoinAccept ¶
DecodeJoinAccept Decodes a Lora Join Accept packet
func (*Otaa) GenerateJoinRequest ¶
GenerateJoinRequest Generates a LoraWAN Join request
type Session ¶
type Session struct { NwkSKey [16]uint8 AppSKey [16]uint8 DevAddr [4]uint8 FCntDown uint32 FCntUp uint32 CFList [16]uint8 RXDelay uint8 DLSettings uint8 }
Session is used to store session data of a LoRaWAN session
func (*Session) GenMessage ¶
GenMessage generates an uplink message.
func (*Session) GetAppSKey ¶
GetAppSKey returns the Session AppSKey
func (*Session) GetDevAddr ¶
GetDevAddr returns the Session DevAddr
func (*Session) GetNwkSKey ¶
GetNwkSKey returns the Session NwkSKey
func (*Session) SetAppSKey ¶
SetAppSKey configures the Session AppSKey
func (*Session) SetDevAddr ¶
SetDevAddr configures the Session DevAddr
func (*Session) SetNwkSKey ¶
SetNwkSKey configures the Session NwkSKey