added logging
This commit is contained in:
@@ -102,20 +102,24 @@ public class PersonalMotionPreviewElement extends View {
|
||||
* @param context The QiContext to provide.
|
||||
*/
|
||||
public void provideQiContext(QiContext context) {
|
||||
this.qiContext = context;
|
||||
if ( this.motionProcessor != null )
|
||||
this.motionProcessor.stopListening();
|
||||
try {
|
||||
this.qiContext = context;
|
||||
if (this.motionProcessor != null)
|
||||
this.motionProcessor.stopListening();
|
||||
|
||||
this.motionProcessor = new MotionProcessor();
|
||||
this.motionProcessor.startListening();
|
||||
this.motionProcessor = new MotionProcessor();
|
||||
this.motionProcessor.startListening();
|
||||
|
||||
// Handler that is called every time the motion processor receives new data.
|
||||
this.motionProcessor.setMotionDataEventHandler((processed, preprocessed, sampleIndex, sampleRate, deviceId) -> {
|
||||
int progress = (int)this.motionProcessor.getError(this.paths[0], processed);
|
||||
this.exerciseProgress.set(Math.min(1000, Math.max(0, progress)));
|
||||
Log.i("MotionProcessor", "Processed data: " + progress + " (" + preprocessed + ")");
|
||||
});
|
||||
saySomethingNice();
|
||||
// Handler that is called every time the motion processor receives new data.
|
||||
this.motionProcessor.setMotionDataEventHandler((processed, preprocessed, sampleIndex, sampleRate, deviceId) -> {
|
||||
int progress = (int) this.motionProcessor.getError(this.paths[0], processed);
|
||||
this.exerciseProgress.set(Math.min(1000, Math.max(0, progress)));
|
||||
Log.i("MotionProcessor", "Processed data: " + progress + " (" + preprocessed + ")");
|
||||
});
|
||||
saySomethingNice();
|
||||
} catch (Exception e) {
|
||||
Log.e("MotionProcessor", "An error occurred whilst attempting to provide QiContext:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user