Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrPortRequired is returned when GOZNP_PORT is not set. ErrPortRequired = ConfigError("GOZNP_PORT environment variable is required") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Adapter configuration
Port string // GOZNP_PORT (required)
BaudRate int // GOZNP_BAUD_RATE (default: 115200)
// HTTP server configuration
HTTPAddr string // GOZNP_HTTP_ADDR (default: :8080)
// Logging configuration
LogLevel string // GOZNP_LOG_LEVEL (default: info)
// Device polling configuration
PollInterval time.Duration // GOZNP_POLL_INTERVAL (default: 5m)
// Message listener configuration
ListenTimeout time.Duration // GOZNP_LISTEN_TIMEOUT (default: 100ms)
// Network configuration
PermitJoinDuration uint8 // GOZNP_PERMIT_JOIN_DURATION (default: 255 = always)
}
Config holds configuration for goznpd. All values are loaded from environment variables with reasonable defaults.
func Load ¶
Load loads configuration from environment variables. Returns an error if required variables are missing.
func (*Config) ToSerialConfig ¶
ToSerialConfig converts Config to serial.Config.
type ConfigError ¶
type ConfigError string
ConfigError represents a configuration error.
func (ConfigError) Error ¶
func (e ConfigError) Error() string
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server manages the HTTP server and associated components.
func NewServer ¶
func NewServer(cfg *Config, adapter *adapter.Adapter, manager *state.Manager, eventBus *event.Bus, listener *message.Listener, logger *slog.Logger) *Server
NewServer creates a new daemon server.
Click to show internal directories.
Click to hide internal directories.