Fixed the evutils assignment
I will still have to look and clean this all up but I need to make it work
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
|
|
||||||
eventutils "github.com/ESilva15/goirsdk/eventutils"
|
eventutils "github.com/ESilva15/goirsdk/eventutils"
|
||||||
"github.com/ESilva15/goirsdk/sharedMem"
|
"github.com/ESilva15/goirsdk/sharedMem"
|
||||||
@@ -109,7 +110,7 @@ func (i *IBT) exportIBT(data []byte, offset int64) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
i.Opts.Logger.Debug("failed to signal event", "err", err)
|
i.Opts.Logger.Debug("failed to signal event", "err", err)
|
||||||
} else {
|
} else {
|
||||||
i.Opts.Logger.Debug("no error signaling: ", "nBytes", nBytes)
|
i.Opts.Logger.Debug("no error signaling", "nBytes", nBytes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,10 +131,10 @@ func (i *IBT) openSource() error {
|
|||||||
// To use our windows interface we need to initialize it first
|
// To use our windows interface we need to initialize it first
|
||||||
// it will return a struct with a pointer to the windows handles
|
// it will return a struct with a pointer to the windows handles
|
||||||
// if, for some reason, we need to stub out this to run in on Linux its easier
|
// if, for some reason, we need to stub out this to run in on Linux its easier
|
||||||
i.winUtils, err = eventutils.Init()
|
// i.winUtils, err = eventutils.Init()
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return err
|
// return err
|
||||||
}
|
// }
|
||||||
|
|
||||||
// I don't believe we need this on windows either, but I'll have to check
|
// I don't believe we need this on windows either, but I'll have to check
|
||||||
// We need to open the windows event thing
|
// We need to open the windows event thing
|
||||||
@@ -196,7 +197,10 @@ func Init(opts Options) (*IBT, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
evutils.OpenEvent(IRSDK_DATAVALIDEVENTNAME)
|
err = evutils.OpenEvent(IRSDK_DATAVALIDEVENTNAME)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
ibt.winUtils = evutils
|
ibt.winUtils = evutils
|
||||||
|
|
||||||
// Setup the source
|
// Setup the source
|
||||||
@@ -246,6 +250,16 @@ func (i *IBT) ListVariables() map[string]Var {
|
|||||||
return i.Vars.Vars
|
return i.Vars.Vars
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CheckForDataEvent
|
||||||
|
// timeout is in ms
|
||||||
|
func (i *IBT) CheckForDataEvent(timeout time.Duration) bool {
|
||||||
|
if i.winUtils.CheckValidDataEvent(timeout) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// Close cleans up our irsdk instance
|
// Close cleans up our irsdk instance
|
||||||
func (i *IBT) Close() {
|
func (i *IBT) Close() {
|
||||||
if i == nil {
|
if i == nil {
|
||||||
@@ -258,7 +272,3 @@ func (i *IBT) Close() {
|
|||||||
i.winUtils.Close()
|
i.winUtils.Close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// LastTick returns the last tick
|
|
||||||
// func (i *IBT) LastTick() int {
|
|
||||||
// }
|
|
||||||
|
|||||||
Reference in New Issue
Block a user