device

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Automatable

type Automatable interface {
	DeviceServer
	GenerateValues(simTime time.Time)
}

Automatable extends DeviceServer with time-based value generation

type Category

type Category string

Category represents the high-level device category

const (
	CategoryInverter    Category = "inverter"
	CategoryV2XCharger  Category = "v2x_charger"
	CategoryOCPPCharger Category = "ocpp_charger"
)

type DeviceServer

type DeviceServer interface {
	// Lifecycle
	Start() error
	Stop() error

	// State management
	GetState() map[string]interface{}
	SetValue(key string, value interface{}) error

	// Logging
	GetLogs(limit int) []LogEntry

	// Metadata
	Protocol() Protocol
	Category() Category
	Address() string
	SerialNumber() string
	SetSerialNumber(sn string)
}

DeviceServer is the common interface for all protocol servers

type LogEntry

type LogEntry struct {
	Timestamp time.Time              `json:"timestamp"`
	Operation string                 `json:"operation"`
	Details   map[string]interface{} `json:"details,omitempty"`
	SourceIP  string                 `json:"source_ip,omitempty"`
}

LogEntry represents a protocol operation log entry

type Protocol

type Protocol string

Protocol represents the communication protocol used by a device

const (
	ProtocolModbus Protocol = "modbus"
	ProtocolMQTT   Protocol = "mqtt"
	ProtocolOCPP   Protocol = "ocpp"
)

Jump to

Keyboard shortcuts

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