Merged two properties lists
This commit is contained in:
parent
08c8d7e8de
commit
2440cb954c
63
fuse.go
63
fuse.go
@ -90,14 +90,7 @@ type ITNode struct {
|
||||
path string
|
||||
}
|
||||
|
||||
var properties = []ITProperty {
|
||||
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 properties = make([]ITProperty, 6)
|
||||
var myfs *blefs.FS = 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")).
|
||||
Send()
|
||||
|
||||
properties[0].gen = func(ctx context.Context) (<-chan []byte, error) {
|
||||
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)
|
||||
return converterU8(ctx, ans), err
|
||||
}
|
||||
properties[2].gen = func(ctx context.Context) (<-chan []byte, error) {
|
||||
ans, err := dev.WatchMotion(ctx)
|
||||
return converterMotionValues(ctx, ans), err
|
||||
}
|
||||
properties[3].gen = func(ctx context.Context) (<-chan []byte, 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
|
||||
}
|
||||
properties[0] = ITProperty{"heartrate", 2,
|
||||
func(ctx context.Context) (<-chan []byte, error) {
|
||||
ans, err := dev.WatchHeartRate(ctx)
|
||||
return converterU8(ctx, ans), err
|
||||
}}
|
||||
properties[1] = ITProperty{"battery", 3,
|
||||
func(ctx context.Context) (<-chan []byte, error) {
|
||||
ans, err := dev.WatchBatteryLevel(ctx)
|
||||
return converterU8(ctx, ans), err
|
||||
}}
|
||||
properties[2] = ITProperty{"motion", 4,
|
||||
func(ctx context.Context) (<-chan []byte, error) {
|
||||
ans, err := dev.WatchMotion(ctx)
|
||||
return converterMotionValues(ctx, ans), err
|
||||
}}
|
||||
properties[3] = ITProperty{"stepcount", 5,
|
||||
func(ctx context.Context) (<-chan []byte, error) {
|
||||
ans, err := dev.WatchStepCount(ctx)
|
||||
return converterU32(ctx, ans), err
|
||||
}}
|
||||
properties[4] = ITProperty{"version", 6,
|
||||
func(ctx context.Context) (<-chan []byte, error) {
|
||||
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()
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user