No log entry in Logging module

Hi, I'm following both the wiki and the project http://projects.mbientlab.com/using-offline-logging-with-the-metawear-android-api
After start logging accelerometer or temperature in the loggingCallback  I've always 0 entry in receivedTotalEntryCount and both receivedTriggerId and receivedLogEntry is never called. I've only the downloadCompleted callback called
Here is my snippet

private void starLog() {
        logController.addTrigger(LoggingTrigger.ACCELEROMETER_X_AXIS);
        logController.addTrigger(LoggingTrigger.ACCELEROMETER_Y_AXIS);
        logController.addTrigger(LoggingTrigger.ACCELEROMETER_Z_AXIS);

        SamplingConfig accelSamplingConfig = accelController
                .enableXYZSampling();
        accelSamplingConfig
                .withFullScaleRange(SamplingConfig.FullScaleRange.FSR_8G)
                .withOutputDataRate(SamplingConfig.OutputDataRate.ODR_100_HZ)
                .withSilentMode();

        accelController.startComponents();
       
        logController.startLogging();
}

    private void stopLog() {       
        logController.stopLogging();
       
        // Download with progress
        logController.readTotalEntryCount();

        // Clean Up
        logController.removeTrigger(xAxisId);
        logController.removeTrigger(yAxisId);
        logController.removeTrigger(zAxisId);

        accelController.stopComponents();
}

private Logging.Callbacks logCallback = new Logging.Callbacks() {

        private ReferenceTick refTick;
        private final float notifyRatio = 0.01f;
        private boolean isDownloading;

        @Override
        public void receivedReferenceTick(ReferenceTick reference) {
            refTick = reference;
            // Got the reference tick, make lets get the log entry count
            logController.readTotalEntryCount();
        }

        @Override
        public void receivedTotalEntryCount(int totalEntries) {
                Log.i(TAG, "receivedTotalEntryCount()");
            if (!isDownloading) {
                isDownloading = true;
                // Got the entry count, lets now download the log
               logController.downloadLog(totalEntries, (int) (totalEntries * notifyRatio));
            }
        }

        public void receivedTriggerId(byte triggerId) {
            Log.i(TAG, "receivedTriggerId");
            if (xAxisId == -1) {
                xAxisId = triggerId;
            }
            if (yAxisId == -1) {
                yAxisId = triggerId;
            } else {
                zAxisId = triggerId;
            }
        };

        public void receivedLogEntry(Logging.LogEntry entry) {
            Log.i(TAG, "receivedLogEntry ");
        };
        public void downloadCompleted() {
            Log.i(TAG, "downloadCompleted ");
        };
}

Where I'm wrong?
When is called the receivedTriggerId callback? After the logController.addTrigger(LoggingTrigger.ACCELEROMETER_X_AXIS) ?

Thanks

Comments

  • After a reset on the metawear board the code start to work. Maybe in some test I have inadvertently saturated the board's logs register. Is that possible?
    To delete all the logs with the android API can I use removeLogEntries(65535)  ?
    Shall I have to delete log entry after downloaded them to avoid the saturation?

    Thanks
  • As per the comment on the method from the class documentation:

    Remove entries from the logger.  The erase operation will not be performed until you disconnect from the board.  If you wish to reset the board after the erase operation, use the {@link Debug#resetAfterGarbageCollect()} method.
  • Thanks.I do not understand if it is mandatory to remove log after download.
    Does the register has a sort of circular array, so after the last value of the register is set it starts from the first?
    What happnes when the register is full?
  • If you have downloaded the data, you do not need to call the removeLogEntries method; read entries are automatically freed.  However, you do need to disconnect from the board before it can completely free the memory.  This is necessary because the board cannot perform a flash erase while connected.

    Yes, the log entries are stored in a circular array and you are correct about how it works.

    As presently implemented, the logger will stop logging when it's full.  We are working on a logging option that can overwrite the oldest entries.  Users can choose which behavior they want.
  • edited March 2015
    Thanks for the explanation.
    So when the API will be ready, if the logger reaches 65535 it will restart logging from 0.
    If after an entire cycle of logging I dowonload 100 entries and the last entry is at position 50, I will get the entry from 65485... 65533, 65534,65535,0,1,2... 50 ?
  • Yes, that is correct.  There is actually only about ~15k entries in the logger and that number varies based on the size of the firmware.  You pass in 0xffff to guarantee that all log entries are removed.
  • Thanks!
    Hope the logging option will be released soon
This discussion has been closed.