state

package
v0.0.0-...-1f1d11f Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FreifunkState

type FreifunkState struct {
	ClientCount uint
	Timestamp   int64
}

type MqttState

type MqttState struct {
	Connected         bool `json:"connected"`
	SpaceBrokerOnline bool `json:"spaceBrokerOnline"`
}

type OpenState

type OpenState struct {
	Keyholder string
	Space     *OpenValueTs
	Radstelle *OpenValueTs
	Lab3d     *OpenValueTs
	Machining *OpenValueTs
}

func (*OpenState) OpenStateForEvent

func (os *OpenState) OpenStateForEvent(event events.EventName) (*OpenValueTs, error)

type OpenValue

type OpenValue string
const (
	NONE      OpenValue = "none"
	KEYHOLDER OpenValue = "keyholder"
	MEMBER    OpenValue = "member"
	OPEN      OpenValue = "open"
	OPEN_PLUS OpenValue = "open+"

	// this state don't come from the mqtt, it's calculated based on open and next_open state
	CLOSING OpenValue = "closing"
)

func ParseOpenValue

func ParseOpenValue(value string) (OpenValue, error)

func (*OpenValue) IsPublicOpen

func (h *OpenValue) IsPublicOpen() bool

type OpenValueTs

type OpenValueTs struct {
	Value     OpenValue `json:"state"`
	Timestamp int64     `json:"timestamp"`
}

type PowerUsageState

type PowerUsageState struct {
	Front     *PowerValueTs `json:"front"`
	Back      *PowerValueTs `json:"back"`
	Machining *PowerValueTs `json:"machining"`
}

type PowerValueTs

type PowerValueTs struct {
	Value     float64 `json:"value"`
	Timestamp int64   `json:"timestamp"`
}

type SpaceDevicesState

type SpaceDevicesState struct {
	structs.PeopleAndDevices
	Timestamp int64 `json:"timestamp"`
}

type State

type State struct {
	Mqtt         *MqttState
	Open         *OpenState
	SpaceDevices *SpaceDevicesState
	PowerUsage   *PowerUsageState
	Freifunk     *FreifunkState
}

func NewDefaultState

func NewDefaultState() *State

Jump to

Keyboard shortcuts

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