types

package
v0.8.8 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 10 Imported by: 34

Documentation

Index

Constants

View Source
const BIND_PORT = 0
View Source
const BROADCAST_PORT = 60000
View Source
const DEFAULT_PORT = 60000

Variables

This section is empty.

Functions

This section is empty.

Types

type Address added in v0.7.2

type Address net.UDPAddr

func ResolveAddr added in v0.7.2

func ResolveAddr(s string) (*Address, error)

func (*Address) Clone added in v0.7.2

func (a *Address) Clone() *Address

func (*Address) Equal added in v0.7.2

func (a *Address) Equal(addr *Address) bool

func (*Address) MarshalJSON added in v0.7.2

func (a *Address) MarshalJSON() ([]byte, error)

func (*Address) String added in v0.7.2

func (a *Address) String() string

func (*Address) UnmarshalJSON added in v0.7.2

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

type BindAddr added in v0.7.2

type BindAddr net.UDPAddr

func ResolveBindAddr added in v0.7.2

func ResolveBindAddr(s string) (*BindAddr, error)

func (*BindAddr) Clone added in v0.7.2

func (a *BindAddr) Clone() *BindAddr

func (*BindAddr) Equal added in v0.7.2

func (a *BindAddr) Equal(addr *Address) bool

func (BindAddr) MarshalJSON added in v0.7.2

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

func (*BindAddr) Set added in v0.7.2

func (a *BindAddr) Set(v string) error

func (BindAddr) String added in v0.7.2

func (a BindAddr) String() string

func (*BindAddr) UnmarshalJSON added in v0.7.2

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

type BroadcastAddr added in v0.7.2

type BroadcastAddr net.UDPAddr

func ResolveBroadcastAddr added in v0.7.2

func ResolveBroadcastAddr(s string) (*BroadcastAddr, error)

func (*BroadcastAddr) Clone added in v0.7.2

func (a *BroadcastAddr) Clone() *BroadcastAddr

func (*BroadcastAddr) Equal added in v0.7.2

func (a *BroadcastAddr) Equal(addr *BroadcastAddr) bool

func (BroadcastAddr) MarshalJSON added in v0.7.2

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

func (*BroadcastAddr) Set added in v0.7.2

func (a *BroadcastAddr) Set(v string) error

func (BroadcastAddr) String added in v0.7.2

func (a BroadcastAddr) String() string

func (*BroadcastAddr) UnmarshalJSON added in v0.7.2

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

type Card

type Card struct {
	CardNumber uint32          `json:"card-number"`
	From       Date            `json:"start-date"`
	To         Date            `json:"end-date"`
	Doors      map[uint8]uint8 `json:"doors"`
	PIN        PIN             `json:"PIN,omitempty"`
}

func (*Card) Clone

func (c *Card) Clone() Card

func (Card) MarshalJSON added in v0.8.4

func (c Card) MarshalJSON() ([]byte, error)

func (Card) String

func (c Card) String() string

func (*Card) UnmarshalJSON

func (c *Card) UnmarshalJSON(bytes []byte) error

type CardFormat added in v0.8.6

type CardFormat uint8
const (
	WiegandAny CardFormat = iota
	Wiegand26
)

func CardFormatFromString added in v0.8.6

func CardFormatFromString(v string) (CardFormat, error)

func (CardFormat) MarshalConf added in v0.8.6

func (f CardFormat) MarshalConf(tag string) ([]byte, error)

func (CardFormat) String added in v0.8.6

func (f CardFormat) String() string

func (*CardFormat) UnmarshalConf added in v0.8.6

func (f *CardFormat) UnmarshalConf(tag string, values map[string]string) (any, error)

type ControlState added in v0.7.2

type ControlState int
const (
	NormallyOpen ControlState = iota + 1
	NormallyClosed
	Controlled
)
const (
	ModeUnknown ControlState = iota
	ModeNormallyOpen
	ModeNormallyClosed
	ModeControlled
)

func (ControlState) MarshalJSON added in v0.7.2

func (v ControlState) MarshalJSON() ([]byte, error)

func (ControlState) String added in v0.7.2

func (v ControlState) String() string

func (*ControlState) UnmarshalJSON added in v0.7.2

func (v *ControlState) UnmarshalJSON(b []byte) error

type Date

type Date time.Time

func DateFromString

func DateFromString(s string) (Date, error)

func ToDate added in v0.7.0

func ToDate(year int, month time.Month, day int) Date

func (Date) After

func (d Date) After(date Date) bool

func (Date) Before

func (d Date) Before(date Date) bool

func (Date) Equals added in v0.8.4

func (d Date) Equals(date Date) bool

func (Date) IsZero added in v0.8.5

