Added an interface to support multiple games

- In the same way, I expect the addition of the ability of holding
multiple sinks in memory like outputting to a TUI, GUI and other
hardware devices
This commit is contained in:
2024-10-19 21:42:54 +01:00
commit eea5925b90
6 changed files with 204 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
package iracing
import (
"esilva.org.localhost/bngsdk"
)
// This will implement the GameSink interface from the main package
type BeamNG struct {
SDK *bngsdk.BNGSDK
}
const (
NAME = "iRacing"
)
func Init(ip string, port int) (BeamNG, error) {
var err error
sdk, err := bngsdk.Init(ip, port)
if err != nil {
return BeamNG{}, err
}
return BeamNG{SDK: &sdk}, nil
}
func (b *BeamNG) GetData(fieldName string, out interface{}) error {
return nil
}
func (b *BeamNG) UpdateData() error {
return b.SDK.ReadData()
}