alarm

package
v0.0.0-...-fc663ca Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ALARM_EMERGENCY_STOP = 1

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveList

type ActiveList struct {
	Items map[string]Message `json:"items"`
	Id    int                `json:"id"`
	// contains filtered or unexported fields
}

func NewActiveList

func NewActiveList(kv Persistent) *ActiveList

func (*ActiveList) CheckIfExists

func (c *ActiveList) CheckIfExists(m Message) (Message, int, bool)

returns Uid or -1

func (*ActiveList) Save

func (c *ActiveList) Save()

func (*ActiveList) Update

func (c *ActiveList) Update(m Message) Message

type Alarm

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

func NewAlarm

func NewAlarm(kv Storage, mq MQClient, area string, hub Hub) *Alarm

func (*Alarm) GetRouter

func (a *Alarm) GetRouter() http.Handler

func (*Alarm) MQTT_ConnectHandler

func (a *Alarm) MQTT_ConnectHandler()

type Hub

type Hub interface {
	Pub(header string, body interface{})
}

type MQClient

type MQClient interface {
	Publish(topic string, msg interface{})
	PublishRetained(topic string, msg interface{}) error
	Subscribe(topic string, handler func(topic string, payload []byte)) error
	Unsubscribe(topics ...string) error
	SetConnectHandler(func())
}

type Message

type Message struct {
	Id        int         `json:"ID"`
	Value     int         `json:"Value"`
	Message   string      `json:"Message"`
	TimeEvent *TimeStruct `json:"TimeEvent,omitempty"`
	TimeAck   *TimeStruct `json:"TimeAck,omitempty"`

	UId      int    `json:"uid"`
	LineId   string `json:"line_id"`
	ModuleId string `json:"module_id"`
	Resolved bool   `json:"resolved,omitempty"`
}

type Persistent

type Persistent interface {
	Backup(key string, obj interface{}) error  //put
	Restore(key string, obj interface{}) error //get
}

type Storage

type Storage interface {
	Backup(key string, obj interface{}) error  //put
	Restore(key string, obj interface{}) error //get
	Remove(key string) error
	GetByPrefix(pref string) map[string]string
}

type TimeStruct

type TimeStruct struct {
	AlmDate string `json:"AlmDate,omitempty"`
	AlmTime string `json:"AlmTime,omitempty"`
}

Jump to

Keyboard shortcuts

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