Documentation ¶
Index ¶
- Constants
- type BindAddr
- type BroadcastAddr
- type Card
- type CardFormat
- type ControlState
- type ControllerAddr
- func (a *ControllerAddr) Clone() *ControllerAddr
- func (a ControllerAddr) Equal(addr ControllerAddr) bool
- func (a ControllerAddr) IsValid() bool
- func (a ControllerAddr) MarshalJSON() ([]byte, error)
- func (a *ControllerAddr) Set(v string) error
- func (a ControllerAddr) String() string
- func (a *ControllerAddr) UnmarshalJSON(bytes []byte) error
- type Date
- func (d Date) After(date Date) bool
- func (d Date) Before(date Date) bool
- func (d Date) Equals(date Date) bool
- func (d Date) IsZero() bool
- func (d Date) MarshalJSON() ([]byte, error)
- func (d Date) MarshalUT0311L0x() ([]byte, error)
- func (d Date) String() string
- func (d *Date) UnmarshalJSON(bytes []byte) error
- func (d *Date) UnmarshalUT0311L0x(bytes []byte) (any, error)
- func (d Date) Weekday() time.Weekday
- type DateTime
- func (d DateTime) Add(dt time.Duration) DateTime
- func (d DateTime) Before(t time.Time) bool
- func (d DateTime) IsZero() bool
- func (d DateTime) MarshalJSON() ([]byte, error)
- func (d DateTime) MarshalText() ([]byte, error)
- func (d DateTime) MarshalUT0311L0x() ([]byte, error)
- func (d DateTime) String() string
- func (d *DateTime) UnmarshalJSON(bytes []byte) error
- func (d *DateTime) UnmarshalUT0311L0x(b []byte) (any, error)
- type Device
- type DoorControlState
- type Event
- type EventIndex
- type EventIndexResult
- type HHmm
- func (h HHmm) After(t HHmm) bool
- func (h HHmm) Before(t HHmm) bool
- func (h HHmm) Equals(t HHmm) bool
- func (h HHmm) MarshalJSON() ([]byte, error)
- func (h HHmm) MarshalUT0311L0x() ([]byte, error)
- func (h HHmm) String() string
- func (h *HHmm) UnmarshalJSON(bytes []byte) error
- func (h *HHmm) UnmarshalUT0311L0x(bytes []byte) (interface{}, error)
- type Interlock
- type ListenAddr
- func (a *ListenAddr) Clone() *ListenAddr
- func (a *ListenAddr) Equal(addr *ListenAddr) bool
- func (a ListenAddr) IsValid() bool
- func (a ListenAddr) MarshalJSON() ([]byte, error)
- func (a *ListenAddr) Set(v string) error
- func (a ListenAddr) String() string
- func (a *ListenAddr) UnmarshalJSON(bytes []byte) error
- type MacAddress
- type MsgType
- type PIN
- type Result
- type SOM
- type Segment
- type Segments
- type SerialNumber
- type Status
- type StatusEvent
- type SystemDate
- type SystemTime
- type Task
- type TaskType
- type Time
- type TimeProfile
- type Version
- type Weekdays
Constants ¶
const BIND_PORT = 0
const BROADCAST_PORT = 60000
const CONTROLLER_PORT = 60000
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BindAddr ¶ added in v0.7.2
func BindAddrFrom ¶ added in v0.8.9
* BindAddrFrom contructs a BindAddr from an address and port.
func MustParseBindAddr ¶ added in v0.8.9
* MustParseBindAddr invokes ParseBindAddr and panics on error. * * It is intended for use in tests with hard-coded strings.
func ParseBindAddr ¶ added in v0.8.9
* ParseBindAddr parses a string as a bind address. * * It doesn't do any name resolution i.e.: both the address and the port must be numeric. Defaults * to port 0 if the port is not specified.
func (*BindAddr) Equal ¶ added in v0.7.2
func (a *BindAddr) Equal(addr *ControllerAddr) bool
func (BindAddr) MarshalJSON ¶ added in v0.7.2
func (BindAddr) String ¶ added in v0.7.2
* Formats the bind address and port as an address:port string. * * Return only the bind address if bind port is the default port (60000).
func (*BindAddr) UnmarshalJSON ¶ added in v0.7.2
type BroadcastAddr ¶ added in v0.7.2
func BroadcastAddrFrom ¶ added in v0.8.9
func BroadcastAddrFrom(addr netip.Addr, port uint16) BroadcastAddr
* BroadcastAddrFrom contructs a BroadcastAddr from an address and port.
func MustParseBroadcastAddr ¶ added in v0.8.9
func MustParseBroadcastAddr(s string) BroadcastAddr
* MustParseBroadcastAddr invokes ParseBroadcastAddr and panics on error. * * It is intended for use in tests with hard-coded strings.
func ParseBroadcastAddr ¶ added in v0.8.9
func ParseBroadcastAddr(s string) (BroadcastAddr, error)
* ParseBroadcastAddr parses a string as a UDP broadcast address. * * It doesn't do any name resolution i.e.: both the address and the port must be numeric. Defaults * to port 60000 if the port is not specified.
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
* Formats the broadcast address and port as an address:port string. * * Return only the bind address if bind port is the default port (60000).
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) MarshalJSON ¶ added in v0.8.4
func (*Card) UnmarshalJSON ¶
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
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 ControllerAddr ¶ added in v0.8.9
func ControllerAddrFrom ¶ added in v0.8.9
func ControllerAddrFrom(addr netip.Addr, port uint16) ControllerAddr
* ControllerAddrFrom contructs a ControllerAddr from an address and port.
func MustParseControllerAddr ¶ added in v0.8.9
func MustParseControllerAddr(s string) ControllerAddr
* MustParseControllerAddr invokes ParseControllerAddr and panics on error. * * It is intended for use in tests with hard-coded strings.
func ParseControllerAddr ¶ added in v0.8.9
func ParseControllerAddr(s string) (ControllerAddr, error)
* ParseControllerAddr parses a string as a controller address. * * It doesn't do any name resolution i.e.: both the address and the port must be numeric. Defaults * to port 60000 if the port is not specified.
func (*ControllerAddr) Clone ¶ added in v0.8.9
func (a *ControllerAddr) Clone() *ControllerAddr
func (ControllerAddr) Equal ¶ added in v0.8.9
func (a ControllerAddr) Equal(addr ControllerAddr) bool
func (ControllerAddr) IsValid ¶ added in v0.8.9
func (a ControllerAddr) IsValid() bool
func (ControllerAddr) MarshalJSON ¶ added in v0.8.9
func (a ControllerAddr) MarshalJSON() ([]byte, error)
func (*ControllerAddr) Set ¶ added in v0.8.9
func (a *ControllerAddr) Set(v string) error
func (ControllerAddr) String ¶ added in v0.8.9
func (a ControllerAddr) String() string
* Formats the controller address and port as an address:port string. * * Return only the controller address if bind port is the default port (60000).
func (*ControllerAddr) UnmarshalJSON ¶ added in v0.8.9
func (a *ControllerAddr) UnmarshalJSON(bytes []byte) error
type Date ¶
func MustParseDate ¶ added in v0.8.9
MustParseDate invokes ParseDate and panics on error.
It is intended for use in tests with hard-coded strings.
func ParseDate ¶ added in v0.8.9
Parses a date string, returning a zero value Date{} and an error if the string is blank or not a valid date.
func ToDate ¶ added in v0.7.0
Utility function to explicitly construct a Date from year, month and day.
func (Date) MarshalJSON ¶
func (Date) MarshalUT0311L0x ¶
func (*Date) UnmarshalJSON ¶
func (*Date) UnmarshalUT0311L0x ¶
* 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.
type DateTime ¶
func DateTimeNow ¶ added in v0.7.3
func DateTimeNow() DateTime
func (DateTime) Before ¶ added in v0.7.3
Because time.Truncate does not in any way behave like your would expect it to :-(
func (DateTime) MarshalJSON ¶
func (DateTime) MarshalText ¶ added in v0.7.1
func (DateTime) MarshalUT0311L0x ¶
func (*DateTime) UnmarshalJSON ¶
func (*DateTime) UnmarshalUT0311L0x ¶
* 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 DoorControlState ¶
type DoorControlState struct { SerialNumber SerialNumber Door uint8 ControlState ControlState Delay uint8 }
func (*DoorControlState) String ¶
func (d *DoorControlState) String() string
type Event ¶
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 HHmmFromTime ¶ added in v0.7.0
func (HHmm) MarshalJSON ¶ added in v0.7.0
func (HHmm) MarshalUT0311L0x ¶ added in v0.7.0
func (*HHmm) UnmarshalJSON ¶ added in v0.7.0
func (*HHmm) UnmarshalUT0311L0x ¶ added in v0.7.0
type ListenAddr ¶ added in v0.7.2
func ListenAddrFrom ¶ added in v0.8.9
func ListenAddrFrom(addr netip.Addr, port uint16) ListenAddr
* ListenAddrFrom contructs a ListenAddr from an address and port.
func MustParseListenAddr ¶ added in v0.8.9
func MustParseListenAddr(s string) ListenAddr
* MustParseListenAddr invokes ParseListenAddr and panics on error. * * It is intended for use in tests with hard-coded strings.
func ParseListenAddr ¶ added in v0.8.9
func ParseListenAddr(s string) (ListenAddr, error)
* ParseListenAddr parses a string as a UDP listen address. * * It doesn't do any name resolution and the port is required - both the address and the port must be numeric
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) IsValid ¶ added in v0.8.9
func (a ListenAddr) IsValid() 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
* Formats the listen address and port as an address:port string. *
func (*ListenAddr) UnmarshalJSON ¶ added in v0.7.2
func (a *ListenAddr) UnmarshalJSON(bytes []byte) error
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 PIN ¶ added in v0.8.4
type PIN uint32
func (PIN) MarshalJSON ¶ added in v0.8.4
func (PIN) MarshalUT0311L0x ¶ added in v0.8.4
func (*PIN) UnmarshalJSON ¶ added in v0.8.4
type Result ¶
type Result struct { SerialNumber SerialNumber Succeeded bool }
type Segments ¶ added in v0.7.0
func (Segments) MarshalJSON ¶ added in v0.7.0
func (*Segments) UnmarshalJSON ¶ added in v0.7.0
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 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 ¶
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 ¶
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) UnmarshalJSON ¶ added in v0.7.1
type TaskType ¶ added in v0.7.1
type TaskType int
func (TaskType) MarshalJSON ¶ added in v0.7.1
func (*TaskType) UnmarshalJSON ¶ added in v0.7.1
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
type Time ¶
type Time struct { SerialNumber SerialNumber DateTime DateTime }
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