TimeoutException: Creating a MetaWear timer timed out after 3000ms
I am trying to set up a timer on my MetaMorion R board running in my Android app using version 2.8.0 of the MetaWear Android API. But for some reason I can't successfully schedule a timer task. I keep getting the following message: "TimeoutException: Creating a MetaWear timer timed out after 2000ms"
This is what my code looks like:
if (mMWBoard1 != null && mMWBoard1.isConnected()) {
try {
gpio = mMWBoard1.getModule(Gpio.class);
Debug debug = mMWBoard1.getModule(Debug.class);
debug.resetDevice();
timer = mMWBoard1.getModule(Timer.class);
timer.removeTimers();
Timer.Task sendCodeBitTask = new Task() {
@Override
public void commands() {...
}
};
AsyncOperation<Timer.Controller> taskResult=
timer
.scheduleTask(sendCodeBitTask, 1000, false, (short) 5);
taskResult.onComplete(new AsyncOperation.CompletionHandler<Timer.Controller>() {
@Override
public void success(Timer.Controller result) {
// start executing the task
result.start();
}
@Override
public void failure(Throwable error) {
Log.e(TAG, error.toString());
}
});
} catch (UnsupportedModuleException e) {
Log.e(TAG, e.toString());
}
}
And this is the stack trace:
...
09-07 20:04:20.231 6086-6279/com.example.android.vpt D/BluetoothGatt: onClientConnectionState() - status=8 clientIf=5 device=DC:A8:5D:64:75:63
09-07 20:04:20.276 6086-6279/com.example.android.vpt D/BluetoothGatt: refresh() - device: DC:A8:5D:64:75:63
09-07 20:04:20.281 6086-6279/com.example.android.vpt D/BluetoothGatt: close()
09-07 20:04:20.284 6086-6279/com.example.android.vpt D/BluetoothGatt: unregisterApp() - mClientIf=5
09-07 20:04:27.848 6086-6086/com.example.android.vpt E/MetaWear: java.util.concurrent.TimeoutException: Creating a MetaWear timer timed out after 3000ms
Any ideas?
This discussion has been closed.
Comments
reset
reboots the board. It is not meant to be used within a normal app flow, hence being placed in the Debug interface.commands
function? Does the timeout error consistently happen if you are using a clean board i.e. one that was just powered on or rebooted? If rebooted, you need to wait for the d/c event and then reconnect before proceeding.