Documentation ¶
Index ¶
- func AddMACPayloadToTXQueue(p *redis.Pool, pl models.MACPayload) error
- func AddTXPayloadToQueue(p *redis.Pool, payload models.TXPayload) error
- func ClearInProcessTXPayload(p *redis.Pool, devEUI lorawan.EUI64) (*models.TXPayload, error)
- func CreateApplication(db *sqlx.DB, a models.Application) error
- func CreateChannel(db *sqlx.DB, c *models.Channel) error
- func CreateChannelList(db *sqlx.DB, cl *models.ChannelList) error
- func CreateNode(db *sqlx.DB, n models.Node) error
- func CreateNodeSession(p *redis.Pool, s models.NodeSession) error
- func DeleteApplication(db *sqlx.DB, appEUI lorawan.EUI64) error
- func DeleteChannel(db *sqlx.DB, id int64) error
- func DeleteChannelList(db *sqlx.DB, id int64) error
- func DeleteMACPayloadFromTXQueue(p *redis.Pool, devAddr lorawan.DevAddr, pl models.MACPayload) error
- func DeleteNode(db *sqlx.DB, p *redis.Pool, devEUI lorawan.EUI64) error
- func DeleteNodeSession(p *redis.Pool, devAddr lorawan.DevAddr) error
- func FilterMACPayloads(payloads []models.MACPayload, frmPayload bool, maxBytes int) []models.MACPayload
- func FlushTXPayloadQueue(p *redis.Pool, devEUI lorawan.EUI64) error
- func GetApplication(db *sqlx.DB, appEUI lorawan.EUI64) (models.Application, error)
- func GetApplications(db *sqlx.DB, limit, offset int) ([]models.Application, error)
- func GetApplicationsCount(db *sqlx.DB) (int, error)
- func GetCFListForNode(db *sqlx.DB, node models.Node) (*lorawan.CFList, error)
- func GetChannel(db *sqlx.DB, id int64) (models.Channel, error)
- func GetChannelList(db *sqlx.DB, id int64) (models.ChannelList, error)
- func GetChannelLists(db *sqlx.DB, limit, offset int) ([]models.ChannelList, error)
- func GetChannelListsCount(db *sqlx.DB) (int, error)
- func GetChannelsForChannelList(db *sqlx.DB, channelListID int64) ([]models.Channel, error)
- func GetNode(db *sqlx.DB, devEUI lorawan.EUI64) (models.Node, error)
- func GetNodeSession(p *redis.Pool, devAddr lorawan.DevAddr) (models.NodeSession, error)
- func GetNodeSessionByDevEUI(p *redis.Pool, devEUI lorawan.EUI64) (models.NodeSession, error)
- func GetNodes(db *sqlx.DB, limit, offset int) ([]models.Node, error)
- func GetNodesCount(db *sqlx.DB) (int, error)
- func GetNodesForAppEUI(db *sqlx.DB, appEUI lorawan.EUI64, limit, offset int) ([]models.Node, error)
- func GetNodesForAppEUICount(db *sqlx.DB, appEUI lorawan.EUI64) (int, error)
- func GetRandomDevAddr(p *redis.Pool, netID lorawan.NetID) (lorawan.DevAddr, error)
- func GetTXPayloadFromQueue(p *redis.Pool, devEUI lorawan.EUI64) (models.TXPayload, error)
- func GetTXPayloadQueueSize(p *redis.Pool, devEUI lorawan.EUI64) (int, error)
- func NewRedisPool(redisURL string) *redis.Pool
- func OpenDatabase(dsn string) (*sqlx.DB, error)
- func ReadMACPayloadTXQueue(p *redis.Pool, devAddr lorawan.DevAddr) ([]models.MACPayload, error)
- func SaveNodeSession(p *redis.Pool, s models.NodeSession) error
- func UpdateApplication(db *sqlx.DB, a models.Application) error
- func UpdateChannel(db *sqlx.DB, c models.Channel) error
- func UpdateChannelList(db *sqlx.DB, cl models.ChannelList) error
- func UpdateNode(db *sqlx.DB, n models.Node) error
- func ValidateAndGetFullFCntUp(n models.NodeSession, fCntUp uint32) (uint32, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddMACPayloadToTXQueue ¶
func AddMACPayloadToTXQueue(p *redis.Pool, pl models.MACPayload) error
AddMACPayloadToTXQueue adds the given payload to the queue of MAC commands to send to the node. Note that the queue is bound to the node-session, since all mac operations are reset after a re-join of the node.
func AddTXPayloadToQueue ¶
AddTXPayloadToQueue adds the given TXPayload to the queue.
func ClearInProcessTXPayload ¶
ClearInProcessTXPayload clears the in-process TXPayload (to be called after a successful transmission). It returns the TXPayload or nil when nothing was cleared (it already expired).
func CreateApplication ¶
func CreateApplication(db *sqlx.DB, a models.Application) error
CreateApplication creates the given Application
func CreateChannel ¶
CreateChannel creates the given channel.
func CreateChannelList ¶
func CreateChannelList(db *sqlx.DB, cl *models.ChannelList) error
CreateChannelList creates the given ChannelList.
func CreateNode ¶
CreateNode creates the given Node.
func CreateNodeSession ¶
func CreateNodeSession(p *redis.Pool, s models.NodeSession) error
CreateNodeSession does the same as saveNodeSession except that it does not overwrite an exisitng record.
func DeleteApplication ¶
DeleteApplication deletes the Application matching the given AppEUI. Note that this will delete all related nodes too!
func DeleteChannel ¶
DeleteChannel deletes the Channel matching the given id.
func DeleteChannelList ¶
DeleteChannelList deletes the ChannelList matching the given id.
func DeleteMACPayloadFromTXQueue ¶
func DeleteMACPayloadFromTXQueue(p *redis.Pool, devAddr lorawan.DevAddr, pl models.MACPayload) error
DeleteMACPayloadFromTXQueue deletes the given MACPayload from the tx queue of the given device address.
func DeleteNode ¶
DeleteNode deletes the Node matching the given DevEUI.
func DeleteNodeSession ¶
DeleteNodeSession deletes the NodeSession matching the given DevAddr.
func FilterMACPayloads ¶
func FilterMACPayloads(payloads []models.MACPayload, frmPayload bool, maxBytes int) []models.MACPayload
FilterMACPayloads filters the given slice of MACPayload elements based on the given criteria (FRMPayload and max-bytes).
func FlushTXPayloadQueue ¶
FlushTXPayloadQueue flushes the tx payload queue for the given DevEUI.
func GetApplication ¶
GetApplication returns the Application for the given AppEUI.
func GetApplications ¶
GetApplications returns a slice of applications.
func GetApplicationsCount ¶
GetApplicationsCount returns the number of applications.
func GetCFListForNode ¶
GetCFListForNode returns the CFList for the given node if the used ISM band allows using a CFList.
func GetChannel ¶
GetChannel returns the Channel matching the given id.
func GetChannelList ¶
GetChannelList returns the ChannelList for the given id.
func GetChannelLists ¶
GetChannelLists returns a list of ChannelList items.
func GetChannelListsCount ¶
GetChannelListsCount returns the total number of channel-lists.
func GetChannelsForChannelList ¶
GetChannelsForChannelList returns the Channels for the given ChannelList id.
func GetNodeSession ¶
GetNodeSession returns the NodeSession for the given DevAddr.
func GetNodeSessionByDevEUI ¶
GetNodeSessionByDevEUI returns the NodeSession for the given DevEUI.
func GetNodesCount ¶
GetNodesCount returns the total number of nodes.
func GetNodesForAppEUI ¶
GetNodesForAppEUI returns a slice of nodes, sorted by DevEUI, for the given AppEUI.
func GetNodesForAppEUICount ¶
GetNodesForAppEUICount returns the total number of nodes given an AppEUI.
func GetRandomDevAddr ¶
GetRandomDevAddr returns a random free DevAddr. Note that the 7 MSB will be set to the NwkID (based on the configured NetID). TODO: handle collission with retry?
func GetTXPayloadFromQueue ¶
GetTXPayloadFromQueue returns the first TXPayload to send to the node. The TXPayload either is a payload that is still in-process (e.g. a payload that needs to be re-transmitted) or an item from the queue. After a successful transmission, don't forget to call clearInProcessTXPayload. errEmptyQueue is returned when the queue is empty / does not exist.
func GetTXPayloadQueueSize ¶
GetTXPayloadQueueSize returns the total TXPayload elements in the queue (including the in-process queue).
func NewRedisPool ¶
NewRedisPool returns a new Redis connection pool.
func OpenDatabase ¶
OpenDatabase opens the database and performs a ping to make sure the database is up.
func ReadMACPayloadTXQueue ¶
ReadMACPayloadTXQueue reads the full MACPayload tx queue for the given device address.
func SaveNodeSession ¶
func SaveNodeSession(p *redis.Pool, s models.NodeSession) error
SaveNodeSession saves the node session. Note that the session will automatically expire after NodeSessionTTL.
func UpdateApplication ¶
func UpdateApplication(db *sqlx.DB, a models.Application) error
UpdateApplication updates the given Application.
func UpdateChannel ¶
UpdateChannel updates the given Channel.
func UpdateChannelList ¶
func UpdateChannelList(db *sqlx.DB, cl models.ChannelList) error
UpdateChannelList updates the given ChannelList.
func UpdateNode ¶
UpdateNode updates the given Node.
func ValidateAndGetFullFCntUp ¶
func ValidateAndGetFullFCntUp(n models.NodeSession, fCntUp uint32) (uint32, bool)
ValidateAndGetFullFCntUp validates if the given fCntUp is valid and returns the full 32 bit frame-counter. Note that the LoRaWAN packet only contains the 16 LSB, so in order to validate the MIC, the full 32 bit frame-counter needs to be set. After a succesful validation of the FCntUp and the MIC, don't forget to synchronize the Node FCntUp with the packet FCnt.
Types ¶
This section is empty.