diff --git a/_run/values/ver.txt b/_run/values/ver.txt index f87d474..79b0815 100644 --- a/_run/values/ver.txt +++ b/_run/values/ver.txt @@ -1 +1 @@ -v0.4.3 +v0.4.4 diff --git a/acceptor/acceptor.go b/acceptor/acceptor.go index 295478e..76da700 100644 --- a/acceptor/acceptor.go +++ b/acceptor/acceptor.go @@ -40,6 +40,38 @@ var WasStopped bool var OpenThread bool var FlashDownloadThread bool +// + +func Clean() { + Connected = false + AutoStack = false + HighSecurity = false + + InSoftResetOneSecondIgnore = false + InSoftResetWaitForReply = false + ExpandedNoteReporting = false + IsQueryDeviceCapabilitiesSupported = false + IsCheated = false + IsPoweredUp = false + IsInvalidCommand = false + WasDocTypeSetOnEscrow = false + WasDisconnected = false + IsVeryFirstPoll = false + StopWorkerThread = false + StopOpenThread = false + StopFlashDownloadThread = false + SuppressStandardPoll = false + WasStopped = false + OpenThread = false + FlashDownloadThread = false + + Cap = CapStruct{} + Cash = CashStruct{} + Device = DeviceStruct{} + Enable = EnableStruct{} + Timeout = TimeoutStruct{} +} + //// func ConstructOmnibusCommand(payload []byte, controlCode consts.CmdType, data0Index int, billTypeEnables []bool) { diff --git a/command/func.go b/command/func.go index 17c6576..2cfc7cb 100644 --- a/command/func.go +++ b/command/func.go @@ -12,3 +12,7 @@ func CRC(command []byte) byte { return result } + +func Clean() { + coin = false +} diff --git a/const.go b/const.go index f9d1c2f..640e59e 100644 --- a/const.go +++ b/const.go @@ -3,10 +3,10 @@ package mpost const ( GlobalName string = "mpost" GlobalDateUpdate string = "09-12-2024" - GlobalHash string = "38d436fb02c32ff6111f28ca1db70b3bc4ddf157" + GlobalHash string = "1f0624da6b982a29ae3e4ab0e322551de126e89d" - GlobalVersion string = "v0.4.3" + GlobalVersion string = "v0.4.4" GlobalVersionMajor string = "v0" GlobalVersionMinor uint16 = 4 - GlobalVersionPatch uint16 = 3 + GlobalVersionPatch uint16 = 4 ) diff --git a/hook/hook.go b/hook/hook.go index 5fc9987..29612c2 100644 --- a/hook/hook.go +++ b/hook/hook.go @@ -9,3 +9,34 @@ var eventHandlers = make(map[enum.EventType]func(int), enum.Event_End) func Add(ev enum.EventType, h func(int)) { eventHandlers[ev] = h } + +func Clean() { + eventHandlers = make(map[enum.EventType]func(int), enum.Event_End) + + Connected = false + Escrow = false + PUPEscrow = false + Stacked = false + Returned = false + Rejected = false + Cheated = false + StackerFull = false + CalibrateStart = false + CalibrateProgress = false + CalibrateFinish = false + DownloadStart = false + DownloadRestart = false + DownloadProgress = false + DownloadFinish = false + PauseDetected = false + PauseCleared = false + StallDetected = false + StallCleared = false + JamDetected = false + JamCleared = false + PowerUp = false + InvalidCommand = false + CashBoxAttached = false + CashBoxRemoved = false + Disconnected = false +} diff --git a/mpost.go b/mpost.go index 73fc02e..128feb7 100644 --- a/mpost.go +++ b/mpost.go @@ -2,6 +2,8 @@ package mpost import ( "context" + "github.com/hard-soft-ware/mpost/acceptor" + "github.com/hard-soft-ware/mpost/command" "github.com/hard-soft-ware/mpost/enum" "github.com/hard-soft-ware/mpost/hook" "github.com/hard-soft-ware/mpost/serial" @@ -32,6 +34,10 @@ func New() *MpostObj { Log: newLog(), } + acceptor.Clean() + command.Clean() + hook.Clean() + obj.Method = obj.newMethods() obj.Ctx, obj.CtxCancel = context.WithCancel(context.Background())