feature: Add dummy mode
This commit is contained in:
parent
f79657afc2
commit
8b482cecd5
40 changed files with 323 additions and 141 deletions
40
ardriver/dummy/dummy_ar.go
Normal file
40
ardriver/dummy/dummy_ar.go
Normal file
|
@ -0,0 +1,40 @@
|
|||
//go:build dummy_ar
|
||||
// +build dummy_ar
|
||||
|
||||
package dummy
|
||||
|
||||
import (
|
||||
"git.terah.dev/UnrealXR/unrealxr/ardriver/commons"
|
||||
)
|
||||
|
||||
var IsDummyDeviceEnabled = true
|
||||
|
||||
// Implements commons.ARDevice
|
||||
type DummyDevice struct {
|
||||
}
|
||||
|
||||
func (device *DummyDevice) Initialize() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (device *DummyDevice) End() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (device *DummyDevice) IsPollingLibrary() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (device *DummyDevice) IsEventBasedLibrary() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (device *DummyDevice) Poll() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (device *DummyDevice) RegisterEventListeners(*commons.AREventListener) {}
|
||||
|
||||
func New() (*DummyDevice, error) {
|
||||
return &DummyDevice{}, nil
|
||||
}
|
42
ardriver/dummy/dummy_ar_disabled.go
Normal file
42
ardriver/dummy/dummy_ar_disabled.go
Normal file
|
@ -0,0 +1,42 @@
|
|||
//go:build !dummy_ar
|
||||
// +build !dummy_ar
|
||||
|
||||
package dummy
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.terah.dev/UnrealXR/unrealxr/ardriver/commons"
|
||||
)
|
||||
|
||||
var IsDummyDeviceEnabled = false
|
||||
|
||||
// Implements commons.ARDevice
|
||||
type DummyDevice struct {
|
||||
}
|
||||
|
||||
func (device *DummyDevice) Initialize() error {
|
||||
return fmt.Errorf("dummy device is not enabled")
|
||||
}
|
||||
|
||||
func (device *DummyDevice) End() error {
|
||||
return fmt.Errorf("dummy device is not enabled")
|
||||
}
|
||||
|
||||
func (device *DummyDevice) IsPollingLibrary() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (device *DummyDevice) IsEventBasedLibrary() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (device *DummyDevice) Poll() error {
|
||||
return fmt.Errorf("dummy device is not enabled")
|
||||
}
|
||||
|
||||
func (device *DummyDevice) RegisterEventListeners(*commons.AREventListener) {}
|
||||
|
||||
func New() (*DummyDevice, error) {
|
||||
return nil, fmt.Errorf("dummy device is not enabled")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue