entities

package
v0.8.11 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

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

	DirectionIn  Direction = 1
	DirectionOut Direction = 2
)
View Source
const (
	ReasonOk                    uint8 = 0
	ReasonSwipePass             uint8 = 0x01
	ReasonPCControl             uint8 = 0x05
	ReasonNoPrivilege           uint8 = 0x06
	ReasonInvalidPIN            uint8 = 0x07
	ReasonAntiPassback          uint8 = 0x08
	ReasonNormallyClosed        uint8 = 0x0b
	ReasonInvalidTimezone       uint8 = 0x0f
	ReasonNoPass                uint8 = 0x12
	ReasonSuperPasswordOpenDoor uint8 = 0x19
	ReasonInterlock             uint8 = 0x21
)
View Source
const DEFAULT_EVENTLIST_CHUNK = 8
View Source
const DEFAULT_EVENTLIST_SIZE = 256

Variables

This section is empty.

Functions

This section is empty.

Types

type AntiPassback added in v0.8.11

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

func MakeAntiPassback added in v0.8.11

func MakeAntiPassback(antipassback types.AntiPassback) AntiPassback

func (AntiPassback) Allow added in v0.8.11

func (a AntiPassback) Allow(card uint32, door uint8) bool

func (*AntiPassback) Allowed added in v0.8.11

func (a *AntiPassback) Allowed(card uint32, door uint8)

func (AntiPassback) Get added in v0.8.11

func (a AntiPassback) Get() uint8

func (AntiPassback) MarshalJSON added in v0.8.11

func (a AntiPassback) MarshalJSON() ([]byte, error)

func (*AntiPassback) Set added in v0.8.11

func (a *AntiPassback) Set(antipassback uint8) bool

func (*AntiPassback) UnmarshalJSON added in v0.8.11

func (a *AntiPassback) UnmarshalJSON(bytes []byte) error

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"`
	PIN        uint32          `json:"PIN,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 Direction added in v0.8.6

type Direction uint8

func (Direction) String added in v0.8.6

func (d Direction) String() string

type Door

type Door struct {
	ControlState uint8    `json:"control"`
	Delay        Delay    `json:"delay"`
	Passcodes    []uint32 `json:"passcodes,omitempty"`
	// 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

func (*Door) UnlockWithPasscode added in v0.8.7

func (d *Door) UnlockWithPasscode(passcode uint32, duration time.Duration) bool

type Doors added in v0.8.5

type Doors struct {
	Interlock uint8
	// contains filtered or unexported fields
}

func MakeDoors added in v0.8.5

func MakeDoors() Doors

func (*Doors) Close added in v0.8.5

func (dd *Doors) Close(door uint8, closed func()) bool

func (*Doors) ControlState added in v0.8.5

func (dd *Doors) ControlState(door uint8) uint8

func (*Doors) Delay added in v0.8.5

func (dd *Doors) Delay(door uint8) Delay

func (*Doors) EnableButton added in v0.8.5

func (dd *Doors) EnableButton(door uint8, enabled bool) bool

func (*Doors) EnableProfile added in v0.8.5

func (dd *Doors) EnableProfile(door uint8, enabled bool) bool

func (*Doors) IsButtonPressed added in v0.8.5

func (dd *Doors) IsButtonPressed(door uint8) bool

func (*Doors) IsInterlocked added in v0.8.5

func (dd *Doors) IsInterlocked(door uint8) bool

func (*Doors) IsNormallyClosed added in v0.8.5

func (dd *Doors) IsNormallyClosed(door uint8) bool

func (*Doors) IsOpen added in v0.8.5

func (dd *Doors) IsOpen(doors ...uint8) bool

func (*Doors) IsProfileDisabled added in v0.8.5

func (dd *Doors) IsProfileDisabled(door uint8) bool

func (*Doors) IsUnlocked added in v0.8.5

func (dd *Doors) IsUnlocked(door uint8) bool

func (Doors) MarshalJSON added in v0.8.5

func (d Doors) MarshalJSON() ([]byte, error)

func (*Doors) Open added in v0.8.5

func (dd *Doors) Open(door uint8, duration *time.Duration, opened func(uint8), closed func()) bool

func (*Doors) OverrideState added in v0.8.5

func (dd *Doors) OverrideState(door uint8, state uint8) bool

func (*Doors) Passcodes added in v0.8.7

func (dd *Doors) Passcodes(door uint8) []uint32

func (*Doors) PressButton added in v0.8.5

func (dd *Doors) PressButton(door uint8, duration time.Duration) (pressed bool, reason uint8)

func (*Doors) SetControlState added in v0.8.5

func (dd *Doors) SetControlState(door uint8, state uint8)

func (*Doors) SetDelay added in v0.8.5

func (dd *Doors) SetDelay(door uint8, delay Delay)

func (*Doors) SetPasscodes added in v0.8.7

func (dd *Doors) SetPasscodes(door uint8, passcodes ...uint32)

func (Doors) String added in v0.8.8

func (d Doors) String() string

func (*Doors) Unlock added in v0.8.5

func (dd *Doors) Unlock(door uint8, duration time.Duration) bool

func (*Doors) UnlockWithPasscode added in v0.8.7

func (dd *Doors) UnlockWithPasscode(door uint8, passcode uint32, duration time.Duration) bool

func (*Doors) UnmarshalJSON added in v0.8.5

func (d *Doors) UnmarshalJSON(bytes []byte) error

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)

func (*Event) UnmarshalJSON added in v0.7.2

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

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 NewEventList added in v0.8.3

func NewEventList() EventList

func (*EventList) Add

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

func (*EventList) Clear added in v0.8.8

func (l *EventList) Clear() bool

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) Size

func (l EventList) Size() int

func (*EventList) UnmarshalJSON added in v0.7.2

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

type Keypad added in v0.8.6

type Keypad uint8
const (
	KeypadNone Keypad = 0
	KeypadIn   Keypad = 1
	KeypadOut  Keypad = 2
	KeypadBoth Keypad = 3
)

type Keypads added in v0.8.6

type Keypads map[uint8]Keypad

func MakeKeypads added in v0.8.6

func MakeKeypads() Keypads

func (*Keypads) UnmarshalJSON added in v0.8.6

func (k *Keypads) UnmarshalJSON(bytes []byte) error

type Message

type Message struct {
	Destination *net.UDPAddr
	Message     any
	Event       bool
}

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,omitempty"`
	// 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