decoder_t::booleanDecoder,
nullptr,
false
- })}
- }
- })}
- }}
- }
- , diagnostic_messages_
- {
+ })} // end can_signals entry
+ } // end can_signals vector
+ })} // end can_message_definition entry
+ }, // end can_message_definition vector
{
{std::make_shared<diagnostic_message_t>(diagnostic_message_t{
4,
nullptr,
true
})}
- }
- }
+ } // end diagnostic_messages_ vector
+ }// end can_message_set entry
+ } // end can_message_set vector
{}
const std::string configuration_t::get_diagnostic_bus() const
std::vector<std::shared_ptr<diagnostic_message_t> > configuration_t::get_diagnostic_messages()
{
- return diagnostic_messages_[active_message_set_];
+ 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<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
+ //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.
return i;
}
-const std::string can_bus_t::get_can_device_name(std::string id_name) const
+std::string can_bus_t::get_can_device_name(std::string id_name) const
{
std::string ret;
for(const auto& d: can_devices_)
#include "openxc.pb.h"
#include "can-message.hpp"
-#include "can-signals.hpp"
#include "../utils/config-parser.hpp"
-#include "../diagnostic/diagnostic-manager.hpp"
#include "../binding/low-can-hat.hpp"
// TODO actual max is 32 but dropped to 24 for memory considerations
#define CAN_ACTIVE_TIMEOUT_S 30
+class diagnostic_manager_t;
+
/// @brief Object used to handle decoding and manage event queue to be pushed.
///
/// This object is also used to initialize can_bus_dev_t object after reading
void set_can_devices();
int get_can_device_index(std::string bus_name) const;
- const std::string get_can_device_name(std::string id_name) const;
+ std::string get_can_device_name(std::string id_name) const;
void start_threads();
void stop_threads();
#include "can-signals.hpp"
#include "can-message.hpp"
+#include "can-message-set.hpp"
#include "../utils/timer.hpp"
class can_message_set_t;
#include "can-message-set.hpp"
+#include "../can/can-message-definition.hpp"
+
can_message_set_t::can_message_set_t(
uint8_t index,
const std::string& name,
- std::vector<std::shared_ptr<can_message_definition_t> > can_messages_definition)
+ std::vector<std::shared_ptr<can_message_definition_t> > can_messages_definition,
+ std::vector<std::shared_ptr<diagnostic_message_t> > diagnostic_messages)
: index_{index}
, name_{name}
, can_messages_definition_{can_messages_definition}
+ , diagnostic_messages_{diagnostic_messages}
{
for(auto& cmd : can_messages_definition_)
{
cmd->set_parent(this);
}
+
+ for(auto& dm : diagnostic_messages_)
+ {
+ dm->set_parent(this);
+ }
}
/// @brief Return vector holding all message definition handled by this message set.
}
return can_signals;
+}
+
+std::vector<std::shared_ptr<diagnostic_message_t> > can_message_set_t::get_diagnostic_messages()
+{
+ return diagnostic_messages_;
}
\ No newline at end of file
#include <vector>
#include <memory>
-#include "can-message-definition.hpp"
-
class can_signal_t;
+class can_message_definition_t;
+class diagnostic_message_t;
/// @brief A parent wrapper for a particular set of CAN messages and associated
/// CAN buses(e.g. a vehicle or program).
uint8_t index_; /// < A numerical ID for the message set, ideally the index in an array for fast lookup
const std::string name_; /// < The name of the message set.
std::vector<std::shared_ptr<can_message_definition_t> > can_messages_definition_; ///< Vector holding all message definition handled by this message set.
+ std::vector<std::shared_ptr<diagnostic_message_t> > diagnostic_messages_; ///< Vector holding all diagnostics messages from JSON signals description file. First vector map to message set
public:
can_message_set_t(
uint8_t index,
const std::string& name,
- std::vector<std::shared_ptr<can_message_definition_t> > can_messages_definition);
+ std::vector<std::shared_ptr<can_message_definition_t> > can_messages_definition,
+ std::vector<std::shared_ptr<diagnostic_message_t> > diagnostic_messages);
std::vector<std::shared_ptr<can_message_definition_t> > get_can_message_definition();
std::vector<std::shared_ptr<can_signal_t> > get_can_signals() const;
+ std::vector<std::shared_ptr<diagnostic_message_t> > get_diagnostic_messages();
};
#include <memory>
#include "openxc.pb.h"
+#include "can-message-definition.hpp"
#include "../utils/timer.hpp"
#include "../utils/socketcan-bcm.hpp"
#include "can-message.hpp"
#define MESSAGE_SET_ID 0
class can_signal_t;
-class can_message_definition_t;
///
/// @brief The type signature for a CAN signal decoder.
///
supported_ = value;
}
+void diagnostic_message_t::set_parent(can_message_set_t* parent)
+{
+ parent_ = parent;
+}
+
///
/// @brief Build a DiagnosticRequest struct to be passed
/// to diagnostic manager instance.
#include <string>
#include "uds/uds.h"
+#include "../can/can-message-set.hpp"
#include "../can/can-message.hpp"
#include "active-diagnostic-request.hpp"
INVALID
};
+class can_message_set_t;
+
///
/// @brief - A representation of an OBD-II PID.
///
class diagnostic_message_t
{
private:
+ can_message_set_t* parent_; /*!< parent_ - Pointer to the CAN message set holding this diagnostic message */
uint8_t pid_; /*!< pid_ - The 1 byte PID.*/
std::string generic_name_; /*!< generic_name_ - A human readable name to use for this PID when published.*/
int min_; /*!< min_ - Minimum value that can take this pid */
bool get_supported() const;
void set_supported(bool value);
-
+ void set_parent(can_message_set_t* parent);
const DiagnosticRequest build_diagnostic_request();
bool is_obd2_response(const can_message_t& can_message);