From 97c52a4827d4eb8bb85d26bb69efd363503bddf2 Mon Sep 17 00:00:00 2001 From: john30 Date: Sat, 7 Nov 2015 18:33:04 +0100 Subject: [PATCH] add filename to loaded scan config info --- src/ebusd/main.cpp | 7 +++++-- src/ebusd/main.h | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/ebusd/main.cpp b/src/ebusd/main.cpp index 643e73fe..64f835de 100644 --- a/src/ebusd/main.cpp +++ b/src/ebusd/main.cpp @@ -574,7 +574,8 @@ static result_t readConfigFiles(const string path, const string extension, DataF return RESULT_OK; }; -result_t loadConfigFiles(MessageMap* messages, bool recursive, bool verbose) { +result_t loadConfigFiles(MessageMap* messages, bool recursive, bool verbose) +{ logInfo(lf_main, "loading configuration files from %s", opt.configPath); string path = string(opt.configPath); messages->clear(); @@ -600,7 +601,8 @@ result_t loadConfigFiles(MessageMap* messages, bool recursive, bool verbose) { return result; } -result_t loadScanConfigFile(MessageMap* messages, unsigned char address, SymbolString& data) { +result_t loadScanConfigFile(MessageMap* messages, unsigned char address, SymbolString& data, string& relativeFile) +{ PartType partType; if (isMaster(address)) { address = (unsigned char)(data[0]+5); // slave address of sending master @@ -764,6 +766,7 @@ result_t loadScanConfigFile(MessageMap* messages, unsigned char address, SymbolS logError(lf_main, "error resolving conditions: %s, %s", getResultCode(result), messages->getLastError().c_str()); logNotice(lf_main, "found messages: %d (%d conditional on %d conditions, %d poll, %d update)", messages->size(), messages->sizeConditional(), messages->sizeConditions(), messages->sizePoll(), messages->sizePassive()); + relativeFile = best.substr(strlen(opt.configPath)+1); return RESULT_OK; } diff --git a/src/ebusd/main.h b/src/ebusd/main.h index 865f06ab..4294396d 100644 --- a/src/ebusd/main.h +++ b/src/ebusd/main.h @@ -75,8 +75,9 @@ result_t loadConfigFiles(MessageMap* messages, bool recursive=true, bool verbose * @param messages the @a MessageMap to load the messages into. * @param address the address of the scan participant (either master for broadcast master data or slave for read slave data). * @param data the scan @a SymbolString for which to load the configuration file. + * @param relativeFile the string in which the name of the configuration file is stored on success. * @return the result code. */ -result_t loadScanConfigFile(MessageMap* messages, unsigned char address, SymbolString& data); +result_t loadScanConfigFile(MessageMap* messages, unsigned char address, SymbolString& data, string& relativeFile); #endif // MAIN_H_