* limitations under the License.
*/
-#include "obd2-signals.hpp"
+#include "obd2/obd2-signals.hpp"
-#include "signals.hpp"
+#include "utils/signals.hpp"
+
+#define OBD2_FUNCTIONAL_BROADCAST_ID 0x7df
const char *UNIT_NAMES[10] = {
"POURCENT",
{ 0x63, "obd2.engine.torque", 0, 65535, NM, 1, false}
};
-obd2_signals_t::obd2_signals_t(uint8_t pid, const char* generic_name, const int min, const int max, enum UNIT unit, int frequency, bool supported)
- : pid_{pid}, generic_name_{generic_name}, min_{min}, max_{max}, unit_{unit}, frequency_{frequency}, supported_{supported}
+uint32_t get_signal_id(obd2_signals_t& sig)
{
+ return sig.get_pid();
}
-void obd2_signals_t::init_diagnostic_shims(can_bus_dev_t& can_bus_dev)
+std::vector<obd2_signals_t>& get_obd2_signals()
{
- DiagnosticShims shims_ = diagnostic_init_shims(shims_logger, can_bus_dev.send_can_message, NULL);
+ return OBD2_PIDS;
+}
- int n_pids_, i_;
+obd2_signals_t::obd2_signals_t(uint8_t pid, const char* generic_name, const int min, const int max, enum UNIT unit, int frequency, bool supported)
+ : pid_{pid}, generic_name_{generic_name}, min_{min}, max_{max}, unit_{unit}, frequency_{frequency}, supported_{supported}
+{
+}
- n_pids_ = size(Obd2Pid);
- for(i_=0; i_<=n_pids_; i_++)
- {
- }
+uint32_t obd2_signals_t::get_pid()
+{
+ return (uint32_t)pid_;
}
/**
*
* @return std::vector<std::string> Vector of signals name found.
*/
-void obd2_signals_t::find_obd2_signals(const openxc_DynamicField &key, std::vector<Obd2Pid*>& found_signals)
+void obd2_signals_t::find_obd2_signals(const openxc_DynamicField &key, std::vector<obd2_signals_t*>& found_signals)
{
switch(key.type)
{
DEBUG(binder_interface, "Found %d signal(s)", (int)found_signals.size());
}
-std::vector<Obd2Pid>& get_obd2_signals()
-{
- return OBD2_PIDS;
-}
-
-uint32_t get_signal_id(const Obd2Pid& sig)
-{
- return (uint32_t)sig.pid;
-}
-
-void shims_logger(const char* m, const struct afb_binding_interface *interface)
-{
- DEBUG(interface, "%s", m);
-}
-
-void shims_timer()
-{
-}
-
bool obd2_signals_t::is_obd2_response(can_message_t can_message)
{
+ /*
if(can_message.get_id() >= 0x7E8 && can_message.get_id() <= 0x7EF)
{
openxc_VehicleMessage message = {0};
{
debug("Sent message ID is outside the valid range for emulator (7DF to 7E7)");
status=false;
-};
+ }
+ return false;
+ */
+}
void obd2_signals_t::add_request(int pid)
{
DiagnosticRequest request = {
arbitration_id: OBD2_FUNCTIONAL_BROADCAST_ID,
- mode: 0x1, has_true, pid};
+ mode: 0x1, has_pid: true, pid_ };
}
/**