device

package
v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2016 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppNonce

type AppNonce [3]byte

type DevNonce

type DevNonce [2]byte

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"`
	AppKey        types.AppKey  `redis:"app_key"`
	UsedDevNonces []DevNonce    `redis:"used_dev_nonces"`
	UsedAppNonces []AppNonce    `redis:"used_app_nonces"`
	NwkSKey       types.NwkSKey `redis:"nwk_s_key"`
	AppSKey       types.AppSKey `redis:"app_s_key"`
	Options       Options       `redis:"options"`

	NextDownlink *types.DownlinkMessage `redis:"next_downlink"`

	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

func (d Device) ChangedFields() (changed []string)

ChangedFields returns the names of the changed fields since the last call to StartUpdate

func (Device) GetLoRaWAN

func (d Device) GetLoRaWAN() *pb_lorawan.Device

GetLoRaWAN returns a LoRaWAN Device proto

func (*Device) StartUpdate

func (d *Device) StartUpdate()

StartUpdate stores the state of the 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 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) Delete

func (s *RedisDeviceStore) Delete(appID, devID string) error

Delete a Device

func (*RedisDeviceStore) Get

func (s *RedisDeviceStore) Get(appID, devID string) (*Device, error)

Get a specific Device

func (*RedisDeviceStore) List

func (s *RedisDeviceStore) List() ([]*Device, error)

List all Devices

func (*RedisDeviceStore) ListForApp

func (s *RedisDeviceStore) ListForApp(appID string) ([]*Device, error)

ListForApp lists all devices for a specific Application

func (*RedisDeviceStore) Set

func (s *RedisDeviceStore) Set(new *Device, properties ...string) (err error)

Set a new Device or update an existing one

type Store

type Store interface {
	List() ([]*Device, error)
	ListForApp(appID string) ([]*Device, error)
	Get(appID, devID string) (*Device, error)
	Set(new *Device, properties ...string) (err error)
	Delete(appID, devID string) error
}

Store interface for Devices

Jump to

Keyboard shortcuts

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