Documentation
¶
Index ¶
Constants ¶
View Source
const ( //OPCDataSource defines constants for Sources when reading data from OPC: //Default implementation is OPCCache. //From the cache OPCCache int32 = 1 //From the device OPCDevice int32 = 2 //OPCQuality defines the quality of the OPC items: //Bad OPCQualityBad int16 = 0 //Good OPCQualityGood int16 = 192 OPCQualityGoodButForced int16 = 216 //Maks OPCQualityMask int16 = 192 //Uncertain OPCQualityUncertain int16 = 64 //OPCServerState defines the state of the server: //Disconnected OPCDisconnected int32 = 6 //Failed OPCFailed int32 = 2 //Noconfig OPCNoconfig int32 = 3 //Running OPCRunning int32 = 1 //Suspended OPCSuspended int32 = 4 //Test OPCTest int32 = 5 )
Variables ¶
This section is empty.
Functions ¶
func CollectTags ¶
CollectTags traverses tree and collects all tags in string slice
func SetLogWriter ¶
SetLogWriter sets a user-defined writer for logger
func StartMonitoring ¶
func StartMonitoring(port string)
StartMonitoring exposes /metrics to Prometheus
Types ¶
type Collector ¶
type Collector interface {
Get(string) (interface{}, bool)
Sync(Connection, time.Duration) io.Closer
}
Collector interface
type Connection ¶
type Connection interface {
Add(...string) error
Remove(string)
Read() map[string]Item
ReadItem(string) Item
Tags() []string
Write(string, interface{}) error
Close()
}
Connection represents the interface for the connection to the OPC server.
type Item ¶
type Item struct {
GUID string `json:"GUID"`
PropertyName string `json:"property_name"`
Value interface{} `json:"value"`
ValueType string `json:"value_type"`
Version int `json:"version"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Item stores the result of an OPC item from the OPC server.
Click to show internal directories.
Click to hide internal directories.