domain

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrObjectNotRegistered = errors.New("object does not registered")
	ErrValidatorDistracted = errors.New("validator distracted")
	ErrPingFailed          = errors.New("ping failed")
	ErrDeviceUnactivated   = errors.New("device unactivated")
	ErrUnknownDeviceStatus = errors.New("unknown device status")
	ErrDeviceRegistered    = errors.New("device registered")
)

Functions

func CheckPasswordHash

func CheckPasswordHash(hash, password string) bool

func GeneratePassword

func GeneratePassword() (string, error)

func HashPassword

func HashPassword(password string) (string, error)

Types

type Cassette added in v1.2.0

type Cassette struct {
	Id        int          `json:"id"`
	DeviceUID string       `json:"device_uid"`
	Type      CassetteType `json:"type"`
	Size      uint         `json:"size"`
	Capacity  uint         `json:"capacity"`
}

type CassetteType added in v1.2.0

type CassetteType int
const (
	CashCassette CassetteType = iota
	PrizeCassette
)

type Device

type Device struct {
	UID          string       `json:"uid"`
	Label        string       `json:"label"`
	PasswordHash string       `json:"password_hash"`
	Active       bool         `json:"active"`
	Status       DeviceStatus `json:"status"`
	OwnerId      int64        `json:"owner_id"`
	Point        string       `json:"point"`
	ExpiresAt    time.Time    `json:"expires_at"`
	Online       bool         `json:"online"`
	LastSeen     time.Time    `json:"last_seen"`
}

type DeviceStatus

type DeviceStatus int
const (
	UnknownStatus      DeviceStatus = 0
	NormalStatus       DeviceStatus = 1
	DefaultErrorStatus DeviceStatus = 2

	IdlingStatus           DeviceStatus = 0x14
	DropCassetteFullStatus DeviceStatus = 0x41
	CassetteRemovedStatus  DeviceStatus = 0x42
	ValidatorJammedStatus  DeviceStatus = 0x43
	CassetteJammedStatus   DeviceStatus = 0x44
	CheatedStatus          DeviceStatus = 0x45
	PauseStatus            DeviceStatus = 0x46
	FailureStatus          DeviceStatus = 0x47
)

func DeviceStatusFromInt

func DeviceStatusFromInt(status int) DeviceStatus

func ParseString

func ParseString(value string) DeviceStatus

func (DeviceStatus) Level added in v1.1.0

func (s DeviceStatus) Level() logger.LogLevel

func (DeviceStatus) String

func (s DeviceStatus) String() string

type DeviceWithPassword

type DeviceWithPassword struct {
	Device
	Password string
}

func GetDeviceWithPassword

func GetDeviceWithPassword(d *Device, password string) *DeviceWithPassword

type Owner

type Owner struct {
	UserId  int64    `json:"user_id"`
	Devices []string `json:"devices"` //UIDs of devices
}

Jump to

Keyboard shortcuts

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