statecontrol

package
v0.179.17 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProcessStateManagerAlreadyPairing = fmt.Errorf("cannot start new LocalPairing session, already pairing")
	ErrProcessStateManagerAlreadyPaired  = func(sessionName string) error {
		return fmt.Errorf("given connection string already successfully used '%s'", sessionName)
	}
)

Functions

This section is empty.

Types

type ProcessStateManager

type ProcessStateManager struct {
	// contains filtered or unexported fields
}

ProcessStateManager represents a g

func (*ProcessStateManager) CompleteSession

func (psm *ProcessStateManager) CompleteSession(sessionName string)

CompleteSession updates a transfer session with a given transfer success state only if the session is registered.

func (*ProcessStateManager) GetSession

func (psm *ProcessStateManager) GetSession(sessionName string) (bool, bool)

GetSession returns two booleans for a given sessionName. These represent if the sessionName has been registered and if it has resulted in a successful transfer

func (*ProcessStateManager) IsPairing

func (psm *ProcessStateManager) IsPairing() bool

IsPairing returns if the ProcessStateManager is currently in pairing mode

func (*ProcessStateManager) RegisterSession

func (psm *ProcessStateManager) RegisterSession(sessionName string)

RegisterSession stores a sessionName with the default false value. In practice a sessionName will be a ConnectionParams string provided by the server mode device. The boolean value represents whether the ConnectionParams string session resulted in a successful transfer.

func (*ProcessStateManager) SetPairing

func (psm *ProcessStateManager) SetPairing(state bool)

SetPairing sets the ProcessStateManager pairing state

func (*ProcessStateManager) StartPairing

func (psm *ProcessStateManager) StartPairing(sessionName string) error

StartPairing along with StopPairing are the core functions of the ProcessStateManager This function takes a sessionName, which in practice is a ConnectionParams string, and attempts to init pairing state management. The function will return an error if the ProcessStateManager is already currently pairing or if the sessionName was previously successful.

func (*ProcessStateManager) StopPairing

func (psm *ProcessStateManager) StopPairing(sessionName string, err error)

StopPairing takes a sessionName and an error, if the error is nil the sessionName will be recorded as successful the pairing state of the ProcessStateManager is set to false.

Jump to

Keyboard shortcuts

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