model

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapApiPosToModelPos

func MapApiPosToModelPos(apiPos SwitchMachinePosition) switchmachine.Position

Types

type Error

type Error struct {
	Message string `json:"message,omitempty"`

	Causedby *Error `json:"causedby,omitempty"`
}

type GPIOState

type GPIOState string
const (
	OFF GPIOState = "off"
	ON  GPIOState = "on"
)

List of GPIOState

func MapModelGPIOToAPI

func MapModelGPIOToAPI(modelGPIO switchmachine.GPIOState) GPIOState

type SwitchMachine

type SwitchMachine struct {
	SMId SwitchMachineId `json:"id"`

	Pos SwitchMachinePosition `json:"position"`

	Motor SwitchMachineMotorState `json:"motorState"`

	Gpio0 GPIOState `json:"gpio0"`

	Gpio1 GPIOState `json:"gpio1"`

	UpdTimeMillis int64 `json:"updateTimeMillis"`

	OriginServerId uuid.UUID `json:"originServerId"`
}

func NewAPISwitchMachineFromModel

func NewAPISwitchMachineFromModel(modelSM switchmachine.State) *SwitchMachine

func (*SwitchMachine) GPIO0State

func (this *SwitchMachine) GPIO0State() switchmachine.GPIOState

func (*SwitchMachine) GPIO1State

func (this *SwitchMachine) GPIO1State() switchmachine.GPIOState

func (*SwitchMachine) Id

func (this *SwitchMachine) Id() switchmachine.Id

func (*SwitchMachine) MotorState

func (this *SwitchMachine) MotorState() switchmachine.MotorState

func (*SwitchMachine) Position

func (this *SwitchMachine) Position() switchmachine.Position

func (*SwitchMachine) UpdateTime

func (this *SwitchMachine) UpdateTime() time.Time

type SwitchMachineEvent

type SwitchMachineEvent struct {
	EventType          SwitchMachineEventType `json:"eventType"`
	SwitchMachineState *SwitchMachine         `json:"switchMachineState"`
}

type SwitchMachineEventType

type SwitchMachineEventType string
const (
	SMAdded   SwitchMachineEventType = "SwitchMachineAdded"
	SMRemoved SwitchMachineEventType = "SwitchMachineRemoved"
	SMUpdated SwitchMachineEventType = "SwitchMachineUpdated"
)

type SwitchMachineId

type SwitchMachineId int

type SwitchMachineMotorState

type SwitchMachineMotorState string
const (
	IDLE          SwitchMachineMotorState = "idle"
	TO_POSITION_0 SwitchMachineMotorState = "to position 0"
	TO_POSITION_1 SwitchMachineMotorState = "to position 1"
	BRAKE         SwitchMachineMotorState = "brake"
)

List of SwitchMachineMotorState

type SwitchMachinePosition

type SwitchMachinePosition string
const (
	Position0 SwitchMachinePosition = "position 0"
	Position1 SwitchMachinePosition = "position 1"
	Unknown   SwitchMachinePosition = "unknown"
)

List of SwitchMachinePosition

func MapModelPosToApiPos

func MapModelPosToApiPos(modelPos switchmachine.Position) SwitchMachinePosition

Jump to

Keyboard shortcuts

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