From 7ce4d0ed4bf03691a023b90c0771ac2edfceeda2 Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Wed, 30 Oct 2024 23:26:29 +0000 Subject: [PATCH] Added the Linux and Darwin stubs for the winutils package This means that the livedata bit of the code is only available on windows --- winutils/winutils_linux.go | 53 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 winutils/winutils_linux.go diff --git a/winutils/winutils_linux.go b/winutils/winutils_linux.go new file mode 100644 index 0000000..e41a66c --- /dev/null +++ b/winutils/winutils_linux.go @@ -0,0 +1,53 @@ +//go:build (linux && cgo) || (darwin && cgo) +// +build linux,cgo darwin,cgo + +package winutils + +import ( + "errors" + "sync" + "time" +) + +const ( + WAIT_OBJECT_0 = 0 + WAIT_TIMEOUT = 258 +) + +var ( + once sync.Once + ErrUnsupportedOS = errors.New("not found") +) + +type utils struct { +} + +// INITIALIZATION +func newUtils() (*utils, error) { + return nil, ErrUnsupportedOS +} + +func (u *utils) Close() { +} + +// openEvent opens a windows.Handle for a given event +func (u *utils) OpenEvent(eventName string) error { + return ErrUnsupportedOS +} + +// OpenBroadcastChannel opens up a broadcast channel to send commands to iracing +func (u *utils) OpenBroadcastChannel(name string) error { + return ErrUnsupportedOS +} + +// INITIALIZATION + +// openEvent waits for a good response for some given time +func (u *utils) CheckValidDataEvent(timeout time.Duration) bool { + return false +} + +// SendBroadcastMessage sends a message trough the broadcast channel +func (u *utils) SendBroadcastMessage(id, p1, p2 uintptr) error { + return ErrUnsupportedOS +}