Count number of Button Press on the board
Hello,
I've been trying to count how many times the button on the board is pressed even when there is no BLE connection. I need to log and then download the data. The problem is that when I download data it tells me that there is no subscriber to handle log data. But the good thing is that somehow it gives me back the data I need next to that message as you can see in the messages below.
07-27 23:07:42.369 21336-21352/com.mbientlab.metawear.app1 W/metawear: No subscriber to handle log data: {logId: 1, time: 1501189597755, data: [0x01, 0x00, 0x00, 0x00]}
07-27 23:07:42.369 21336-21352/com.mbientlab.metawear.app1 W/metawear: No subscriber to handle log data: {logId: 1, time: 1501189628363, data: [0x02, 0x00, 0x00, 0x00]}
07-27 23:07:42.369 21336-21352/com.mbientlab.metawear.app1 W/metawear: No subscriber to handle log data: {logId: 1, time: 1501189659120, data: [0x03, 0x00, 0x00, 0x00]}
How can I get the time and data [0x03] saved into a variable or into a Textview?
I can also attach my code:
mwBoard.getModule(Switch.class).state().addRouteAsync(new RouteBuilder() {
@Override
public void configure(RouteComponent source) {
source.count().map(Function2.MODULUS, 2)
.multicast()
.to().filter(Comparison.EQ, 1).accumulate().log(new Subscriber() {
@Override
public void apply(Data data, Object... env) {
Log.i("MainActivity", data.toString());
}
});
}
}).continueWith(new Continuation() {
@Override
public Void then(Task task) throws Exception {
logging.start(true);
return null;
}
});
@Override
public void configure(RouteComponent source) {
source.count().map(Function2.MODULUS, 2)
.multicast()
.to().filter(Comparison.EQ, 1).accumulate().log(new Subscriber() {
@Override
public void apply(Data data, Object... env) {
Log.i("MainActivity", data.toString());
}
});
}
}).continueWith(new Continuation() {
@Override
public Void then(Task task) throws Exception {
logging.start(true);
return null;
}
});
Obviously, because it's saying that there is no Subscriber it doesn't do what's in the Apply method.
Thank you for your help!
This discussion has been closed.
Comments