keba

package
v0.0.0-...-2668f05 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Port is the KEBA UDP port
	Port = 7090

	// OK is the KEBA confirmation message
	OK = "TCH-OK :done"

	// Any subscriber receives all messages
	Any = "<any>"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Listener

type Listener struct {
	// contains filtered or unexported fields
}

Listener singleton listens for KEBA UDP messages

func Instance

func Instance(log *util.Logger) (*Listener, error)

func New

func New(log *util.Logger) (*Listener, error)

New creates a UDP listener that clients can subscribe to

func (*Listener) Subscribe

func (l *Listener) Subscribe(addr string, c chan<- UDPMsg)

Subscribe adds a client address or serial and message channel to the list of subscribers

type RFID

type RFID struct {
	Tag string
}

RFID contains access credentials

type Report

type Report struct {
	ID     int    `json:"ID,string"`
	Serial string `json:"Serial"`
}

Report contains report id and device serial

type Report1

type Report1 struct {
	ID        int    `json:"ID,string"`
	Serial    string `json:"Serial"`
	Product   string `json:"Product"`
	Firmware  string `json:"Firmware"`
	COMModule int    `json:"COM-module"`
	Sec       int64  `json:"Sec"`
}

Report1 is the report 1 command answer

type Report100

type Report100 struct {
	ID        int    `json:"ID,string"`
	Serial    string `json:"Serial"`
	SessionID int64  `json:"SessionID"`
	CurrHW    int    `json:"Curr HW"`
	EStart    int64  `json:"E start"`
	EPres     int64  `json:"E pres"`
	Started   string `json:"started"`
	Ended     string `json:"ended"`
	StartedS  int64  `json:"started[s]"`
	EndedS    int64  `json:"ended[s]"`
	Reason    int    `json:"reason"`
	TimeQ     int    `json:"timeQ"`
	RFIDTag   string `json:"RFID tag"`
	RFIDClass string `json:"RFID class"`
	Sec       int64  `json:"Sec"`
}

Report100 is the report 100 command answer

type Report2

type Report2 struct {
	ID             int    `json:"ID,string"`
	Serial         string `json:"Serial"`
	State          int    `json:"State"`
	Error1         int    `json:"Error1"`
	Error2         int    `json:"Error2"`
	Plug           int    `json:"Plug"`
	AuthON         int    `json:"AuthON"`
	AuthReq        int    `json:"Authreq"`
	EnableSys      int    `json:"Enable sys"`
	EnableUser     int    `json:"Enable user"`
	MaxCurr        int    `json:"Max curr"`
	MaxCurrPercent int    `json:"Max curr %"`
	CurrHW         int    `json:"Curr HW"`
	Curruser       int    `json:"Curr user"`
	CurrFS         int    `json:"Curr FS"`
	TmoFS          int    `json:"Tmo FS"`
	CurrTimer      int    `json:"Curr timer"`
	TmoCT          int    `json:"Tmo CT"`
	SetEnergy      int    `json:"Setenergy"`
	Output         int    `json:"Output"`
	Input          int    `json:"Input"`
	Sec            int64  `json:"Sec"`
}

Report2 is the report 2 command answer

type Report3

type Report3 struct {
	ID     int    `json:"ID,string"`
	Serial string `json:"Serial"`
	U1     int64  `json:"U1"`
	U2     int64  `json:"U2"`
	U3     int64  `json:"U3"`
	I1     int64  `json:"I1"`
	I2     int64  `json:"I2"`
	I3     int64  `json:"I3"`
	P      int64  `json:"P"`
	PF     int64  `json:"PF"`
	EPres  int64  `json:"E pres"`
	ETotal int64  `json:"E total"`
	Sec    int64  `json:"Sec"`
}

Report3 is the report 3 command answer

type Sender

type Sender struct {
	// contains filtered or unexported fields
}

Sender is a KEBA UDP sender

func NewSender

func NewSender(log *util.Logger, addr string) (*Sender, error)

NewSender creates KEBA UDP sender

func (*Sender) Send

func (c *Sender) Send(msg string) error

Send msg to receiver

type UDPMsg

type UDPMsg struct {
	Addr    string
	Message []byte
	Report  *Report
}

UDPMsg transports the KEBA response. Report is any of Report1,2,3

Jump to

Keyboard shortcuts

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