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
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
This discussion has been closed.
Comments
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
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 ?
Hope the logging option will be released soon