entities

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NormallyOpen   = uint8(1)
	NormallyClosed = uint8(2)
	Controlled     = uint8(3)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Card

type Card struct {
	CardNumber uint32          `json:"card"`
	From       *types.Date     `json:"from,omitempty"`
	To         *types.Date     `json:"to,omitempty"`
	Doors      map[uint8]uint8 `json:"doors,omitempty"`
}

type CardList

type CardList [64]*Card

func (*CardList) Delete

func (l *CardList) Delete(cardNumber uint32) bool

func (*CardList) DeleteAll

func (l *CardList) DeleteAll() bool

func (CardList) MarshalJSON added in v0.7.0

func (l CardList) MarshalJSON() ([]byte, error)

func (*CardList) Put

func (l *CardList) Put(card *Card) error

func (*CardList) Size

func (l *CardList) Size() uint32

type Delay

type Delay time.Duration

func DelayFromSeconds

func DelayFromSeconds(t uint8) Delay

func (Delay) MarshalJSON

func (delay Delay) MarshalJSON() ([]byte, error)

func (Delay) Seconds

func (delay Delay) Seconds() uint8

func (*Delay) UnmarshalJSON

func (delay *Delay) UnmarshalJSON(bytes []byte) error

type Door

type Door struct {
	ControlState uint8 `json:"control"`
	Delay        Delay `json:"delay"`
	// contains filtered or unexported fields
}

func NewDoor

func NewDoor(id uint8) *Door

func (*Door) Close added in v0.6.7

func (d *Door) Close(closed func()) bool

func (*Door) EnableButton added in v0.7.1

func (d *Door) EnableButton(enabled bool) bool

func (*Door) EnableProfile added in v0.7.1

func (d *Door) EnableProfile(enabled bool) bool

func (*Door) IsButtonPressed

func (d *Door) IsButtonPressed() bool

func (*Door) IsNormallyClosed added in v0.7.1

func (d *Door) IsNormallyClosed() bool

func (*Door) IsOpen

func (d *Door) IsOpen() bool

func (*Door) IsProfileDisabled added in v0.7.1

func (d *Door) IsProfileDisabled() bool

func (*Door) IsUnlocked added in v0.6.7

func (d *Door) IsUnlocked() bool

func (*Door) Open

func (d *Door) Open(duration *time.Duration, opened func(uint8), closed func()) bool

func (*Door) OverrideState added in v0.7.1

func (d *Door) OverrideState(state uint8) bool

func (*Door) PressButton added in v0.6.7

func (d *Door) PressButton(duration time.Duration) (pressed bool, reason uint8)

func (*Door) Unlock added in v0.6.7

func (d *Door) Unlock(duration time.Duration) bool

type Event

type Event struct {
	Index     uint32          `json:"index"`
	Type      uint8           `json:"type"`
	Granted   bool            `json:"granted"`
	Door      uint8           `json:"door"`
	Direction uint8           `json:"direction"`
	Card      uint32          `json:"card"`
	Timestamp *types.DateTime `json:"timestamp,omitempty"`
	Reason    uint8           `json:"reason"`
}

func (Event) MarshalJSON added in v0.7.2

func (e Event) MarshalJSON() ([]byte, error)

PENDING rework of uhpppote-core::DateTime.MarshalJSON

func (*Event) UnmarshalJSON added in v0.7.2

func (e *Event) UnmarshalJSON(b []byte) error

PENDING rework of uhpppote-core::DateTime.UnmarshalJSON

type EventList

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

func MakeEventList added in v0.7.2

func MakeEventList(index uint32, events []Event) EventList

NOTE: no validation - for unit tests only

func (*EventList) Add

func (l *EventList) Add(event Event) uint32

func (*EventList) Get

func (l *EventList) Get(index uint32) Event

func (*EventList) GetIndex added in v0.7.2

func (l *EventList) GetIndex() uint32

func (EventList) MarshalJSON added in v0.7.2

func (l EventList) MarshalJSON() ([]byte, error)

func (*EventList) SetIndex

func (l *EventList) SetIndex(index uint32) bool

func (*EventList) UnmarshalJSON added in v0.7.2

func (l *EventList) UnmarshalJSON(b []byte) error

type Message

type Message struct {
	Destination *net.UDPAddr
	Message     interface{}
}

type Offset

type Offset time.Duration

func (Offset) MarshalJSON

func (t Offset) MarshalJSON() ([]byte, error)

func (*Offset) UnmarshalJSON

func (t *Offset) UnmarshalJSON(bytes []byte) error

type TaskList added in v0.7.1

type TaskList struct {
	Tasks []types.Task `json:"tasks"`
	// contains filtered or unexported fields
}

func (*TaskList) Add added in v0.7.1

func (t *TaskList) Add(task types.Task) bool

func (*TaskList) Clear added in v0.7.1

func (t *TaskList) Clear() bool

func (*TaskList) Refresh added in v0.7.1

func (t *TaskList) Refresh() bool

func (*TaskList) Run added in v0.7.1

func (t *TaskList) Run(handler func(door uint8, task types.TaskType))

type TimeProfiles added in v0.7.0

type TimeProfiles map[uint8]types.TimeProfile

func (TimeProfiles) Clear added in v0.7.0

func (t TimeProfiles) Clear() bool

func (TimeProfiles) Set added in v0.7.0

func (t TimeProfiles) Set(profile types.TimeProfile) bool

Jump to

Keyboard shortcuts

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