How to log properly?

I am trying to use the multimw tutorial code to connect to multiple boards, but I cannot find any documentation on how the logging works.
In perticular, I want the logger to collect 64 samples and then send them to the phone.
I tried the delay function, but this sais that only 4 bytes can be delayed, which is not enough.
When I try to log the data most of the time I get a 'creation logger timed out', sometimes 4 or 5 samples, and every now and then a 100 samples.

I don't understand what is happening at the moment, and how to tell the board to log 64 samples before.

Comments

  • So far I have
    return accelerometer.acceleration().addRouteAsync(new RouteBuilder() {
    @Override
    public void configure(RouteComponent source) {
    source.log(new Subscriber() {
    int samples = 0;
    @Override
    public void apply(final Data data, Object... env) {
    getActivity().runOnUiThread(new Runnable() {
    @Override
    public void run() {
    newDeviceState.accelValue [samples] = data.value(Acceleration.class).toString();
    connectedDevices.notifyDataSetChanged();
    Log.i("MainActivityFragment", "State changed: ");
    samples++;
    }
    });
    }
    });
    }
    });
    And then in then after starting the accelerometer and logging:
    loggingCapture.get().downloadAsync(100, new Logging.LogDownloadUpdateHandler() {
    @Override
    public void receivedUpdate(long nEntriesLeft, long totalEntries) {
    Log.i("MainActivityFragment", "Progress Update = " + nEntriesLeft + "/" + totalEntries);
    }
    }).continueWithTask(new Continuation<Void, Task<Void>>() {
    @Override
    public Task<Void> then(Task<Void> task) throws Exception {
    Log.i("MainActivityFragment", "Download completed at " + accelCapture.get().getOdr());
    loggingCapture.get().stop();
    return null;
    }
    });
  • Use the passthrough limiter in count mode to only record a fixed number of samples.  

    You need to remove resources allocated on the board when you are done using them.  It looks like you are simply creating routes and never removing them which results in the aforementioned exception.  You can use the tearDown method to remove all allocated resources on a board.
This discussion has been closed.