Added one-shot converter for strings
This commit is contained in:
parent
c5ca30cd0a
commit
1799c072ff
15
fuse.go
15
fuse.go
@ -88,6 +88,13 @@ func converterMotionValues(ctx context.Context, in <-chan infinitime.MotionValue
|
|||||||
return out
|
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 {
|
type ITProperty struct {
|
||||||
name string
|
name string
|
||||||
Ino uint64
|
Ino uint64
|
||||||
@ -619,6 +626,14 @@ func startFuse(ctx context.Context, dev *infinitime.Device) error {
|
|||||||
ans, err := dev.WatchStepCount(ctx)
|
ans, err := dev.WatchStepCount(ctx)
|
||||||
return converterU32(ctx, ans), err
|
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()
|
myfs, err = dev.FS()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user