Disconnect from board side automatically after certain time
I tried to add a function so that the board disconnects after inactivity a certain time. Didn't find any good API calls but tried to add a disconnect every minute with a timer. However, doesn't really look like it works or am I doing something wrong/better way to do it?
final Debug debugModule = mwBoard.getModule(Debug.class);
AsyncOperation<com.mbientlab.metawear.module.Timer.Controller> taskResult= mwBoard.getModule(com.mbientlab.metawear.module.Timer.class)
.scheduleTask(new com.mbientlab.metawear.module.Timer.Task() {
public void commands() {
debugModule.disconnect();
}
}, 60 * 1000, true);
taskResult.onComplete(new AsyncOperation.CompletionHandler<com.mbientlab.metawear.module.Timer.Controller>() {
public void success(com.mbientlab.metawear.module.Timer.Controller result) {
// start executing the task
result.start();
}
});
This discussion has been closed.
Comments