protocol should be pkg

This commit is contained in:
bel
2023-03-24 20:05:55 -06:00
parent ea7f2d8932
commit 9990273b19
4 changed files with 39 additions and 6 deletions

View File

@@ -0,0 +1,21 @@
package wrap
import "mayhem-party/src/device/input/raw"
type Protocol struct {
src raw.Raw
}
func NewProtocol(src raw.Raw) Protocol {
return Protocol{
src: src,
}
}
func (p Protocol) Close() {
p.src.Close()
}
func (p Protocol) Read() []Button {
panic(nil)
}

View File

@@ -16,6 +16,11 @@ func New(ctx context.Context, src raw.Raw) Wrap {
maker := func() Wrap {
return explicit{src: src}
}
if os.Getenv("WRAP_PROTOCOL") == "true" {
maker = func() Wrap {
return NewProtocol(src)
}
}
if os.Getenv("WRAP_BUFFERED") == "true" {
oldMaker := maker
maker = func() Wrap {

View File

@@ -7,4 +7,5 @@ func TestWrap(t *testing.T) {
var _ Wrap = &Refresh{}
var _ Wrap = &Buffered{}
var _ Wrap = &Remap{}
var _ Wrap = Protocol{}
}