Documentation ¶
Index ¶
- type AppNonce
- type DevNonce
- type Device
- func (d Device) ChangedFields() (changed []string)
- func (d *Device) Clone() *Device
- func (d *Device) DBVersion() string
- func (d *Device) FromLoRaWANPb(lorawan *pb_lorawan.Device)
- func (d *Device) FromPb(in *pb_handler.Device)
- func (d *Device) StartUpdate()
- func (d Device) ToLoRaWANPb() *pb_lorawan.Device
- func (d Device) ToPb() *pb_handler.Device
- type DownlinkQueue
- type Options
- type RedisDeviceStore
- func (s *RedisDeviceStore) AddBuiltinAttribute(attr ...string)
- func (s *RedisDeviceStore) Count() (int, error)
- func (s *RedisDeviceStore) CountForApp(appID string) (int, error)
- func (s *RedisDeviceStore) Delete(appID, devID string) error
- func (s *RedisDeviceStore) DownlinkQueue(appID, devID string) (DownlinkQueue, error)
- func (s *RedisDeviceStore) Get(appID, devID string) (*Device, error)
- func (s *RedisDeviceStore) List(opts *storage.ListOptions) ([]*Device, error)
- func (s *RedisDeviceStore) ListForApp(appID string, opts *storage.ListOptions) ([]*Device, error)
- func (s *RedisDeviceStore) Set(new *Device, properties ...string) (err error)
- type RedisDownlinkQueue
- func (s *RedisDownlinkQueue) Length() (int, error)
- func (s *RedisDownlinkQueue) Next() (*types.DownlinkMessage, error)
- func (s *RedisDownlinkQueue) PushFirst(msg *types.DownlinkMessage) error
- func (s *RedisDownlinkQueue) PushLast(msg *types.DownlinkMessage) error
- func (s *RedisDownlinkQueue) Replace(msg *types.DownlinkMessage) error
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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"` Description string `redis:"description"` Latitude float32 `redis:"latitude"` Longitude float32 `redis:"longitude"` Altitude int32 `redis:"altitude"` Options Options `redis:"options"` AppKey types.AppKey `redis:"app_key"` UsedDevNonces []DevNonce `redis:"used_dev_nonces"` UsedAppNonces []AppNonce `redis:"used_app_nonces"` DevAddr types.DevAddr `redis:"dev_addr"` NwkSKey types.NwkSKey `redis:"nwk_s_key"` AppSKey types.AppSKey `redis:"app_s_key"` FCntUp uint32 `redis:"f_cnt_up"` // Only used to detect retries CurrentDownlink *types.DownlinkMessage `redis:"current_downlink"` CreatedAt time.Time `redis:"created_at"` UpdatedAt time.Time `redis:"updated_at"` Attributes map[string]string `redis:"attributes"` // contains filtered or unexported fields }
Device contains the state of a device
func FromPb ¶ added in v2.8.0
func FromPb(in *pb_handler.Device) *Device
FromPb returns a new device from the given proto
func (Device) ChangedFields ¶
ChangedFields returns the names of the changed fields since the last call to StartUpdate
func (*Device) FromLoRaWANPb ¶ added in v2.8.1
func (d *Device) FromLoRaWANPb(lorawan *pb_lorawan.Device)
FromLoRaWANPb fills Device fields from a lorawan device proto
func (*Device) FromPb ¶ added in v2.8.0
func (d *Device) FromPb(in *pb_handler.Device)
FromPb fills Device fields from a device proto
func (*Device) StartUpdate ¶
func (d *Device) StartUpdate()
StartUpdate stores the state of the device
func (Device) ToLoRaWANPb ¶ added in v2.8.1
func (d Device) ToLoRaWANPb() *pb_lorawan.Device
ToLoRaWANPb converts a device struct to a LoRaWAN protocol buffer
func (Device) ToPb ¶ added in v2.8.0
func (d Device) ToPb() *pb_handler.Device
ToPb converts a device struct to its protocol buffer
type DownlinkQueue ¶ added in v2.5.0
type DownlinkQueue interface { Length() (int, error) Next() (*types.DownlinkMessage, error) Replace(msg *types.DownlinkMessage) error PushFirst(msg *types.DownlinkMessage) error PushLast(msg *types.DownlinkMessage) error }
DownlinkQueue stores the Downlink queue
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 device
type RedisDeviceStore ¶
type RedisDeviceStore struct {
// contains filtered or unexported fields
}
RedisDeviceStore stores Devices in Redis. - Devices are stored as a Hash
func NewRedisDeviceStore ¶
func NewRedisDeviceStore(client *redis.Client, prefix string) *RedisDeviceStore
NewRedisDeviceStore creates a new Redis-based Device store
func (*RedisDeviceStore) AddBuiltinAttribute ¶ added in v2.8.0
func (s *RedisDeviceStore) AddBuiltinAttribute(attr ...string)
AddBuiltinAttribute adds builtin device attributes to the list.
func (*RedisDeviceStore) Count ¶ added in v2.6.1
func (s *RedisDeviceStore) Count() (int, error)
Count all devices in the store
func (*RedisDeviceStore) CountForApp ¶ added in v2.6.1
func (s *RedisDeviceStore) CountForApp(appID string) (int, error)
CountForApp counts all devices for an Application
func (*RedisDeviceStore) Delete ¶
func (s *RedisDeviceStore) Delete(appID, devID string) error
Delete a Device
func (*RedisDeviceStore) DownlinkQueue ¶ added in v2.5.0
func (s *RedisDeviceStore) DownlinkQueue(appID, devID string) (DownlinkQueue, error)
DownlinkQueue for a specific Device
func (*RedisDeviceStore) Get ¶
func (s *RedisDeviceStore) Get(appID, devID string) (*Device, error)
Get a specific Device
func (*RedisDeviceStore) List ¶
func (s *RedisDeviceStore) List(opts *storage.ListOptions) ([]*Device, error)
List all Devices
func (*RedisDeviceStore) ListForApp ¶
func (s *RedisDeviceStore) ListForApp(appID string, opts *storage.ListOptions) ([]*Device, error)
ListForApp lists all devices for a specific Application
type RedisDownlinkQueue ¶ added in v2.5.0
type RedisDownlinkQueue struct {
// contains filtered or unexported fields
}
RedisDownlinkQueue implements the downlink queue in Redis
func (*RedisDownlinkQueue) Length ¶ added in v2.5.0
func (s *RedisDownlinkQueue) Length() (int, error)
Length of the downlink queue
func (*RedisDownlinkQueue) Next ¶ added in v2.5.0
func (s *RedisDownlinkQueue) Next() (*types.DownlinkMessage, error)
Next item in the downlink queue
func (*RedisDownlinkQueue) PushFirst ¶ added in v2.5.0
func (s *RedisDownlinkQueue) PushFirst(msg *types.DownlinkMessage) error
PushFirst message to the downlink queue
func (*RedisDownlinkQueue) PushLast ¶ added in v2.5.0
func (s *RedisDownlinkQueue) PushLast(msg *types.DownlinkMessage) error
PushLast message to the downlink queue
func (*RedisDownlinkQueue) Replace ¶ added in v2.5.0
func (s *RedisDownlinkQueue) Replace(msg *types.DownlinkMessage) error
Replace the downlink queue with msg
type Store ¶
type Store interface { Count() (int, error) CountForApp(appID string) (int, error) List(opts *storage.ListOptions) ([]*Device, error) ListForApp(appID string, opts *storage.ListOptions) ([]*Device, error) Get(appID, devID string) (*Device, error) DownlinkQueue(appID, devID string) (DownlinkQueue, error) Set(new *Device, properties ...string) (err error) Delete(appID, devID string) error AddBuiltinAttribute(attr ...string) }
Store interface for Devices