summaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding
diff options
context:
space:
mode:
Diffstat (limited to 'CAN-binder/low-can-binding')
-rw-r--r--CAN-binder/low-can-binding/CMakeLists.txt4
-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.cpp4
-rw-r--r--CAN-binder/low-can-binding/binding/low-can-hat.cpp6
-rw-r--r--CAN-binder/low-can-binding/can/can-bus.cpp4
-rw-r--r--CAN-binder/low-can-binding/can/can-message-definition.cpp4
-rw-r--r--CAN-binder/low-can-binding/can/can-signals.cpp2
-rw-r--r--CAN-binder/low-can-binding/diagnostic/active-diagnostic-request.cpp2
-rw-r--r--CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp8
-rw-r--r--CAN-binder/low-can-binding/diagnostic/diagnostic-message.cpp2
-rw-r--r--CAN-binder/low-can-binding/utils/openxc-utils.cpp4
-rw-r--r--CAN-binder/low-can-binding/utils/signals.cpp8
-rw-r--r--CAN-binder/low-can-binding/utils/signals.hpp4
15 files changed, 47 insertions, 50 deletions
diff --git a/CAN-binder/low-can-binding/CMakeLists.txt b/CAN-binder/low-can-binding/CMakeLists.txt
index 276097f..3c7ee2a 100644
--- a/CAN-binder/low-can-binding/CMakeLists.txt
+++ b/CAN-binder/low-can-binding/CMakeLists.txt
@@ -24,8 +24,8 @@ PROJECT_TARGET_ADD(low-can)
add_library(${TARGET_NAME} MODULE
binding/${TARGET_NAME}-hat.cpp
binding/${TARGET_NAME}-cb.cpp
- binding/configuration.cpp
- binding/configuration-generated.cpp
+ binding/application.cpp
+ binding/application-generated.cpp
can/can-bus.cpp
can/can-message-set.cpp
can/can-message-definition.cpp
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__);
diff --git a/CAN-binder/low-can-binding/can/can-bus.cpp b/CAN-binder/low-can-binding/can/can-bus.cpp
index c296805..a35eecd 100644
--- a/CAN-binder/low-can-binding/can/can-bus.cpp
+++ b/CAN-binder/low-can-binding/can/can-bus.cpp
@@ -29,7 +29,7 @@
#include "can-signals.hpp"
#include "can-decoder.hpp"
-#include "../binding/configuration.hpp"
+#include "../binding/application.hpp"
#include "../utils/signals.hpp"
#include "../utils/openxc-utils.hpp"
@@ -61,7 +61,7 @@ int can_bus_t::process_can_signals(const can_message_t& can_message)
struct utils::signals_found signals;
openxc_DynamicField search_key, decoded_message;
openxc_VehicleMessage vehicle_message;
- configuration_t& conf = configuration_t::instance();
+ application_t& conf = application_t::instance();
utils::signals_manager_t& sm = utils::signals_manager_t::instance();
// First we have to found which can_signal_t it is
diff --git a/CAN-binder/low-can-binding/can/can-message-definition.cpp b/CAN-binder/low-can-binding/can/can-message-definition.cpp
index e0f55a6..28d45fe 100644
--- a/CAN-binder/low-can-binding/can/can-message-definition.cpp
+++ b/CAN-binder/low-can-binding/can/can-message-definition.cpp
@@ -17,7 +17,7 @@
#include "can-message-definition.hpp"
-#include "../binding/configuration.hpp"
+#include "../binding/application.hpp"
can_message_definition_t::can_message_definition_t(const std::string bus)
: parent_{nullptr}, bus_{bus}, last_value_{CAN_MESSAGE_SIZE}
@@ -75,7 +75,7 @@ const std::string can_message_definition_t::get_bus_name() const
const std::string can_message_definition_t::get_bus_device_name() const
{
- return configuration_t::instance().get_can_bus_manager()
+ return application_t::instance().get_can_bus_manager()
.get_can_device_name(bus_);
}
diff --git a/CAN-binder/low-can-binding/can/can-signals.cpp b/CAN-binder/low-can-binding/can/can-signals.cpp
index e49c727..324cecc 100644
--- a/CAN-binder/low-can-binding/can/can-signals.cpp
+++ b/CAN-binder/low-can-binding/can/can-signals.cpp
@@ -19,7 +19,7 @@
#include "can-signals.hpp"
-#include "../binding/configuration.hpp"
+#include "../binding/application.hpp"
#include "../utils/signals.hpp"
#include "can-decoder.hpp"
#include "can-message.hpp"
diff --git a/CAN-binder/low-can-binding/diagnostic/active-diagnostic-request.cpp b/CAN-binder/low-can-binding/diagnostic/active-diagnostic-request.cpp
index 28bf816..61775b8 100644
--- a/CAN-binder/low-can-binding/diagnostic/active-diagnostic-request.cpp
+++ b/CAN-binder/low-can-binding/diagnostic/active-diagnostic-request.cpp
@@ -20,7 +20,7 @@
#include "active-diagnostic-request.hpp"
-#include "../binding/configuration.hpp"
+#include "../binding/application.hpp"
#define ERROR_PID 0xFF
diff --git a/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp b/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp
index 31a3d23..e7931d9 100644
--- a/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp
+++ b/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp
@@ -23,7 +23,7 @@
#include "../utils/openxc-utils.hpp"
#include "../utils/signals.hpp"
-#include "../binding/configuration.hpp"
+#include "../binding/application.hpp"
#define MAX_RECURRING_DIAGNOSTIC_FREQUENCY_HZ 10
#define MAX_SIMULTANEOUS_DIAG_REQUESTS 50
@@ -46,7 +46,7 @@ diagnostic_manager_t::diagnostic_manager_t()
bool diagnostic_manager_t::initialize()
{
// Mandatory to set the bus before intialize shims.
- bus_ = configuration_t::instance().get_diagnostic_bus();
+ bus_ = application_t::instance().get_diagnostic_bus();
init_diagnostic_shims();
event_source_ = nullptr;
@@ -135,7 +135,7 @@ int diagnostic_manager_t::add_rx_filter(uint32_t can_id)
/// @return true if the CAN message was sent successfully.
bool diagnostic_manager_t::shims_send(const uint32_t arbitration_id, const uint8_t* data, const uint8_t size)
{
- diagnostic_manager_t& dm = configuration_t::instance().get_diagnostic_manager();
+ diagnostic_manager_t& dm = application_t::instance().get_diagnostic_manager();
active_diagnostic_request_t* current_adr = dm.get_last_recurring_requests();
utils::socketcan_bcm_t& tx_socket = current_adr->get_socket();
@@ -199,7 +199,7 @@ const std::string diagnostic_manager_t::get_bus_name() const
const std::string diagnostic_manager_t::get_bus_device_name() const
{
- return configuration_t::instance().get_can_bus_manager()
+ return application_t::instance().get_can_bus_manager()
.get_can_device_name(bus_);
}
diff --git a/CAN-binder/low-can-binding/diagnostic/diagnostic-message.cpp b/CAN-binder/low-can-binding/diagnostic/diagnostic-message.cpp
index df093b0..dd39f88 100644
--- a/CAN-binder/low-can-binding/diagnostic/diagnostic-message.cpp
+++ b/CAN-binder/low-can-binding/diagnostic/diagnostic-message.cpp
@@ -18,7 +18,7 @@
#include "diagnostic-message.hpp"
-#include "../binding/configuration.hpp"
+#include "../binding/application.hpp"
#include "../utils/signals.hpp"
const char *UNIT_NAMES[10] = {
diff --git a/CAN-binder/low-can-binding/utils/openxc-utils.cpp b/CAN-binder/low-can-binding/utils/openxc-utils.cpp
index 5f06504..adbadc6 100644
--- a/CAN-binder/low-can-binding/utils/openxc-utils.cpp
+++ b/CAN-binder/low-can-binding/utils/openxc-utils.cpp
@@ -18,7 +18,7 @@
#include "openxc-utils.hpp"
-#include "../binding/configuration.hpp"
+#include "../binding/application.hpp"
///
/// @brief Build a specific VehicleMessage containing a DiagnosticResponse.
@@ -34,7 +34,7 @@
openxc_VehicleMessage build_VehicleMessage(active_diagnostic_request_t* request, const DiagnosticResponse& response, float parsed_value)
{
openxc_VehicleMessage message;
- configuration_t& conf = configuration_t::instance();
+ application_t& conf = application_t::instance();
message.has_type = true;
message.type = openxc_VehicleMessage_Type::openxc_VehicleMessage_Type_DIAGNOSTIC;
diff --git a/CAN-binder/low-can-binding/utils/signals.cpp b/CAN-binder/low-can-binding/utils/signals.cpp
index 261f572..9dd3bfd 100644
--- a/CAN-binder/low-can-binding/utils/signals.cpp
+++ b/CAN-binder/low-can-binding/utils/signals.cpp
@@ -60,12 +60,12 @@ namespace utils
switch(key.type)
{
case openxc_DynamicField_Type::openxc_DynamicField_Type_STRING:
- lookup_signals_by_name(key.string_value, configuration_t::instance().get_all_can_signals(), sf.can_signals);
- lookup_signals_by_name(key.string_value, configuration_t::instance().get_diagnostic_messages(), sf.diagnostic_messages);
+ lookup_signals_by_name(key.string_value, application_t::instance().get_all_can_signals(), sf.can_signals);
+ lookup_signals_by_name(key.string_value, application_t::instance().get_diagnostic_messages(), sf.diagnostic_messages);
break;
case openxc_DynamicField_Type::openxc_DynamicField_Type_NUM:
- lookup_signals_by_id(key.numeric_value, configuration_t::instance().get_all_can_signals(), sf.can_signals);
- lookup_signals_by_id(key.numeric_value, configuration_t::instance().get_diagnostic_messages(), sf.diagnostic_messages);
+ lookup_signals_by_id(key.numeric_value, application_t::instance().get_all_can_signals(), sf.can_signals);
+ lookup_signals_by_id(key.numeric_value, application_t::instance().get_diagnostic_messages(), sf.diagnostic_messages);
break;
default:
ERROR(binder_interface, "%s: wrong openxc_DynamicField specified. Use openxc_DynamicField_Type_NUM or openxc_DynamicField_Type_STRING type only.", __FUNCTION__);
diff --git a/CAN-binder/low-can-binding/utils/signals.hpp b/CAN-binder/low-can-binding/utils/signals.hpp
index 358ddbe..a0fa99d 100644
--- a/CAN-binder/low-can-binding/utils/signals.hpp
+++ b/CAN-binder/low-can-binding/utils/signals.hpp
@@ -22,7 +22,7 @@
#include <fnmatch.h>
#include "openxc.pb.h"
-#include "../binding/configuration.hpp"
+#include "../binding/application.hpp"
#include "../can/can-signals.hpp"
#include "../diagnostic/diagnostic-message.hpp"
@@ -71,7 +71,7 @@ namespace utils
{
for(std::shared_ptr<T> s : signals)
{
- if(configuration_t::instance().get_signal_id(*s) == key)
+ if(application_t::instance().get_signal_id(*s) == key)
{
found_signals.push_back(s);
}