Closed isorrentino closed 3 years ago
That kind of check is already done by yarp::telemetry::Buffermanager
:
Probably it makes sense to just remove those lines in the telemetryDeviceDumper
and let the BufferManager
s do the autosave if enabled
@Nicogene I modified the code following your suggestion.
Sorry probably I didn't make myself clear, I meant to delete just the save to file in the closure of telelemetryDeviceDumper
, then https://github.com/robotology/yarp-telemetry/pull/136/commits/08ed7a8f99769dfc68c8cd17445240aa0c91002a is sufficient, I would not change the behaviour of the BufferManager
With just https://github.com/robotology/yarp-telemetry/commit/08ed7a8f99769dfc68c8cd17445240aa0c91002a, when the option autosave
is false
, data are not written to a file. That is why I modified also BufferManager
.
Probably the auto_save
parameter is ambiguous, it is meant to just save automatically the data when you close your application that uses the BufferManager, but also if it is false the periodic save is not disabled.
The warning you saw was due to the fact, even if auto_save is set to true, on closure telemetryDeviceDumper
try to save the data, but it is already done by the BufferManager
under the hood, and then the result is that BufferManager.saveToFile
is called twice consecutively.
Thanks, @Nicogene. I modified the code again and removed the previous commits.
I noticed this log message when using the dumper with the option autosave:
By checking the code I noticed that when the
close()
is called, it tries to save data to a file. But in case the option autosave istrue
, data have already been written. I added a statement to check whether the option is true. If yes, the saving is not called.cc @prashanthr05