Documentation
¶
Index ¶
- func Get(name TaskType) (func(map[string]interface{}) (TaskHandler, error), error)
- type HttpHandler
- type HttpResult
- type KEBAHandler
- type KebaResult
- type ModbusHandler
- type ModbusResult
- type MqttHandler
- type PingHandler
- type Result
- type ResultDetails
- type SMAHandler
- type SmaResult
- type Task
- type TaskHandler
- func HttpHandlerFactory(conf map[string]interface{}) (TaskHandler, error)
- func KEBAHandlerFactory(conf map[string]interface{}) (TaskHandler, error)
- func ModbusHandlerFactory(conf map[string]interface{}) (TaskHandler, error)
- func MqttHandlerFactory(conf map[string]interface{}) (TaskHandler, error)
- func PingHandlerFactory(conf map[string]interface{}) (TaskHandler, error)
- func SMAHandlerFactory(conf map[string]interface{}) (TaskHandler, error)
- func TcpHandlerFactory(conf map[string]interface{}) (TaskHandler, error)
- type TaskHandlerRegistry
- type TaskType
- type TcpHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HttpHandler ¶
type HttpHandler struct {
Port int
Schema, Method, Path string
Codes []int
Header map[string]string
ResponseHeader map[string]string
Jq string
Timeout time.Duration
// contains filtered or unexported fields
}
func (*HttpHandler) Test ¶
func (h *HttpHandler) Test(log *util.Logger, in ResultDetails) []ResultDetails
type HttpResult ¶
type HttpResult struct {
Jq interface{}
}
type KEBAHandler ¶
func (*KEBAHandler) Test ¶
func (h *KEBAHandler) Test(log *util.Logger, in ResultDetails) []ResultDetails
type KebaResult ¶
type KebaResult struct {
Addr, Serial string
}
type ModbusHandler ¶
type ModbusHandler struct {
Port int
IDs []uint8
Models []int
Point string
Register modbus.Register `mapstructure:",squash"`
Values []int
Invalid []int
Timeout time.Duration
// contains filtered or unexported fields
}
func (*ModbusHandler) Test ¶
func (h *ModbusHandler) Test(log *util.Logger, in ResultDetails) (res []ResultDetails)
type ModbusResult ¶
type ModbusResult struct {
SlaveID uint8
Model int `json:",omitempty"`
Point string `json:",omitempty"`
Value interface{} `json:",omitempty"`
}
func (*ModbusResult) Configuration ¶
func (r *ModbusResult) Configuration(handler TaskHandler, res Result) map[string]interface{}
type MqttHandler ¶
func (*MqttHandler) Test ¶
func (h *MqttHandler) Test(log *util.Logger, in ResultDetails) []ResultDetails
type PingHandler ¶
func (*PingHandler) Test ¶
func (h *PingHandler) Test(log *util.Logger, in ResultDetails) []ResultDetails
type Result ¶
type Result struct {
Task
ResultDetails
Attributes map[string]interface{} // TODO remove, only used for post-processing
}
type ResultDetails ¶
type ResultDetails struct {
IP string
Port int `json:",omitempty"`
Topic string `json:",omitempty"`
ModbusResult *ModbusResult `json:",omitempty"`
KebaResult *KebaResult `json:",omitempty"`
SmaResult *SmaResult `json:",omitempty"`
}
func (*ResultDetails) Clone ¶
func (d *ResultDetails) Clone() ResultDetails
type SMAHandler ¶
type SMAHandler struct {
Timeout time.Duration
Password string
// contains filtered or unexported fields
}
func (*SMAHandler) Test ¶
func (h *SMAHandler) Test(log *util.Logger, in ResultDetails) (res []ResultDetails)
type Task ¶
type Task struct {
ID string
Type TaskType
Depends string
Config map[string]interface{}
TaskHandler
}
type TaskHandler ¶
type TaskHandler interface {
Test(log *util.Logger, in ResultDetails) []ResultDetails
}
func HttpHandlerFactory ¶
func HttpHandlerFactory(conf map[string]interface{}) (TaskHandler, error)
func KEBAHandlerFactory ¶
func KEBAHandlerFactory(conf map[string]interface{}) (TaskHandler, error)
func ModbusHandlerFactory ¶
func ModbusHandlerFactory(conf map[string]interface{}) (TaskHandler, error)
func MqttHandlerFactory ¶
func MqttHandlerFactory(conf map[string]interface{}) (TaskHandler, error)
func PingHandlerFactory ¶
func PingHandlerFactory(conf map[string]interface{}) (TaskHandler, error)
func SMAHandlerFactory ¶
func SMAHandlerFactory(conf map[string]interface{}) (TaskHandler, error)
func TcpHandlerFactory ¶
func TcpHandlerFactory(conf map[string]interface{}) (TaskHandler, error)
type TaskHandlerRegistry ¶
type TaskHandlerRegistry map[TaskType]func(map[string]interface{}) (TaskHandler, error)
func (TaskHandlerRegistry) Add ¶
func (r TaskHandlerRegistry) Add(name TaskType, factory func(map[string]interface{}) (TaskHandler, error))
type TaskType ¶
type TaskType string
const Http TaskType = "http"
const Keba TaskType = "keba"
const Modbus TaskType = "modbus"
const Mqtt TaskType = "mqtt"
const Ping TaskType = "ping"
const Sma TaskType = "sma"
const Tcp TaskType = "tcp"
type TcpHandler ¶
type TcpHandler struct {
Ports []int
Timeout time.Duration
// contains filtered or unexported fields
}
func (*TcpHandler) Test ¶
func (h *TcpHandler) Test(log *util.Logger, in ResultDetails) (res []ResultDetails)
Click to show internal directories.
Click to hide internal directories.