Documentation ¶
Index ¶
- Constants
- type ADRSettings
- type Device
- type Frame
- type FrameHistory
- type Options
- type RedisDeviceStore
- func (s *RedisDeviceStore) Count() (int, error)
- func (s *RedisDeviceStore) CountForAddress(devAddr types.DevAddr) (int, error)
- func (s *RedisDeviceStore) Delete(appEUI types.AppEUI, devEUI types.DevEUI) error
- func (s *RedisDeviceStore) Frames(appEUI types.AppEUI, devEUI types.DevEUI) (FrameHistory, error)
- func (s *RedisDeviceStore) Get(appEUI types.AppEUI, devEUI types.DevEUI) (*Device, error)
- func (s *RedisDeviceStore) List(opts *storage.ListOptions) ([]*Device, error)
- func (s *RedisDeviceStore) ListForAddress(devAddr types.DevAddr) ([]*Device, error)
- func (s *RedisDeviceStore) Set(new *Device, properties ...string) (err error)
- type RedisFrameHistory
- type Store
Constants ¶
const FramesHistorySize = 20
FramesHistorySize for ADR
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ADRSettings ¶ added in v2.5.0
type ADRSettings struct { Band string `redis:"band"` Margin int `redis:"margin"` // Indicates whether the NetworkServer should send a LinkADRReq when possible SentInitial bool `redis:"sent_initial"` SendReq bool `redis:"send_req"` ExpectRes bool `redis:"expect_res"` Failed int `redis:"failed"` // number of failed ADR attempts // Desired Settings: DataRate string `redis:"data_rate"` TxPower int `redis:"tx_power"` NbTrans int `redis:"nb_trans"` }
ADRSettings contains the (desired) settings for a device that uses ADR
type Device ¶
type Device struct { DevEUI types.DevEUI `redis:"dev_eui"` AppEUI types.AppEUI `redis:"app_eui"` AppID string `redis:"app_id"` DevID string `redis:"dev_id"` DevAddr types.DevAddr `redis:"dev_addr"` NwkSKey types.NwkSKey `redis:"nwk_s_key"` FCntUp uint32 `redis:"f_cnt_up"` FCntDown uint32 `redis:"f_cnt_down"` LastSeen time.Time `redis:"last_seen"` Options Options `redis:"options"` ADR ADRSettings `redis:"adr,include"` CreatedAt time.Time `redis:"created_at"` UpdatedAt time.Time `redis:"updated_at"` // contains filtered or unexported fields }
Device contains the state of a device
func (Device) ChangedFields ¶
ChangedFields returns the names of the changed fields since the last call to StartUpdate
func (*Device) StartUpdate ¶
func (d *Device) StartUpdate()
StartUpdate stores the state of the device
type Frame ¶ added in v2.5.0
type Frame struct { FCnt uint32 `json:"f_cnt"` SNR float32 `json:"snr"` GatewayCount uint32 `json:"gw_cnt"` }
Frame collected for ADR
type FrameHistory ¶ added in v2.5.0
FrameHistory for a device
type Options ¶
type Options struct { ActivationConstraints string `json:"activation_constraints,omitempty"` // Activation Constraints (public/local/private) DisableFCntCheck bool `json:"disable_fcnt_check,omitemtpy"` // Disable Frame counter check (insecure) Uses32BitFCnt bool `json:"uses_32_bit_fcnt,omitemtpy"` // Use 32-bit Frame counters }
Options for the specified device
type RedisDeviceStore ¶
type RedisDeviceStore struct {
// contains filtered or unexported fields
}
RedisDeviceStore stores Devices in Redis. - Devices are stored as a Hash - DevAddr mappings are indexed in a Set
func (*RedisDeviceStore) Count ¶ added in v2.6.1
func (s *RedisDeviceStore) Count() (int, error)
Count all Devices
func (*RedisDeviceStore) CountForAddress ¶ added in v2.6.1
func (s *RedisDeviceStore) CountForAddress(devAddr types.DevAddr) (int, error)
CountForAddress counts all devices for a specific DevAddr
func (*RedisDeviceStore) Frames ¶ added in v2.5.0
func (s *RedisDeviceStore) Frames(appEUI types.AppEUI, devEUI types.DevEUI) (FrameHistory, error)
Frames history for a specific Device
func (*RedisDeviceStore) List ¶
func (s *RedisDeviceStore) List(opts *storage.ListOptions) ([]*Device, error)
List all Devices
func (*RedisDeviceStore) ListForAddress ¶
func (s *RedisDeviceStore) ListForAddress(devAddr types.DevAddr) ([]*Device, error)
ListForAddress lists all devices for a specific DevAddr
type RedisFrameHistory ¶ added in v2.5.0
type RedisFrameHistory struct {
// contains filtered or unexported fields
}
RedisFrameHistory implements the frame history in Redis
func (*RedisFrameHistory) Clear ¶ added in v2.5.0
func (s *RedisFrameHistory) Clear() error
Clear frames in the device's history
func (*RedisFrameHistory) Get ¶ added in v2.5.0
func (s *RedisFrameHistory) Get() (out []*Frame, err error)
Get the last frames from the device's history
func (*RedisFrameHistory) Push ¶ added in v2.5.0
func (s *RedisFrameHistory) Push(frame *Frame) error
Push a Frame to the device's history
func (*RedisFrameHistory) Trim ¶ added in v2.5.0
func (s *RedisFrameHistory) Trim() error
Trim frames in the device's history
type Store ¶
type Store interface { Count() (int, error) List(opts *storage.ListOptions) ([]*Device, error) CountForAddress(devAddr types.DevAddr) (int, error) ListForAddress(devAddr types.DevAddr) ([]*Device, error) Get(appEUI types.AppEUI, devEUI types.DevEUI) (*Device, error) Set(new *Device, properties ...string) (err error) Delete(appEUI types.AppEUI, devEUI types.DevEUI) error Frames(appEUI types.AppEUI, devEUI types.DevEUI) (FrameHistory, error) }
Store interface for Devices
func NewRedisDeviceStore ¶
NewRedisDeviceStore creates a new Redis-based status store