types

package
v0.241208.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: CC0-1.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	VMC   *VMCType = nil
	UI    *UItype  = nil
	TeleN tele_api.Teler
	Log   *log2.Log
)

var Log = *log2.NewStderr(log2.LDebug)

View Source
var ErrInterrupted = fmt.Errorf("scheduler interrupted, ignore like EPIPE")

Functions

func ShowEnvs

func ShowEnvs() string

func TeleError added in v0.220624.0

func TeleError(s string)

func TuneValueToByte added in v0.220329.0

func TuneValueToByte(currentValue uint8, defaultValue uint8) []byte

преобразование тюнинга в байт 0 = дефолтные значение. если менялось то +1 для телеметрии convert tuning to byte 0 = default value. if changed then +1 for telemetry

Types

type DeviceOfflineError

type DeviceOfflineError struct {
	Device Devicer
}

func (DeviceOfflineError) Error

func (oe DeviceOfflineError) Error() string

type Devicer

type Devicer interface {
	Name() string
}

type Doer

type Doer interface {
	Validate() error
	Do(context.Context) error
	String() string // for logs
}

type Event

type Event struct {
	Input  InputEvent
	Amount currency.Amount
	Kind   EventKind
}

type EventKind

type EventKind uint8
const (
	EventInvalid EventKind = iota
	EventInput
	EventMoneyPreCredit
	EventMoneyCredit
	EventTime
	EventLock
	EventService
	EventStop
	EventFrontLock
	EventUiTimerStop
	EventBroken
)

type InputEvent

type InputEvent struct {
	Source string
	Key    InputKey
	Up     bool
}

func (*InputEvent) IsDigit

func (e *InputEvent) IsDigit() bool

func (*InputEvent) IsDot

func (e *InputEvent) IsDot() bool

func (*InputEvent) IsTuneKey added in v0.230424.2

func (e *InputEvent) IsTuneKey() bool

func (*InputEvent) IsZero

func (e *InputEvent) IsZero() bool

type InputKey

type InputKey uint16
type MenuItemType struct {
	Disabled bool
	Name     string
	D        Doer
	Price    currency.Amount
	Code     string
	CreamMax uint8
	SugarMax uint8
}
func (mit *MenuItemType) String() string

type MonSysStruct added in v0.220124.0

type MonSysStruct struct {
	Dirty currency.Amount
}

type Scheduler

type Scheduler interface {
	// Schedule(context.Context, tele_api.Priority, TaskFunc) <-chan error
	ScheduleSync(context.Context, TaskFunc) error
}

type TaskFunc

type TaskFunc = func(context.Context) error

type UIMenuResult

type UIMenuResult struct {
	Item        MenuItemType
	Cream       uint8
	Sugar       uint8
	PaymenId    int64
	QRPayAmount uint32
}

type UIer

type UIer interface {
	Loop(context.Context)
	// FrontSelectShowZero(context.Context)
	GetUiState() uint32
	Scheduler
}

type UItype

type UItype struct {
	FrontResult UIMenuResult
	Menu        map[string]MenuItemType
}

type UiState added in v0.230424.2

type UiState uint32
const (
	StateDefault UiState = iota

	StateBoot   // 1 t=onstart +onstartOk=FrontHello +onstartError+retry=Boot +retryMax=Broken
	StateBroken // 2 t=tele/input +inputService=ServiceBegin
	StateLocked // 3 t=tele

	StateFrontBegin   // 4 t=checkVariables +=FrontHello
	StateFrontSelect  // 5 t=input/money/timeout +inputService=ServiceBegin +input=... +money=... +inputAccept=FrontAccept +timeout=FrontTimeout
	StatePrepare      // 6
	StateFrontTune    // 7 t=input/money/timeout +inputTune=FrontTune ->FrontSelect
	StateFrontAccept  // 8 t=engine.Exec(Item) +OK=FrontEnd +err=Broken
	StateFrontTimeout // 9 t=saveMoney ->FrontEnd
	StateFrontEnd     // 10 ->FrontBegin

	StateServiceBegin     // 11 t=input/timeout ->ServiceAuth
	StateServiceAuth      // 12 +inputAccept+OK=ServiceMenu
	StateServiceMenu      // 13
	StateServiceInventory // 14
	StateServiceTest
	StateServiceReboot
	StateServiceNetwork
	StateServiceMoneyLoad
	StateServiceReport
	StateServiceEnd // 20 +askReport=ServiceReport ->FrontBegin

	StateStop // 21

	StateFrontLock

	StateOnStart

	StateDoesNotChange
)

type VMCType

type VMCType struct {
	Version     string
	Lock        bool
	NeedRestart bool
	InputEnable bool
	UiState     uint32
	ReportInv   uint32
	Client      struct {
		WorkTime time.Time
		Input    string
		Light    bool
	}
	HW struct {
		Display struct {
			L1            string
			L2            string
			GdisplayValid bool
			Gdisplay      string
		}
	}
	MonSys MonSysStruct
}

func (*VMCType) EvendKeyboardInput added in v0.220622.0

func (evk *VMCType) EvendKeyboardInput(v bool)

Jump to

Keyboard shortcuts

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