capture

package module
v0.0.0-...-d14293b Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Pub pubsub

Functions

func Add

func Add(spec CycleSpec) error

func AddSubscriptor

func AddSubscriptor(id string, subscriptor transport.Subscriptor) error

func Define

func Define(spec CycleSpec) (string, error)

func DefineSubscriptor

func DefineSubscriptor(id string, subscriptor transport.Subscriptor) (string, error)

func GetCycles

func GetCycles() map[string]CycleSpec

func GetDevices

func GetDevices() map[string]Device

func GetSubscriptor

func GetSubscriptor(id string, subID string) (transport.Subscriptor, error)

func GetSubscriptors

func GetSubscriptors(id string) (map[string]transport.Subscriptor, error)

func GetSubscriptorsIds

func GetSubscriptorsIds(id string) ([]string, error)

func HasEnabledReports

func HasEnabledReports() bool

func Undefine

func Undefine(id string) error

func UndefineSubscriptor

func UndefineSubscriptor(id string, subID string) error

func Update

func Update(spec CycleSpec) error

func UpdateSubscriptor

func UpdateSubscriptor(id string, subID string, spec transport.Subscriptor) error

Types

type AdapterReport

type AdapterReport struct {
	ApplicationID     string          `json:"applicationId,omitempty"`
	ReportName        string          `json:"reportName,omitempty"`
	Date              time.Time       `json:"date,omitempty"`
	TotalMilliseconds int64           `json:"totalMilliseconds,omitempty"`
	Initiation        Initiation      `json:"initiation,omitempty"`
	Initiator         string          `json:"initiator,omitempty"`
	Termination       Termination     `json:"termination,omitempty"`
	Terminator        string          `json:"terminator,omitempty"`
	Devices           []*DeviceReport `json:"devices,omitempty"`
}

type CaptureData

type CaptureData struct {
	Date   time.Time   `json:"date,omitempty"`
	Device string      `json:"device,omitempty"`
	Field  string      `json:"field,omitempty"`
	Value  interface{} `json:"Value,omitempty"`
}

type CommonCycle

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

type CycleConfiguration

type CycleConfiguration struct {
	Devices      map[string]Device                           `json:"devices"`
	Cycles       map[string]CycleSpec                        `json:"cycles"`
	Subscriptors map[string]map[string]transport.Subscriptor `json:"subscriptors"`
	// contains filtered or unexported fields
}

func GetConfig

func GetConfig() *CycleConfiguration

func (*CycleConfiguration) AddDevice

func (c *CycleConfiguration) AddDevice(dev Device) (string, error)

func (*CycleConfiguration) GetDevice

func (c *CycleConfiguration) GetDevice(id string) (Device, error)

func (*CycleConfiguration) SetDevice

func (c *CycleConfiguration) SetDevice(dev Device) error

func (*CycleConfiguration) SetDeviceField

func (c *CycleConfiguration) SetDeviceField(devId string, field Field) error

type CycleSpec

type CycleSpec struct {
	ID                     string              `json:"id,omitempty"`
	ApplicationID          string              `json:"applicationId,omitempty"`
	Name                   string              `json:"name,omitempty"`
	Enabled                bool                `json:"enabled,omitempty"`
	Duration               int64               `json:"duration"`
	RepeatPeriod           int64               `json:"repeatPeriod"`
	Interval               int                 `json:"interval,omitempty"`
	WhenDataAvailable      bool                `json:"whenDataAvailable,omitempty"`
	WhenDataAvailableDelay int                 `json:"WhenDataAvailableDelay,omitempty"`
	ReportIfEmpty          bool                `json:"reportIfEmpty,omitempty"`
	FieldSubscriptions     map[string][]string `json:"fieldSubscriptions"`
}

func GetCycle

func GetCycle(id string) (CycleSpec, error)

type Device

type Device struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Label   string `json:"label"`
	Enabled bool   `json:"enabled,omitempty"`

	Properties map[string]string `json:"properties,omitempty"`
	Fields     map[string]Field  `json:"fields,omitempty"`
}

Device Adapter device

func GetDevice

func GetDevice(id string) (Device, error)

type DeviceReport

type DeviceReport struct {
	Name   string         `json:"name,omitempty"`
	Fields []*FieldReport `json:"fields,omitempty"`
}

type Field

type Field struct {
	ID         string            `json:"id"`
	Name       string            `json:"name"`
	Label      string            `json:"label"`
	Properties map[string]string `json:"properties,omitempty"`
	Value      interface{}       `json:"value,omitempty"`
}

Field Device Field

type FieldReport

type FieldReport struct {
	Date  time.Time   `json:"date,omitempty"`
	Name  string      `json:"name,omitempty"`
	Value interface{} `json:"value,omitempty"`
}

type Initiation

type Initiation string
const (
	NULLINITIATION Initiation = "NULL"

	// UNDEFINE Cycle was undefined
	UNDEFINE Initiation = "UNDEFINE"

	// TRIGGER A trigger occurred
	TRIGGER Initiation = "TRIGGER"

	// REPEAT_PERIOD Repeat period expired
	REPEAT_PERIOD Initiation = "REPEAT_PERIOD"

	// REQUESTED State of cycle changed to requested
	REQUESTED Initiation = "REQUESTED"
)

type State

type State string
const (
	//UNDEFINED Cycle is undefined
	UNDEFINED State = "UNDEFINED"

	//UNREQUESTED Cycle is unrequested
	UNREQUESTED State = "UNREQUESTED"

	//STATEREQUESTED Cycle is requested
	STATEREQUESTED State = "REQUESTED"

	// ACTIVE Cycle is active
	ACTIVE State = "ACTIVE"
)

type Termination

type Termination string
const (
	NULLTERMINATION Termination = "NULL"

	//UNDEFINETERMINATION Cycle was undefined
	UNDEFINETERMINATION Termination = "UNDEFINE"

	//TRIGGERTERMINATION A trigger occurred
	TRIGGERTERMINATION Termination = "TRIGGER"

	//DURATION Duration period expired
	DURATION Termination = "DURATION"

	//INTERVAL Interval time expired
	INTERVAL Termination = "INTERVAL"

	//DATAAVAILABLE New data available
	DATAAVAILABLE Termination = "DATA_AVAILABLE"

	//UNREQUESTEDTERMINATION State of cycle changed to unrequested
	UNREQUESTEDTERMINATION Termination = "UNREQUESTED"

	//ERROR Error occurred
	ERROR Termination = "ERROR"
)

Jump to

Keyboard shortcuts

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