entities

package
v0.0.0-...-af70fd6 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2015 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Entities handling

Index

Constants

View Source
const (
	DEVICE_NODE_PATH          = "/device/"
	DEVICE_BY_IDENT_NODE_PATH = DEVICE_NODE_PATH + "by-ident/"
	DEVICE_DEFAULT_NODE_PATH  = "/device/default/"
)
View Source
const CHANNEL_TRANSLATION_SUBNODE = "channel-translation"
View Source
const DOMAIN_BY_NAME_NODE_PATH = DOMAIN_NODE_PATH + "by-name/"
View Source
const DOMAIN_NODE_PATH = "/domain/"
View Source
const USER_BY_NAME_NODE_PATH = USER_NODE_PATH + "by-name/"
View Source
const USER_NODE_PATH = "/user/"

Variables

This section is empty.

Functions

func GetFirmwareFile

func GetFirmwareFile(name string) *db.RegistryFile

Types

type Device

type Device struct {
	// Device's node
	Node *db.RegistryNode
}

Device

func NewDeviceById

func NewDeviceById(devId gocql.UUID) *Device

Device by ID

func NewDeviceByIdent

func NewDeviceByIdent(ident string) (*Device, error)

Device by ident

func NewDeviceByIdentCreate

func NewDeviceByIdentCreate(ident string) (*Device, error)

Device by ident (created if it doesn't exist)

func NewDeviceDefault

func NewDeviceDefault() *Device

func (*Device) AckCommand

func (d *Device) AckCommand(cmdId string) error

Acknowledge a command with its ID

func (*Device) AckCommandWithResponse

func (d *Device) AckCommandWithResponse(cmdId, response string) error

func (*Device) AckSetting

func (d *Device) AckSetting(name, ackedValue string) (err error)

func (*Device) AddCommand

func (d *Device) AddCommand(cmd string) (string, error)

Add a command to send to the device

func (*Device) Commands

func (d *Device) Commands() map[string]string

func (*Device) DelSetting

func (d *Device) DelSetting(name string) (err error)

Delete a setting

func (*Device) Delete

func (d *Device) Delete() error

func (*Device) Domain

func (dev *Device) Domain() *Domain

func (*Device) GetServerSettingsPublicNode

func (d *Device) GetServerSettingsPublicNode() *db.RegistryNode

func (*Device) Id

func (d *Device) Id() string

func (*Device) Ident

func (d *Device) Ident() string

func (*Device) LastData

func (this *Device) LastData(dataType string) *db.TimedData

func (*Device) MarkListedSensor

func (d *Device) MarkListedSensor(id string) *db.RegistryNode

func (*Device) Name

func (d *Device) Name() string

func (*Device) Owner

func (this *Device) Owner() *User

func (*Device) SaveTSTime

func (d *Device) SaveTSTime(dataType string, time time.Time, data string) error

func (*Device) SaveTSTimeObj

func (d *Device) SaveTSTimeObj(dataType string, time time.Time, obj interface{}) error

func (*Device) SetDomain

func (dev *Device) SetDomain(d *Domain) error

func (*Device) SetName

func (d *Device) SetName(name string) error

func (*Device) SetSetting

func (d *Device) SetSetting(name, value string) (err error)

Define a setting

func (*Device) SetStatus

func (d *Device) SetStatus(name, value string) error

func (*Device) Setting

func (d *Device) Setting(name string) string

func (*Device) Settings

func (d *Device) Settings() map[string]string

func (*Device) SettingsToSend

func (d *Device) SettingsToSend() map[string]string

func (*Device) Status

func (d *Device) Status(name string) string

func (*Device) TSID

func (d *Device) TSID() string

type DeviceChannelTrans

type DeviceChannelTrans struct {
	Device *Device
	// contains filtered or unexported fields
}

func NewDeviceChannelTrans

func NewDeviceChannelTrans(d *Device) *DeviceChannelTrans

func (*DeviceChannelTrans) GetTarget

func (d *DeviceChannelTrans) GetTarget(channel string) *string

func (*DeviceChannelTrans) SetTarget

func (d *DeviceChannelTrans) SetTarget(priority int, channel, target string) error

type Domain

type Domain struct {
	Node *db.RegistryNode
}

Domain

func NewDomainById

func NewDomainById(id gocql.UUID) (d *Domain)

Create a new domain instance with its it id

func NewDomainByName

func NewDomainByName(name string) (*Domain, error)

Get a domain by name

func NewDomainByNameCreate

func NewDomainByNameCreate(name string) (*Domain, error)

Create new a domain

func (*Domain) Delete

func (d *Domain) Delete() error

Delete the domain

func (*Domain) Devices

func (d *Domain) Devices() []*Device

func (*Domain) Distributor

func (this *Domain) Distributor() *User

func (*Domain) Id

func (d *Domain) Id() string

Get the domain's id

func (*Domain) Name

func (d *Domain) Name() string

Get the domain's name

func (*Domain) Rename

func (d *Domain) Rename(name string) error

Rename the domain

func (*Domain) Users

func (d *Domain) Users() []*User

type User

type User struct {
	Node *db.RegistryNode
}

User

func NewUserById

func NewUserById(id gocql.UUID) (u *User)

Create a new User instance with its it id

func NewUserByName

func NewUserByName(name string) (*User, error)

Get a user instance by its name

func NewUserByNameCreate

func NewUserByNameCreate(name string) (*User, error)

Create new user

func (*User) Delete

func (d *User) Delete() error

Delete the User

func (*User) Domain

func (u *User) Domain() *Domain

func (*User) Id

func (d *User) Id() string

Get the User's id

func (*User) Name

func (d *User) Name() string

Get the User's name

func (*User) Rename

func (u *User) Rename(name string) error

Rename the User

func (*User) SetDomain

func (u *User) SetDomain(d *Domain) error

Jump to

Keyboard shortcuts

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