common

package
v0.0.0-...-475e089 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2017 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Modbus    = "modbus"
	ModbusTCP = "modbusTCP"
	ModbusRTU = "modbusRTU"
	OPCUA     = "OPCUA"
)

Protocol/Fieldbus Definitions

Variables

This section is empty.

Functions

func BusChannel

func BusChannel(topic string) chan interface{}

BusChannel returns the channel associated with the topic. This is useful for 'select' operations in which a loop is blocked on the channel.

func SendBusMessage

func SendBusMessage(topic string, message interface{})

SendBusMessage sends the supplied message into the bus channel topic. If no listeners are waiting on the topic, this call is a no-op (as there is no store and forward)

func WaitForBusMessage

func WaitForBusMessage(topic string) interface{}

WaitForBusMessage blocks until receiving a message on bus channel topic. It returns what ever primitive or object was sent.

Types

type Asset

type Asset struct {
	MachineID  string `json:"machineId"`
	Serial     string `json:"serial,omitempty"`
	Type       string `json:"type,omitempty"`
	Entity     string `json:"entity,omitempty"`
	Location   string `json:"location,omitempty"`
	Group      string `json:"group,omitempty"`
	Line       string `json:"line,omitempty"`
	WorkCenter string `json:"workCenter,omitempty"`
}

Asset uniquely identifies a machine/piece of equipment

var AssetConfig Asset

AssetConfig stores the global Asset configuration object

type ConnectionRecord

type ConnectionRecord struct {
	Provider    string `json:"provider"`
	Type        string `json:"type"`
	Endpoint    string `json:"endpoint"`
	Port        int    `json:"port"`
	Protocol    string `json:"protocol"`
	ProviderKey string `json:"providerKey, omitempty"`
	Baudrate    int    `json:"baudRate, omitempty"`
}

ConnectionRecord defines fieldbus and IIoT integration specifics

type Connections

type Connections struct {
	DeviceID                          string             `json:"deviceId"`
	DeviceStateConnections            []ConnectionRecord `json:"deviceState"`
	HistorianConnections              []ConnectionRecord `json:"historian"`
	MachineConnections                []ConnectionRecord `json:"machineIntegration"`
	OperationsAndTelemetryConnections []ConnectionRecord `json:"machineOperationsAndTelemetry"`
}

Connections defines the arrays of ConnectionRecords defined for the system

var ConnectionConfig Connections

ConnectionConfig stores the global Connection configuration object

func (Connections) GetMachineConnection

func (conn Connections) GetMachineConnection(class string) (record ConnectionRecord)

GetMachineConnection returns a ConnectionRecord from the stored MachineConnections that matches the supplied class

type Equipment

type Equipment struct {
	Ref                 string             `json:"ref"`
	URI                 string             `json:"uri"`
	Entity              string             `json:"entity"`
	Models              []string           `json:"models"`
	Versions            []string           `json:"versions"`
	Desc                MLMap              `json:"desc"`
	MachineIntegrations MachineIntegration `json:"machineIntegration"`
	ErrorCodes          []ErrorCode        `json:"errorCodes"`
	MaintenanceOps      []Maintenance      `json:"maintenance"`
}

Equipment collects configuration information about a machien

var EquipmentConfig Equipment

EquipmentConfig stores the global Equipment configuration object

type ErrorCode

type ErrorCode struct {
	Code string `json:"code"`
	Desc MLMap  `json:"desc"`
}

ErrorCode maps codes to (i18n) descriptions

type MLMap

type MLMap map[string]string

MLMap provides i18n support

type MachineIntegration

type MachineIntegration struct {
	ModbusEntries []ModbusEntry `json:"modbus,omitempty"`
}

MachineIntegration houses fieldbus integration configuration information

func (MachineIntegration) FindModbusEntriesByClass

func (machineIntegration MachineIntegration) FindModbusEntriesByClass(class string) (entries []ModbusEntry)

FindModbusEntriesByClass returns all ModbusEntry 's defined in the equipment configuration using the class of entry as a search parameter. If no entries are found, an empty slice is returned.

func (MachineIntegration) FindModbusEntriesByFunction

func (machineIntegration MachineIntegration) FindModbusEntriesByFunction(functions []int) (entries []ModbusEntry)

FindModbusEntriesByFunction returns all ModbusEntry 's defined in the equipment configuration object using the modbus function type as a search parameter. If no entries are found, an empty slice is returned.

type Maintenance

type Maintenance struct {
	ID       string `json:"id"`
	Title    MLMap  `json:"title"`
	Desc     MLMap  `json:"desc"`
	Interval string `json:"interval"`
	URI      string `json:"uri"`
}

Maintenance defines a maintenance entry for specific equipment

type ModbusEntry

type ModbusEntry struct {
	RegisterName string `json:"registerName"`
	Address      int    `json:"address"`
	Class        string `json:"class"`
	Desc         MLMap  `json:"desc"`
	Functions    []int  `json:"functions"`
}

ModbusEntry defines a single modbus port's configuration information

type Service

type Service struct {
	Name         string
	ServiceState int
	// contains filtered or unexported fields
}

A Service is goroutine-based 'process' that attempts to create fault-tolerant, recoverable services

func (*Service) AddServiceDependentUpon

func (svc *Service) AddServiceDependentUpon(name string)

AddServiceDependentUpon adds the name of a service that this service is dependent upon. Multiple names can be added.

func (*Service) Detail

func (svc *Service) Detail() string

Detail returns information about the Service

func (*Service) Serve

func (svc *Service) Serve()

Serve satisfies the interface defined by suture.

func (*Service) State

func (svc *Service) State() int

State satisfies the interface defined by suture.

func (*Service) Stop

func (svc *Service) Stop()

Stop satisfies the interface defined by suture.

func (*Service) String

func (svc *Service) String() string

func (*Service) WaitForServices

func (svc *Service) WaitForServices() bool

WaitForServices will block the execution of Service until dependent Services are running normally.

type Set

type Set map[interface{}]bool

Set conveniently typedefs map[interface{}]bool

func NewSet

func NewSet() *Set

NewSet constructs a new Set

func (*Set) Add

func (set *Set) Add(x interface{})

Add the supplied argument to the set

func (*Set) Do

func (set *Set) Do(f func(interface{}))

Do runs the supplied function across all members of set

func (*Set) Has

func (set *Set) Has(x interface{}) bool

Has tests the set for the supplied argument

func (*Set) Len

func (set *Set) Len() int

Len returns the number of elements in the Set

func (*Set) Map

func (set *Set) Map(f func(interface{}) interface{}) *Set

Map applies the results of the supplied function, using the set's members as arguments, and returns those results in a new Set.

func (*Set) MarshalJSON

func (set *Set) MarshalJSON() ([]byte, error)

MarshalJSON returns a JSON encoded representation of the Set

func (*Set) Remove

func (set *Set) Remove(x interface{})

Remove the supplied argument to the set

func (*Set) Reset

func (set *Set) Reset()

Reset the set to empty

func (*Set) UnmarshalJSON

func (set *Set) UnmarshalJSON(body []byte) (err error)

UnmarshalJSON adds passed JSON-encoded body to the Set.

type SystemState

type SystemState struct {
	Timestamp      time.Time `json:"timeStamp"`
	MemoryConsumed float64   `json:"memoryConsumed"`
	DiskConsumed   float64   `json:"diskConsumed"`
	LoadAverage    float64   `json:"loadAverage"`
}

SystemState defines consumed system resources in time

func GetSystemState

func GetSystemState() (state *SystemState)

GetSystemState returns consumed system resources in time

Jump to

Keyboard shortcuts

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