Added FUSE support #55
63
fuse.go
63
fuse.go
@ -90,14 +90,7 @@ type ITNode struct {
|
|||||||
path string
|
path string
|
||||||
}
|
}
|
||||||
|
|
||||||
var properties = []ITProperty {
|
var properties = make([]ITProperty, 6)
|
||||||
ITProperty{"heartrate", 2, nil},
|
|
||||||
ITProperty{"battery", 3, nil},
|
|
||||||
ITProperty{"motion", 4, nil},
|
|
||||||
ITProperty{"stepcount", 5, nil},
|
|
||||||
ITProperty{"version", 6, nil},
|
|
||||||
ITProperty{"address", 7, nil},
|
|
||||||
}
|
|
||||||
var myfs *blefs.FS = nil;
|
var myfs *blefs.FS = nil;
|
||||||
var inodemap map[string]uint64 = nil;
|
var inodemap map[string]uint64 = nil;
|
||||||
|
|
||||||
@ -581,30 +574,36 @@ func startFuse(ctx context.Context, dev *infinitime.Device) error {
|
|||||||
Str("target", k.String("fuse.mountpoint")).
|
Str("target", k.String("fuse.mountpoint")).
|
||||||
Send()
|
Send()
|
||||||
|
|
||||||
properties[0].gen = func(ctx context.Context) (<-chan []byte, error) {
|
properties[0] = ITProperty{"heartrate", 2,
|
||||||
ans, err := dev.WatchHeartRate(ctx)
|
func(ctx context.Context) (<-chan []byte, error) {
|
||||||
return converterU8(ctx, ans), err
|
ans, err := dev.WatchHeartRate(ctx)
|
||||||
}
|
return converterU8(ctx, ans), err
|
||||||
properties[1].gen = func(ctx context.Context) (<-chan []byte, error) {
|
}}
|
||||||
ans, err := dev.WatchBatteryLevel(ctx)
|
properties[1] = ITProperty{"battery", 3,
|
||||||
return converterU8(ctx, ans), err
|
func(ctx context.Context) (<-chan []byte, error) {
|
||||||
}
|
ans, err := dev.WatchBatteryLevel(ctx)
|
||||||
properties[2].gen = func(ctx context.Context) (<-chan []byte, error) {
|
return converterU8(ctx, ans), err
|
||||||
ans, err := dev.WatchMotion(ctx)
|
}}
|
||||||
return converterMotionValues(ctx, ans), err
|
properties[2] = ITProperty{"motion", 4,
|
||||||
}
|
func(ctx context.Context) (<-chan []byte, error) {
|
||||||
properties[3].gen = func(ctx context.Context) (<-chan []byte, error) {
|
ans, err := dev.WatchMotion(ctx)
|
||||||
ans, err := dev.WatchStepCount(ctx)
|
return converterMotionValues(ctx, ans), err
|
||||||
return converterU32(ctx, ans), err
|
}}
|
||||||
}
|
properties[3] = ITProperty{"stepcount", 5,
|
||||||
properties[4].gen = func(ctx context.Context) (<-chan []byte, error) {
|
func(ctx context.Context) (<-chan []byte, error) {
|
||||||
ans, err := dev.Version()
|
ans, err := dev.WatchStepCount(ctx)
|
||||||
return converter1String(ctx, ans), err
|
return converterU32(ctx, ans), err
|
||||||
}
|
}}
|
||||||
properties[5].gen = func(ctx context.Context) (<-chan []byte, error) {
|
properties[4] = ITProperty{"version", 6,
|
||||||
ans := dev.Address()
|
func(ctx context.Context) (<-chan []byte, error) {
|
||||||
return converter1String(ctx, ans), nil
|
ans, err := dev.Version()
|
||||||
}
|
return converter1String(ctx, ans), err
|
||||||
|
}}
|
||||||
|
properties[5] = ITProperty{"address", 7,
|
||||||
|
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