Added one-shot converter for strings

This commit is contained in:
Yannick Ulrich 2023-02-26 19:08:35 +00:00
parent c5ca30cd0a
commit 1799c072ff
1 changed files with 15 additions and 0 deletions

15
fuse.go
View File

@ -88,6 +88,13 @@ func converterMotionValues(ctx context.Context, in <-chan infinitime.MotionValue
return out
}
func converter1String(ctx context.Context, in string) <-chan []byte {
out := make(chan []byte, 2)
out <- []byte(in + "\n")
close(out)
return out
}
type ITProperty struct {
name string
Ino uint64
@ -619,6 +626,14 @@ func startFuse(ctx context.Context, dev *infinitime.Device) error {
ans, err := dev.WatchStepCount(ctx)
return converterU32(ctx, ans), err
}
properties[4].gen = func(ctx context.Context) (<-chan []byte, error) {
ans, err := dev.Version()
return converter1String(ctx, ans), err
}
properties[5].gen = func(ctx context.Context) (<-chan []byte, error) {
ans := dev.Address()
return converter1String(ctx, ans), nil
}
myfs, err = dev.FS()
if err != nil {