uhppote

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: MIT Imports: 10 Imported by: 34

Documentation

Index

Constants

This section is empty.

Variables

View Source
var VERSION string = "v0.6.4"

Functions

func GetCardByIndex

func GetCardByIndex(u iuhppote, deviceID, index uint32) (*types.Card, error)

Types

type Device

type Device struct {
	DeviceID uint32
	Address  *net.UDPAddr
	Rollover uint32
	Doors    []string
}

func NewDevice

func NewDevice(deviceID uint32, address *net.UDPAddr, rollover uint32, doors []string) *Device

type Event

type Event struct {
	MsgType      types.MsgType      `uhppote:"value:0x20"`
	SerialNumber types.SerialNumber `uhppote:"offset:4"`
	EventIndex   uint32             `uhppote:"offset:8"`
	EventType    byte               `uhppote:"offset:12"`
	Granted      bool               `uhppote:"offset:13"`
	Door         byte               `uhppote:"offset:14"`
	Direction    uint8              `uhppote:"offset:15"`
	CardNumber   uint32             `uhppote:"offset:16"`
	Timestamp    types.DateTime     `uhppote:"offset:20"`
	Reason       byte               `uhppote:"offset:27"`
	Door1State   bool               `uhppote:"offset:28"`
	Door2State   bool               `uhppote:"offset:29"`
	Door3State   bool               `uhppote:"offset:30"`
	Door4State   bool               `uhppote:"offset:31"`
	Door1Button  bool               `uhppote:"offset:32"`
	Door2Button  bool               `uhppote:"offset:33"`
	Door3Button  bool               `uhppote:"offset:34"`
	Door4Button  bool               `uhppote:"offset:35"`
	SystemError  uint8              `uhppote:"offset:36"`
	SystemDate   types.SystemDate   `uhppote:"offset:51"`
	SystemTime   types.SystemTime   `uhppote:"offset:37"`
	SequenceId   uint32             `uhppote:"offset:40"`
	SpecialInfo  uint8              `uhppote:"offset:48"`
	RelayState   uint8              `uhppote:"offset:49"` // bitmap (0=locked, 1=unlocked, 0000:all doors locked)
	InputState   uint8              `uhppote:"offset:50"` // bitmap (bit 0: force locked, bit 1: fire alarm)
}

type GetListenerResponse

type GetListenerResponse struct {
	MsgType      types.MsgType      `uhppote:"value:0x92"`
	SerialNumber types.SerialNumber `uhppote:"offset:4"`
	Address      net.IP             `uhppote:"offset:8"`
	Port         uint16             `uhppote:"offset:12"`
}

type Listener

type Listener interface {
	OnConnected()
	OnEvent(*types.Status)
	OnError(error) bool
}

type UHPPOTE

type UHPPOTE struct {
	BindAddress      *net.UDPAddr
	BroadcastAddress *net.UDPAddr
	ListenAddress    *net.UDPAddr
	Devices          map[uint32]*Device
	Debug            bool
}

func (*UHPPOTE) Broadcast

func (u *UHPPOTE) Broadcast(request, replies interface{}) error

func (*UHPPOTE) DeleteCard

func (u *UHPPOTE) DeleteCard(serialNumber, cardNumber uint32) (*types.Result, error)

func (*UHPPOTE) DeleteCardN

func (u *UHPPOTE) DeleteCardN(deviceID uint32, card types.Card) (bool, error)

func (*UHPPOTE) DeleteCards

func (u *UHPPOTE) DeleteCards(serialNumber uint32) (*types.Result, error)

func (*UHPPOTE) DirectedBroadcast

func (u *UHPPOTE) DirectedBroadcast(serialNumber uint32, request, replies interface{}) error

Sends a UDP message to a specific device but anticipates replies from more than one device because it may fall back to the broadcast address if the device ID has no configured IP address.

func (*UHPPOTE) Execute

func (u *UHPPOTE) Execute(serialNumber uint32, request, reply interface{}) error

func (*UHPPOTE) FindDevice

func (u *UHPPOTE) FindDevice(serialNumber uint32) (*types.Device, error)

func (*UHPPOTE) FindDevices

func (u *UHPPOTE) FindDevices() ([]types.Device, error)

func (*UHPPOTE) GetCardByID

func (u *UHPPOTE) GetCardByID(serialNumber, cardNumber uint32) (*types.Card, error)

func (*UHPPOTE) GetCardByIdN

func (u *UHPPOTE) GetCardByIdN(deviceID, cardNumber uint32) (*types.Card, error)

func (*UHPPOTE) GetCardByIndex

func (u *UHPPOTE) GetCardByIndex(deviceID, index uint32) (*types.Card, error)

func (*UHPPOTE) GetCards

func (u *UHPPOTE) GetCards(serialNumber uint32) (*types.RecordCount, error)

func (*UHPPOTE) GetCardsN

func (u *UHPPOTE) GetCardsN(deviceID uint32) (uint32, error)

func (*UHPPOTE) GetDoorControlState

func (u *UHPPOTE) GetDoorControlState(serialNumber uint32, door byte) (*types.DoorControlState, error)

func (*UHPPOTE) GetEvent

func (u *UHPPOTE) GetEvent(serialNumber, index uint32) (*types.Event, error)

func (*UHPPOTE) GetEventIndex

func (u *UHPPOTE) GetEventIndex(serialNumber uint32) (*types.EventIndex, error)

func (*UHPPOTE) GetListener

func (u *UHPPOTE) GetListener(serialNumber uint32) (*types.Listener, error)

func (*UHPPOTE) GetStatus

func (u *UHPPOTE) GetStatus(serialNumber uint32) (*types.Status, error)

func (*UHPPOTE) GetTime

func (u *UHPPOTE) GetTime(serialNumber uint32) (*types.Time, error)

func (*UHPPOTE) Listen

func (u *UHPPOTE) Listen(listener Listener, q chan os.Signal) error

func (*UHPPOTE) OpenDoor

func (u *UHPPOTE) OpenDoor(serialNumber uint32, door uint8) (*types.Result, error)

func (*UHPPOTE) PutCard

func (u *UHPPOTE) PutCard(serialNumber uint32, card types.Card) (*types.Result, error)

func (*UHPPOTE) PutCardN

func (u *UHPPOTE) PutCardN(deviceID uint32, card types.Card) (bool, error)

func (*UHPPOTE) Send

func (u *UHPPOTE) Send(serialNumber uint32, request interface{}) (messages.Response, error)

func (*UHPPOTE) SetAddress

func (u *UHPPOTE) SetAddress(serialNumber uint32, address, mask, gateway net.IP) (*types.Result, error)

func (*UHPPOTE) SetDoorControlState

func (u *UHPPOTE) SetDoorControlState(serialNumber uint32, door uint8, state uint8, delay uint8) (*types.DoorControlState, error)

func (*UHPPOTE) SetEventIndex

func (u *UHPPOTE) SetEventIndex(serialNumber, index uint32) (*types.EventIndexResult, error)

func (*UHPPOTE) SetListener

func (u *UHPPOTE) SetListener(serialNumber uint32, address net.UDPAddr) (*types.Result, error)

func (*UHPPOTE) SetTime

func (u *UHPPOTE) SetTime(serialNumber uint32, datetime time.Time) (*types.Time, error)

Jump to

Keyboard shortcuts

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