device

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2016 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DOWNLOADING Status = "Downloading"
	INSTALLING         = "Installing"
	STARTING           = "Starting"
	STOPPING           = "Stopping"
	IDLE               = "Idle"
	OFFLINE            = "Offline"
)

Variables

This section is empty.

Functions

func New

func New(deviceType Type, localUUID, UUID, name string, applicationUUID int, applicationName, targetCommit string, config, environment interface{}) error

New creates a new device and puts it into the database

Types

type Device

type Device struct {
	Type            `json:"type"`
	LocalUUID       string      `json:"localUUID"`
	UUID            string      `json:"uuid"`
	Name            string      `json:"name"`
	ApplicationUUID int         `json:"applicationUUID"`
	ApplicationName string      `json:"applicationName"`
	Commit          string      `json:"commit"`
	TargetCommit    string      `json:"targetCommit"`
	Status          Status      `json:"status"`
	Progress        float32     `json:"progress"`
	RestartFlag     bool        `json:"restartFlag"`
	Config          interface{} `json:"config"`
	Environment     interface{} `json:"environment"`
}

Device contains all the variables needed to define a device

func Get

func Get(applicationUUID int, UUID string) (*Device, error)

Get gets a single device for a specific application

func (Device) Cast

func (d Device) Cast() Interface

Cast converts the base device type to its actual type

func (Device) Online

func (d Device) Online() (bool, error)

Online checks if a specific device is online

func (Device) Restart

func (d Device) Restart() error

Restart restarts a specific device

func (*Device) SetStatus

func (d *Device) SetStatus(status Status) []error

SetStatus sets the state for a specific device

func (Device) String

func (d Device) String() string

func (Device) Update

func (d Device) Update(path string) error

Update updates a specific device

type Esp8266

type Esp8266 Device

Esp8266 is an ESP8266 based device https://en.wikipedia.org/wiki/ESP8266

func (Esp8266) Identify

func (d Esp8266) Identify() error

Identify flashes LEDs' on the device

func (Esp8266) Online

func (d Esp8266) Online() (bool, error)

Online checks whether the device is online

func (Esp8266) Restart

func (d Esp8266) Restart() error

Restart restarts the device

func (Esp8266) String

func (d Esp8266) String() string

func (Esp8266) Update

func (d Esp8266) Update(path string) error

Update updates the device following the firmware-over-the-air update process

type FOTA

type FOTA struct {
	// contains filtered or unexported fields
}

FOTA contains all the variables needed during the firmware-over-the-air update process

type Interface

type Interface interface {
	String() string
	Update(path string) error
	Online() (bool, error)
	Restart() error
}

Interface defines the common functions a device must implement

type Nrf51822

type Nrf51822 Device

Nrf51822 is an NRF51822 based device https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF51822

func (Nrf51822) Identify

func (d Nrf51822) Identify() error

Identify flashes LEDs' on the device

func (Nrf51822) Online

func (d Nrf51822) Online() (bool, error)

Online checks whether the device is online

func (Nrf51822) Restart

func (d Nrf51822) Restart() error

Restart restarts the device

func (Nrf51822) String

func (d Nrf51822) String() string

func (Nrf51822) Update

func (d Nrf51822) Update(path string) error

Update updates the device following the firmware-over-the-air update process

type Status

type Status string

Status defines the device states

type Type

type Type struct {
	Micro micro.Type `json:"micro"`
	Radio radio.Type `json:"radio"`
}

Type contains the micro and radio that make up a device type

Jump to

Keyboard shortcuts

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