Get-Service TeamViewer | Select-Object Status, Name, StartType
This commit is contained in:
@@ -44,7 +44,7 @@ const (
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
port *serial.Port
|
||||
port serialTransport
|
||||
|
||||
reqCh chan cmdReq
|
||||
done chan struct{}
|
||||
@@ -189,7 +189,7 @@ func (c *Client) handle(req cmdReq) {
|
||||
|
||||
switch req.typ {
|
||||
case cmdStatus:
|
||||
st, err := checkDispenserStatus(c.port)
|
||||
st, err := checkDispenserStatus(req.ctx, c.port)
|
||||
if err == nil && len(st) == 4 {
|
||||
c.mu.Lock()
|
||||
c.lastStatus = append([]byte(nil), st...)
|
||||
@@ -202,18 +202,18 @@ func (c *Client) handle(req cmdReq) {
|
||||
req.respCh <- cmdResp{status: st, err: err}
|
||||
|
||||
case cmdToEncoder:
|
||||
err := cardToEncoderPosition(c.port)
|
||||
err := cardToEncoderPosition(req.ctx, c.port)
|
||||
// A movement command makes any previously cached position unreliable.
|
||||
c.invalidateStatusCache()
|
||||
req.respCh <- cmdResp{err: err}
|
||||
|
||||
case cmdReset:
|
||||
err := resetDispenser(c.port)
|
||||
err := resetDispenser(req.ctx, c.port)
|
||||
c.invalidateStatusCache()
|
||||
req.respCh <- cmdResp{err: err}
|
||||
|
||||
case cmdOutOfMouth:
|
||||
err := cardOutOfMouth(c.port)
|
||||
err := cardOutOfMouth(req.ctx, c.port)
|
||||
// A movement command makes any previously cached position unreliable.
|
||||
c.invalidateStatusCache()
|
||||
req.respCh <- cmdResp{err: err}
|
||||
@@ -340,9 +340,7 @@ func (c *Client) readSequenceStatus(ctx context.Context, operation string) ([]by
|
||||
}
|
||||
|
||||
func preparationStatus(operation string, status []byte, allowCombinedFailure bool) (bool, error) {
|
||||
if len(status) != 4 {
|
||||
return false, fmt.Errorf("[%s] %w", operation, validateDispenserStatusData(status))
|
||||
}
|
||||
// A confirmed read sensor takes precedence over every other diagnostic.
|
||||
if isAtEncoderPosition(status) {
|
||||
if hasPreparationDiagnostics(status) {
|
||||
log.Warnf(
|
||||
@@ -367,7 +365,7 @@ func preparationStatus(operation string, status []byte, allowCombinedFailure boo
|
||||
// Some dispenser firmware briefly reports 0x32 ("Preparing card fails")
|
||||
// while the card is still travelling to the encoder. Treat that one
|
||||
// diagnostic as transient during an active preparation sequence and let
|
||||
// pollForEncoderPosition decide success (0x33) or timeout. Do not mask
|
||||
// pollForEncoderPosition decide encoder success or timeout. Do not mask
|
||||
// independent hard errors reported in the other status bytes.
|
||||
// Combined command rejection is also recoverable before the one retry.
|
||||
if status[0] == 0x32 || (status[0] == 0x36 && allowCombinedFailure) {
|
||||
|
||||
Reference in New Issue
Block a user