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;
}
});



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!


Comments

  • How is this code being executed within the context of your app?  Furthermore, how does a user typically use the app?
  • Basically the app controls a rehabilitation task. The task consists of pressing the button on the bracelet when the LED turns on. I know how many times the led lights up in a certain amount of time, and I would like to count how many times the user has pressed the button to turn the light off. In this way I can give a score to the task: for example: "you have turned off 3 out of 4 lights". 
  • What I'm asking is how does the user execute that code from the app?  What does the app do after the code is executed?  How does the user trigger a log download?

    The code by itself looks fine to me so the question is how does it fit within the context of the app.
This discussion has been closed.