objects

package
v0.0.0-...-602244f Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2016 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DeviceManagerPath object path for DeviceManager
	DeviceManagerPath = "/iot/agile/DeviceManager"
	// DeviceManagerInterface interface for DeviceManager
	DeviceManagerInterface = "iot.agile.Device"

	// DevicePath partial path for Device
	DevicePath = "/iot/agile/Device"
	// DeviceInterface interface for Device
	DeviceInterface = "iot.agile.Device"
)

Variables

This section is empty.

Functions

func GetDevicePath

func GetDevicePath(id string) string

GetDevicePath return a device path by id

Types

type BaseQuery

type BaseQuery struct {
	Criteria map[string]string
	OrderBy  map[string]string
	Limit    int32
	Offset   int32
}

BaseQuery base query for devices record

type Device

type Device struct {
	api.Proxy

	Id            string
	Name          string
	Status        StatusType
	Configuration map[string]string
	Profile       map[string]DeviceComponent
	LastUpdate    int32
	Data          *RecordObject
	Protocol      *dbus.ObjectPath
	// contains filtered or unexported fields
}

Device a device implementation

func NewDevice

func NewDevice(def DeviceDefinition) *Device

NewDevice create a new Device instance

func (*Device) Connect

func (d *Device) Connect() (err *dbus.Error)

Connect a device

func (*Device) Disconnect

func (d *Device) Disconnect() (err *dbus.Error)

Disconnect a device

func (*Device) Execute

func (d *Device) Execute(op string, payload string) (result ExecuteResult, err *dbus.Error)

Execute an operation

func (*Device) GetInterface

func (d *Device) GetInterface() string

GetInterface return interface

func (*Device) GetLogger

func (d *Device) GetLogger() *log.Logger

GetLogger return default logger

func (*Device) GetPath

func (d *Device) GetPath() string

GetPath return object path

func (*Device) GetProperties

func (d *Device) GetProperties() map[string]map[string]*prop.Prop

GetProperties return properties

func (*Device) Read

func (d *Device) Read(componentId string) (record *RecordObject, err *dbus.Error)

Read data from a component

func (*Device) SetInterface

func (d *Device) SetInterface(s string)

SetInterface return interface

func (*Device) SetLogger

func (d *Device) SetLogger(logger *log.Logger)

SetLogger set default logger

func (*Device) SetPath

func (d *Device) SetPath(s string)

SetPath set object path

func (*Device) Subscribe

func (d *Device) Subscribe(componentId string, params map[string]string) (result bool, err *dbus.Error)

Subscribe for data updates to a component

func (*Device) Unsubscribe

func (d *Device) Unsubscribe(componentId string) (result bool, err *dbus.Error)

Unsubscribe from data updates of a component

func (*Device) Write

func (d *Device) Write(componentId string, record *RecordObject) (result bool, err *dbus.Error)

Write data to a component

type DeviceComponent

type DeviceComponent struct {
	Id         string
	Unit       string
	Format     string
	Properties map[string]string
}

DeviceComponent A device component

type DeviceDefinition

type DeviceDefinition struct {
	Id          string
	Name        string
	Description string
	Path        dbus.ObjectPath
	Protocol    dbus.ObjectPath
	Properties  map[string]string
	Streams     []DeviceComponent
}

DeviceDefinition A device details list

type DeviceManager

type DeviceManager struct {
	api.Proxy

	Devices []dbus.ObjectPath
	// contains filtered or unexported fields
}

DeviceManager manages devices in the gateway

func NewDeviceManager

func NewDeviceManager() *DeviceManager

NewDeviceManager initialize a new DeviceManager object

func (*DeviceManager) Create

Create add a device

func (*DeviceManager) Delete

func (d *DeviceManager) Delete(id string) (res bool, err *dbus.Error)

Delete a device definition

func (*DeviceManager) Find

func (d *DeviceManager) Find(q *BaseQuery) (devices []dbus.ObjectPath, err *dbus.Error)

Find search for devices

func (*DeviceManager) GetInterface

func (d *DeviceManager) GetInterface() string

GetInterface return interface

func (*DeviceManager) GetLogger

func (d *DeviceManager) GetLogger() *log.Logger

GetLogger return default logger

func (*DeviceManager) GetPath

func (d *DeviceManager) GetPath() string

GetPath return object path

func (*DeviceManager) GetProperties

func (d *DeviceManager) GetProperties() map[string]map[string]*prop.Prop

GetProperties return properties

func (*DeviceManager) Read

func (d *DeviceManager) Read(id string) (dev DeviceDefinition, err *dbus.Error)

Read a device definition

func (*DeviceManager) SetInterface

func (d *DeviceManager) SetInterface(s string)

SetInterface return interface

func (*DeviceManager) SetLogger

func (d *DeviceManager) SetLogger(logger *log.Logger)

SetLogger set default logger

func (*DeviceManager) SetPath

func (d *DeviceManager) SetPath(s string)

SetPath set object path

func (*DeviceManager) Update

func (d *DeviceManager) Update(id string, dev DeviceDefinition) (res bool, err *dbus.Error)

Update a device definition

type ExecuteResult

type ExecuteResult struct {
	Result     bool
	ResultCode bool
	Response   string
}

ExecuteResult response object for Execute

type RecordObject

type RecordObject struct {
	Format      string
	Value       string
	Unit        string
	ComponentId string
	DeviceId    string
	LastUpdate  int32
}

RecordObject A record of a device sensor

type StatusType

type StatusType int

StatusType the status of a device

const (
	//StatusConnected Device is connected
	StatusConnected StatusType = iota
	//StatusDisconnected Device is not connected
	StatusDisconnected
)

Jump to

Keyboard shortcuts

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