aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-03-15 00:49:55 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-03-16 17:21:57 +0100
commit7f041a55908c503037df4e3848d325dfdfee6c87 (patch)
tree8ebf62557cfe21269870cb0313b25650233ef2a7
parentecedda09c61309a3960cb2f779e8cbcc184dc0da (diff)
Change way to check prefix of signals name.
Change-Id: I9a0726ab41c4801e7a5305731ce78ddd03aff9e1 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--src/diagnostic/active-diagnostic-request.cpp5
-rw-r--r--src/diagnostic/active-diagnostic-request.hpp2
2 files changed, 5 insertions, 2 deletions
diff --git a/src/diagnostic/active-diagnostic-request.cpp b/src/diagnostic/active-diagnostic-request.cpp
index 5e43d7ab..762cb61c 100644
--- a/src/diagnostic/active-diagnostic-request.cpp
+++ b/src/diagnostic/active-diagnostic-request.cpp
@@ -15,6 +15,8 @@
* limitations under the License.
*/
+#include <fnmatch.h>
+
#include "active-diagnostic-request.hpp"
std::string active_diagnostic_request_t::prefix_ = "diagnostic_messages";
@@ -131,7 +133,8 @@ void active_diagnostic_request_t::set_in_flight(bool val)
*/
bool active_diagnostic_request_t::is_diagnostic_signal(const std::string& name)
{
- if(name.find_first_of(prefix_.c_str(), 0, prefix_.size()))
+ const std::string p = active_diagnostic_request_t::prefix_ + "*";
+ if(::fnmatch(p.c_str(), name.c_str(), FNM_CASEFOLD) == 0)
return true;
return false;
}
diff --git a/src/diagnostic/active-diagnostic-request.hpp b/src/diagnostic/active-diagnostic-request.hpp
index 74a969bc..f18282f6 100644
--- a/src/diagnostic/active-diagnostic-request.hpp
+++ b/src/diagnostic/active-diagnostic-request.hpp
@@ -92,7 +92,7 @@ public:
uint32_t get_id() const;
std::shared_ptr<can_bus_dev_t> get_can_bus_dev();
DiagnosticRequestHandle* get_handle();
- std::string& get_name();
+ const std::string get_name() const;
static std::string& get_prefix();
DiagnosticResponseDecoder& get_decoder();
DiagnosticResponseCallback& get_callback();