diff options
author | 2017-05-30 17:00:44 +0200 | |
---|---|---|
committer | 2017-06-01 18:22:49 +0200 | |
commit | eafde4cec4fc026444501ed3a096a12e6eb8fc90 (patch) | |
tree | ca3525cc533afc5bdd67c08ffd0fed9463484368 /CAN-binder/low-can-binding/binding | |
parent | 83bfb229e581e475cdd98b95de9701be8b784332 (diff) |
Renaming configuration to application
It is more accurate to name it application because all its
members aren't modifiable at runtime (without talking of last_value_
member and few others).
Change-Id: Ica0d33dfd9c26cfdea019c2f41ed07777fb36d39
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/low-can-binding/binding')
-rw-r--r-- | CAN-binder/low-can-binding/binding/application-generated.cpp (renamed from CAN-binder/low-can-binding/binding/configuration-generated.cpp) | 6 | ||||
-rw-r--r-- | CAN-binder/low-can-binding/binding/application.cpp (renamed from CAN-binder/low-can-binding/binding/configuration.cpp) | 30 | ||||
-rw-r--r-- | CAN-binder/low-can-binding/binding/application.hpp (renamed from CAN-binder/low-can-binding/binding/configuration.hpp) | 9 | ||||
-rw-r--r-- | CAN-binder/low-can-binding/binding/low-can-cb.cpp | 4 | ||||
-rw-r--r-- | CAN-binder/low-can-binding/binding/low-can-hat.cpp | 6 |
5 files changed, 26 insertions, 29 deletions
diff --git a/CAN-binder/low-can-binding/binding/configuration-generated.cpp b/CAN-binder/low-can-binding/binding/application-generated.cpp index 2939fc8..318dd76 100644 --- a/CAN-binder/low-can-binding/binding/configuration-generated.cpp +++ b/CAN-binder/low-can-binding/binding/application-generated.cpp @@ -1,7 +1,7 @@ -#include "configuration.hpp" +#include "application.hpp" #include "../can/can-decoder.hpp" -configuration_t::configuration_t() +application_t::application_t() : can_bus_manager_{utils::config_parser_t{"/etc/dev-mapping.conf"}} , can_message_set_{ {std::make_shared<can_message_set_t>(can_message_set_t{0,"example", @@ -478,7 +478,7 @@ configuration_t::configuration_t() } } -const std::string configuration_t::get_diagnostic_bus() const +const std::string application_t::get_diagnostic_bus() const { return "hs"; } diff --git a/CAN-binder/low-can-binding/binding/configuration.cpp b/CAN-binder/low-can-binding/binding/application.cpp index 8e6ddde..b916523 100644 --- a/CAN-binder/low-can-binding/binding/configuration.cpp +++ b/CAN-binder/low-can-binding/binding/application.cpp @@ -15,70 +15,70 @@ * limitations under the License. */ -#include "configuration.hpp" +#include "application.hpp" #include "../utils/signals.hpp" #include "../utils/openxc-utils.hpp" /// @brief Return singleton instance of configuration object. -configuration_t& configuration_t::instance() +application_t& application_t::instance() { - static configuration_t config; + static application_t config; return config; } -can_bus_t& configuration_t::get_can_bus_manager() +can_bus_t& application_t::get_can_bus_manager() { return can_bus_manager_; } -diagnostic_manager_t& configuration_t::get_diagnostic_manager() +diagnostic_manager_t& application_t::get_diagnostic_manager() { return diagnostic_manager_; } -uint8_t configuration_t::get_active_message_set() const +uint8_t application_t::get_active_message_set() const { return active_message_set_; } -std::vector<std::shared_ptr<can_message_set_t> > configuration_t::get_can_message_set() +std::vector<std::shared_ptr<can_message_set_t> > application_t::get_can_message_set() { return can_message_set_; } -std::vector<std::shared_ptr<can_signal_t> > configuration_t::get_all_can_signals() +std::vector<std::shared_ptr<can_signal_t> > application_t::get_all_can_signals() { return can_message_set_[active_message_set_]->get_all_can_signals(); } -std::vector<std::shared_ptr<diagnostic_message_t> >& configuration_t::get_diagnostic_messages() +std::vector<std::shared_ptr<diagnostic_message_t> >& application_t::get_diagnostic_messages() { return can_message_set_[active_message_set_]->get_diagnostic_messages(); } -std::vector<std::shared_ptr<can_message_definition_t> >& configuration_t::get_can_message_definition() +std::vector<std::shared_ptr<can_message_definition_t> >& application_t::get_can_message_definition() { return can_message_set_[active_message_set_]->get_can_message_definition(); } -uint32_t configuration_t::get_signal_id(diagnostic_message_t& sig) const +uint32_t application_t::get_signal_id(diagnostic_message_t& sig) const { return sig.get_pid(); } -uint32_t configuration_t::get_signal_id(can_signal_t& sig) const +uint32_t application_t::get_signal_id(can_signal_t& sig) const { return sig.get_message()->get_id(); } -void configuration_t::set_active_message_set(uint8_t id) +void application_t::set_active_message_set(uint8_t id) { active_message_set_ = id; } -std::shared_ptr<diagnostic_message_t> configuration_t::get_diagnostic_message(const std::string& message_name) const +std::shared_ptr<diagnostic_message_t> application_t::get_diagnostic_message(const std::string& message_name) const { struct utils::signals_found found; found = utils::signals_manager_t::instance().find_signals(build_DynamicField(message_name)); @@ -87,7 +87,7 @@ std::shared_ptr<diagnostic_message_t> configuration_t::get_diagnostic_message(co return nullptr; } -DiagnosticRequest* configuration_t::get_request_from_diagnostic_message(const std::string& message_name) const +DiagnosticRequest* application_t::get_request_from_diagnostic_message(const std::string& message_name) const { std::shared_ptr<diagnostic_message_t> diag_msg = get_diagnostic_message(message_name); if( diag_msg != nullptr && diag_msg->get_supported()) diff --git a/CAN-binder/low-can-binding/binding/configuration.hpp b/CAN-binder/low-can-binding/binding/application.hpp index fc53d38..50b2375 100644 --- a/CAN-binder/low-can-binding/binding/configuration.hpp +++ b/CAN-binder/low-can-binding/binding/application.hpp @@ -40,7 +40,7 @@ /// /// It will be the reference point to needed objects. /// -class configuration_t +class application_t { private: can_bus_t can_bus_manager_; ///< instanciate the CAN bus manager. It's the one in charge of initialize the CAN bus devices. @@ -48,14 +48,11 @@ class configuration_t uint8_t active_message_set_ = 0; ///< Which is the active message set ? Default to 0. std::vector<std::shared_ptr<can_message_set_t> > can_message_set_; ///< Vector holding all message set from JSON signals description file - //std::vector<std::vector<can_message_definition_t>> can_message_definition_; ///< Vector of vector holding all can message definition from JSON signals description file. This describe a CAN message. First vector map to message set - //std::vector<std::vector<can_signal_t>> can_signals_; ///< Vector of vector holding all can signasl from JSON signals description file. A CAN signal is a part of a CAN message. First vector map to message set - //std::vector<std::vector<std::shared_ptr<diagnostic_message_t> > > diagnostic_messages_; ///< Vector of vector holding all diagnostics messages from JSON signals description file. First vector map to message set - configuration_t(); ///< Private constructor with implementation generated by the AGL generator. + application_t(); ///< Private constructor with implementation generated by the AGL generator. public: - static configuration_t& instance(); + static application_t& instance(); can_bus_t& get_can_bus_manager(); diff --git a/CAN-binder/low-can-binding/binding/low-can-cb.cpp b/CAN-binder/low-can-binding/binding/low-can-cb.cpp index 0dcff1d..8141c3d 100644 --- a/CAN-binder/low-can-binding/binding/low-can-cb.cpp +++ b/CAN-binder/low-can-binding/binding/low-can-cb.cpp @@ -27,7 +27,7 @@ #include <systemd/sd-event.h> #include "openxc.pb.h" -#include "configuration.hpp" +#include "application.hpp" #include "../can/can-bus.hpp" #include "../can/can-signals.hpp" #include "../can/can-message.hpp" @@ -187,7 +187,7 @@ static int subscribe_unsubscribe_signals(struct afb_req request, bool subscribe, //TODO: Implement way to dynamically call the right function no matter // how much signals types we have. - configuration_t& conf = configuration_t::instance(); + application_t& conf = application_t::instance(); for(const auto& sig : signals.diagnostic_messages) { diff --git a/CAN-binder/low-can-binding/binding/low-can-hat.cpp b/CAN-binder/low-can-binding/binding/low-can-hat.cpp index 918625f..5cefc81 100644 --- a/CAN-binder/low-can-binding/binding/low-can-hat.cpp +++ b/CAN-binder/low-can-binding/binding/low-can-hat.cpp @@ -24,7 +24,7 @@ #include <vector> #include <json-c/json.h> -#include "configuration.hpp" +#include "application.hpp" #include "../can/can-bus.hpp" extern "C" @@ -66,7 +66,7 @@ extern "C" /// @return Exit code, zero if success. int afbBindingV1ServiceInit(struct afb_service service) { - can_bus_t& can_bus_manager = configuration_t::instance().get_can_bus_manager(); + can_bus_t& can_bus_manager = application_t::instance().get_can_bus_manager(); can_bus_manager.set_can_devices(); can_bus_manager.start_threads(); @@ -74,7 +74,7 @@ extern "C" /// Initialize Diagnostic manager that will handle obd2 requests. /// We pass by default the first CAN bus device to its Initialization. /// TODO: be able to choose the CAN bus device that will be use as Diagnostic bus. - if(configuration_t::instance().get_diagnostic_manager().initialize()) + if(application_t::instance().get_diagnostic_manager().initialize()) return 0; ERROR(binder_interface, "%s: There was something wrong with CAN device Initialization.", __FUNCTION__); |