Multiple MetaWear C connections

Hello,

I am trying to connect 2 and stream only the data where RMS>6. I am able to connect to multiple devices and I am getting different MetaWearBoards using the getMetaWearBoard() call. But when I try to add the routes, I am not able to get both the boards to work. I am using the following code :
mwBoard1 = serviceBinder1.getMetaWearBoard(MW_Board1);
mwBoard1.connect();

mwBoard2 = serviceBinder2.getMetaWearBoard(MW_Board2);
mwBoard2.connect();

accelCtrllr1 = mwBoard1.getModule(Accelerometer.class);
accelCtrllr2 = mwBoard2.getModule(Accelerometer.class);

// Set the sampling frequency to 100Hz, or closest valid ODR
accelCtrllr1.setOutputDataRate(50.f);
accelCtrllr2.setOutputDataRate(50.f);
// Set the measurement range to +/- 8g, or closet valid range
accelCtrllr1.setAxisSamplingRange(16.f);
accelCtrllr2.setAxisSamplingRange(16.f);

accelCtrllr1.enableAxisSampling();
accelCtrllr2.enableAxisSampling();

accelCtrllr1.routeData().fromAxes()
.process(new Rms()).process(new Comparison(Comparison.Operation.GTE, 6))
.stream("AxesStream").commit().onComplete(new AsyncOperation.CompletionHandler<RouteManager>() {
@Override
public void success(RouteManager result) {
result.subscribe("AxesStream", new RouteManager.MessageHandler() {
@Override
public void process(Message message) {
Log.i("RMS 1", "" + message.getData(Float.class));
}
});
accelCtrllr1.start();

}
});

accelCtrllr2.routeData().fromAxes()
.process(new Rms()).process(new Comparison(Comparison.Operation.GTE, 6))
.stream("AxesStream").commit().onComplete(new AsyncOperation.CompletionHandler<RouteManager>() {
@Override
public void success(RouteManager result) {
result.subscribe("AxesStream", new RouteManager.MessageHandler() {
@Override
public void process(Message message) {
Log.i("RMS 2", "" + message.getData(Float.class));
}
});
accelCtrllr2.start();

}
});

The issue I am facing is that some times, the accelCtrllr1 is working and some time the accelCtrllr2 are working. I am not able to get both of them working together. I am not even getting any logs of any error.

P.S. I am using Android 5.1. I have tried the code with the C model as well as RG model.

Comments

This discussion has been closed.