func (d Date) IsZero() bool

func (Date) MarshalJSON

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

func (Date) MarshalUT0311L0x

func (d Date) MarshalUT0311L0x() ([]byte, error)

func (Date) String

func (d Date) String() string

func (*Date) UnmarshalJSON

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

func (*Date) UnmarshalUT0311L0x

func (d *Date) UnmarshalUT0311L0x(bytes []byte) (any, error)

* Unmarshalls invalid date values as a 'zero' date without an error on the grounds * that it should be possible to retrieve information from a corrupted access controller. * Applications are expected to check for valid dates.

func (Date) Weekday added in v0.7.0

func (d Date) Weekday() time.Weekday

type DateTime

type DateTime time.Time

func DateTimeNow added in v0.7.3

func DateTimeNow() DateTime

func (DateTime) Add added in v0.7.3

func (d DateTime) Add(dt time.Duration) DateTime

func (DateTime) Before added in v0.7.3

func (d DateTime) Before(t time.Time) bool

Because time.Truncate does not in any way behave like your would expect it to :-(

func (DateTime) IsZero added in v0.7.3

func (d DateTime) IsZero() bool

func (DateTime) MarshalJSON

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

func (DateTime) MarshalText added in v0.7.1

func (d DateTime) MarshalText() ([]byte, error)

func (DateTime) MarshalUT0311L0x

func (d DateTime) MarshalUT0311L0x() ([]byte, error)

func (DateTime) String

func (d DateTime) String() string

func (*DateTime) UnmarshalJSON

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

func (*DateTime) UnmarshalUT0311L0x

func (d *DateTime) UnmarshalUT0311L0x(b []byte) (any, error)

* Unmarshalls invalid date/time values as a 'zero' date without an error on the grounds * that it should be possible to retrieve information from a corrupted access controller. * Applications are expected to check for valid date-times.

type Device

type Device struct {
	Name         string
	SerialNumber SerialNumber
	IpAddress    net.IP
	SubnetMask   net.IP
	Gateway      net.IP
	MacAddress   MacAddress
	Version      Version
	Date         Date
	Address      net.UDPAddr
	TimeZone     *time.Location
}

func (*Device) String

func (device *Device) String() string

type DoorControlState

type DoorControlState struct {
	SerialNumber SerialNumber
	Door         uint8
	ControlState ControlState
	Delay        uint8
}

func (*DoorControlState) String

func (d *DoorControlState) String() string

type Event

type Event struct {
	SerialNumber SerialNumber
	Index        uint32
	Type         byte
	Granted      bool
	Door         byte
	Direction    uint8
	CardNumber   uint32
	Timestamp    DateTime
	Reason       uint8
}

func (Event) IsZero added in v0.8.7

func (e Event) IsZero() bool

func (Event) String

func (e Event) String() string

type EventIndex

type EventIndex struct {
	SerialNumber SerialNumber
	Index        uint32
}

func (*EventIndex) String

func (e *EventIndex) String() string

type EventIndexResult

type EventIndexResult struct {
	SerialNumber SerialNumber
	Index        uint32
	Changed      bool
}

func (*EventIndexResult) String

func (e *EventIndexResult) String() string

type HHmm added in v0.7.0

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

func HHmmFromString added in v0.7.0

func HHmmFromString(s string) (*HHmm, error)

func HHmmFromTime added in v0.7.0

func HHmmFromTime(t time.Time) HHmm

func NewHHmm added in v0.7.0

func NewHHmm(hours, minutes int) HHmm

func (HHmm) After added in v0.7.0

func (h HHmm) After(t HHmm) bool

func (HHmm) Before added in v0.7.0

func (h HHmm) Before(t HHmm) bool

func (HHmm) Equals added in v0.7.1

func (h HHmm) Equals(t HHmm) bool

func (HHmm) MarshalJSON added in v0.7.0

func (h HHmm) MarshalJSON() ([]byte, error)

func (HHmm) MarshalUT0311L0x added in v0.7.0

func (h HHmm) MarshalUT0311L0x() ([]byte, error)

func (HHmm) String added in v0.7.0

func (h HHmm) String() string

func (*HHmm) UnmarshalJSON added in v0.7.0

func (h *HHmm) UnmarshalJSON(bytes []byte) error

func (*HHmm) UnmarshalUT0311L0x added in v0.7.0

func (h *HHmm) UnmarshalUT0311L0x(bytes []byte) (interface{}, error)

type Interlock added in v0.8.5

type Interlock uint8
const (
	NoInterlock    Interlock = 0x00 // disabled
	Interlock12    Interlock = 0x01 // doors (1,2)
	Interlock34    Interlock = 0x02 // doors (3,4)
	Interlock12_34 Interlock = 0x03 // doors (1,2) and (3,4)
	Interlock123   Interlock = 0x04 // doors (1,2,3)
	Interlock1234  Interlock = 0x08 // doors (1,2,3,4)
)

func (Interlock) String added in v0.8.5

func (i Interlock) String() string

type ListenAddr added in v0.7.2

type ListenAddr net.UDPAddr

func ResolveListenAddr added in v0.7.2

func ResolveListenAddr(s string) (*ListenAddr, error)

func (*ListenAddr) Clone added in v0.7.2

func (a *ListenAddr) Clone() *ListenAddr

func (*ListenAddr) Equal added in v0.7.2

func (a *ListenAddr) Equal(addr *ListenAddr) bool

func (ListenAddr) MarshalJSON added in v0.7.2

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

func (*ListenAddr) Set added in v0.7.2

func (a *ListenAddr) Set(v string) error

func (ListenAddr) String added in v0.7.2

func (a ListenAddr) String() string

func (*ListenAddr) UnmarshalJSON added in v0.7.2

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

type Listener

type Listener struct {
	SerialNumber SerialNumber
	Address      net.UDPAddr
}

func (*Listener) String

func (l *Listener) String() string

type MacAddress

type MacAddress net.HardwareAddr

func (MacAddress) MarshalJSON

func (m MacAddress) MarshalJSON() ([]byte, error)

func (MacAddress) MarshalUT0311L0x

func (m MacAddress) MarshalUT0311L0x() ([]byte, error)

func (MacAddress) String

func (m MacAddress) String() string

func (*MacAddress) UnmarshalJSON

func (m *MacAddress) UnmarshalJSON(bytes []byte) error

func (*MacAddress) UnmarshalUT0311L0x

func (m *MacAddress) UnmarshalUT0311L0x(bytes []byte) (interface{}, error)

type MsgType

type MsgType uint8

type PIN added in v0.8.4

type PIN uint32

func (PIN) MarshalJSON added in v0.8.4

func (p PIN) MarshalJSON() ([]byte, error)

func (PIN) MarshalUT0311L0x added in v0.8.4

func (p PIN) MarshalUT0311L0x() ([]byte, error)

func (*PIN) UnmarshalJSON added in v0.8.4

func (p *PIN) UnmarshalJSON(bytes []byte) error

func (*PIN) UnmarshalUT0311L0x added in v0.8.4

func (p *PIN) UnmarshalUT0311L0x(bytes []byte) (any, error)

type Result

type Result struct {
	SerialNumber SerialNumber
	Succeeded    bool
}

func (*Result) String

func (r *Result) String() string

type SOM added in v0.6.8

type SOM uint8

type Segment added in v0.7.0

type Segment struct {
	Start HHmm `json:"start,omitempty"`
	End   HHmm `json:"end,omitempty"`
}

func (Segment) String added in v0.7.0

func (s Segment) String() string

type Segments added in v0.7.0

type Segments map[uint8]Segment

func (Segments) MarshalJSON added in v0.7.0

func (ss Segments) MarshalJSON() ([]byte, error)

func (Segments) String added in v0.7.0

func (ss Segments) String() string

func (*Segments) UnmarshalJSON added in v0.7.0

func (ss *Segments) UnmarshalJSON(bytes []byte) error

type SerialNumber

type SerialNumber uint32

func (SerialNumber) MarshalUT0311L0x

func (s SerialNumber) MarshalUT0311L0x() ([]byte, error)

func (SerialNumber) String

func (s SerialNumber) String() string

func (*SerialNumber) UnmarshalUT0311L0x

func (s *SerialNumber) UnmarshalUT0311L0x(bytes []byte) (interface{}, error)

type Status

type Status struct {
	SerialNumber   SerialNumber
	DoorState      map[uint8]bool
	DoorButton     map[uint8]bool
	SystemError    uint8
	SystemDateTime DateTime
	SequenceId     uint32
	SpecialInfo    uint8
	RelayState     uint8
	InputState     uint8
	Event          StatusEvent // using zero value for 'no event'
}

func (Status) String

func (s Status) String() string

type StatusEvent added in v0.6.12

type StatusEvent struct {
	Index      uint32
	Type       byte
	Granted    bool
	Door       byte
	Direction  uint8
	CardNumber uint32
	Timestamp  DateTime
	Reason     uint8
}

func (StatusEvent) IsZero added in v0.8.7

func (e StatusEvent) IsZero() bool

type SystemDate

type SystemDate time.Time

func (SystemDate) Format added in v0.8.4

func (d SystemDate) Format(format string) string

func (SystemDate) IsZero added in v0.8.4

func (d SystemDate) IsZero() bool

func (SystemDate) MarshalUT0311L0x

func (d SystemDate) MarshalUT0311L0x() ([]byte, error)

func (SystemDate) String

func (d SystemDate) String() string

func (*SystemDate) UnmarshalUT0311L0x

func (d *SystemDate) UnmarshalUT0311L0x(b []byte) (interface{}, error)

type SystemTime

type SystemTime time.Time

func TimeFromString added in v0.7.0

func TimeFromString(s string) (*SystemTime, error)

func (SystemTime) Format added in v0.8.4

func (t SystemTime) Format(format string) string

func (SystemTime) MarshalUT0311L0x

func (d SystemTime) MarshalUT0311L0x() ([]byte, error)

func (SystemTime) String

func (t SystemTime) String() string

func (*SystemTime) UnmarshalUT0311L0x

func (t *SystemTime) UnmarshalUT0311L0x(bytes []byte) (interface{}, error)

type Task added in v0.7.1

type Task struct {
	Task     TaskType `json:"task"`
	Door     uint8    `json:"door,omitempty"`
	From     Date     `json:"start-date,omitempty"`
	To       Date     `json:"end-date,omitempty"`
	Weekdays Weekdays `json:"weekdays,omitempty"`
	Start    HHmm     `json:"start,omitempty"`
	Cards    uint8    `json:"cards,omitempty"`
}

func (Task) String added in v0.7.1

func (t Task) String() string

func (*Task) UnmarshalJSON added in v0.7.1

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

type TaskType added in v0.7.1

type TaskType int
const (
	DoorControlled TaskType = iota
	DoorNormallyOpen
	DoorNormallyClosed
	DisableTimeProfile
	EnableTimeProfile
	CardNoPassword
	CardInPassword
	CardInOutPassword
	EnableMoreCards
	DisableMoreCards
	TriggerOnce
	DisablePushButton
	EnablePushButton
)

func (TaskType) MarshalJSON added in v0.7.1

func (tt TaskType) MarshalJSON() ([]byte, error)

func (TaskType) String added in v0.7.1

func (tt TaskType) String() string

func (*TaskType) UnmarshalJSON added in v0.7.1

func (tt *TaskType) UnmarshalJSON(b []byte) error

Unmarshals a TaskType from a JSON field that may be either a numeric task type ID or a task description string. Numeric task type IDs range from 1..13, corresponding to the tasks:

- control door - unlock door - lock door - disable time profile - enable time profile - enable card, no password - enable card+in password - enable card+password - enable more cards - disable more cards - trigger once - disable push button - enable push button

Task description strings are case- and space-insensitive.

Note that the task type IDs used by the UHPPOTE range from 0..12 - the uhppote-core 'bumps' this by one so that the default JSON value of 0 can be discarded as invalid.

func (*TaskType) UnmarshalTSV added in v0.7.1

func (tt *TaskType) UnmarshalTSV(s string) (interface{}, error)

type Time

type Time struct {
	SerialNumber SerialNumber
	DateTime     DateTime
}

func (Time) String

func (t Time) String() string

type TimeProfile added in v0.7.0

type TimeProfile struct {
	ID              uint8    `json:"id"`
	LinkedProfileID uint8    `json:"linked-profile,omitempty"`
	From            *Date    `json:"start-date,omitempty"`
	To              *Date    `json:"end-date,omitempty"`
	Weekdays        Weekdays `json:"weekdays,omitempty"`
	Segments        Segments `json:"segments,omitempty"`
}

func (TimeProfile) String added in v0.7.0

func (t TimeProfile) String() string

func (*TimeProfile) UnmarshalJSON added in v0.7.0

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

type Version

type Version uint16

func (Version) MarshalJSON

func (v Version) MarshalJSON() ([]byte, error)

func (Version) MarshalUT0311L0x

func (v Version) MarshalUT0311L0x() ([]byte, error)

func (Version) String added in v0.6.8

func (v Version) String() string

func (*Version) UnmarshalJSON

func (v *Version) UnmarshalJSON(bytes []byte) error

func (*Version) UnmarshalUT0311L0x

func (v *Version) UnmarshalUT0311L0x(bytes []byte) (interface{}, error)

type Weekdays added in v0.7.0

type Weekdays map[time.Weekday]bool

func (Weekdays) MarshalJSON added in v0.7.0

func (w Weekdays) MarshalJSON() ([]byte, error)

func (Weekdays) String added in v0.7.0

func (w Weekdays) String() string

func (*Weekdays) UnmarshalJSON added in v0.7.0

func (w *Weekdays) UnmarshalJSON(bytes []byte) error

Jump to

Keyboard shortcuts

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