simulator

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	BindAddress string
	DeviceList  DeviceList
	Directory   string
	RestAddress string
}

type DeviceList

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

func NewDeviceList

func NewDeviceList(l []Simulator) DeviceList

func (*DeviceList) Add

func (l *DeviceList) Add(deviceID uint32, compressed bool, dir string) (bool, error)

func (*DeviceList) Apply

func (l *DeviceList) Apply(f func(Simulator))

func (*DeviceList) Delete

func (l *DeviceList) Delete(deviceID uint32) error

func (*DeviceList) Find

func (l *DeviceList) Find(deviceID uint32) Simulator

type Simulator

type Simulator interface {
	DeviceID() uint32
	DeviceType() string
	FilePath() string

	Handle(messages.Request) (any, error)
	Tick()
	RunTasks()
	Save() error
	Delete() error

	Swipe(cardNumber uint32, door uint8, direction entities.Direction, PIN uint32) (bool, error)
	Passcode(door uint8, passcode uint32) (bool, error)
	Open(door uint8) (bool, error)
	Close(door uint8) (bool, error)
	ButtonPressed(door uint8, duration time.Duration) (bool, error)
	StoreCard(card uint32, from types.Date, to types.Date, doors []uint8, PIN uint32) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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