diff options
author | RALOVICH, Kristóf <tade60@freemail.hu> | 2013-03-26 11:33:07 +0100 |
---|---|---|
committer | RALOVICH, Kristóf <tade60@freemail.hu> | 2013-03-26 11:33:07 +0100 |
commit | 1381b80c8627463100e7936449df0856654f573c (patch) | |
tree | e83537bada1f0e7ae089d59e182ee389a082cbab | |
parent | 59c9fc0bed6b177da3c3e6b182db3158ec72caad (diff) |
fit2gpx: option to decode ANT root folder
-rw-r--r-- | src/antpm-fit2gpx.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/antpm-fit2gpx.cpp b/src/antpm-fit2gpx.cpp index 8a0137b..d21ee85 100644 --- a/src/antpm-fit2gpx.cpp +++ b/src/antpm-fit2gpx.cpp @@ -60,10 +60,12 @@ main(int argc, char** argv) { // Declare the supported options. std::string fitFolder; + std::string fitRootFile; po::options_description desc("Allowed options"); desc.add_options() ("help", "produce help message") - ("fitFolder,F", po::value<std::string>(&fitFolder)->required(), "Folder with FIT files") + ("fitFolder,F", po::value<std::string>(&fitFolder), "Folder with FIT files") + ("decode-fit-root,D", po::value<std::string>(&fitRootFile), "FIT file, encoding the root directory contents on a device") ; std::vector<const char*> args(argv, argv+argc); @@ -82,12 +84,23 @@ main(int argc, char** argv) return EXIT_FAILURE; } - if(vm.count("help")) + if(vm.count("help") + || (fitFolder.empty() && fitRootFile.empty())) { cout << desc << "\n"; return EXIT_SUCCESS; } - //LOG_VAR4(pairing, dirOnly, int(dlFileIdx), int(eraseFileIdx)); + + if(!fitRootFile.empty()) + { + ZeroFileContent zfc; + FIT fit; + vector<uchar> v(readFile(fitRootFile.c_str())); + if(fit.parseZeroFile(v, zfc)) + return EXIT_SUCCESS; + else + return EXIT_FAILURE; + } if(!fs::is_directory(fs::path(fitFolder))) { |