summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-03-03 15:12:17 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-03-03 15:12:17 +0100
commit217690559c27646c7e412aaeacfa2064a9e7e6e4 (patch)
tree9eb275e2442a542940e4b73218916369699db626 /src
parent2e8e455644720437d32b0377a7a1697d96655727 (diff)
change all genericName to generic_name. Now all
objects use the same variable name Change-Id: I8a232bc8fd7e580bd8088e6b2ae7a90666ef9c62 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src')
-rw-r--r--src/can-bus.cpp12
-rw-r--r--src/can-command.hpp2
-rw-r--r--src/can-signals.cpp6
-rw-r--r--src/can-signals.hpp2
-rw-r--r--src/low-can-binding.cpp12
-rw-r--r--src/obd2.hpp43
6 files changed, 38 insertions, 39 deletions
diff --git a/src/can-bus.cpp b/src/can-bus.cpp
index f35319a9..652a4bc5 100644
--- a/src/can-bus.cpp
+++ b/src/can-bus.cpp
@@ -77,15 +77,15 @@ void can_bus_t::can_decode_message()
std::map<std::string, struct afb_event>& s = get_subscribed_signals();
/* DEBUG message to make easier debugger STL containers...
- DEBUG(binder_interface, "Operator[] key char: %s, event valid? %d", sig.genericName, afb_event_is_valid(s[sig.genericName]));
- DEBUG(binder_interface, "Operator[] key string: %s, event valid? %d", sig.genericName, afb_event_is_valid(s[std::string(sig.genericName)]));
- DEBUG(binder_interface, "Nb elt matched char: %d", (int)s.count(sig.genericName));
- DEBUG(binder_interface, "Nb elt matched string: %d", (int)s.count(std::string(sig.genericName))); */
- if( s.find(sig.genericName) != s.end() && afb_event_is_valid(s[sig.genericName]))
+ DEBUG(binder_interface, "Operator[] key char: %s, event valid? %d", sig.generic_name, afb_event_is_valid(s[sig.generic_name]));
+ DEBUG(binder_interface, "Operator[] key string: %s, event valid? %d", sig.generic_name, afb_event_is_valid(s[std::string(sig.generic_name)]));
+ DEBUG(binder_interface, "Nb elt matched char: %d", (int)s.count(sig.generic_name));
+ DEBUG(binder_interface, "Nb elt matched string: %d", (int)s.count(std::string(sig.generic_name))); */
+ if( s.find(sig.generic_name) != s.end() && afb_event_is_valid(s[sig.generic_name]))
{
decoded_message = decoder.translateSignal(sig, can_message, getSignals());
- openxc_SimpleMessage s_message = build_SimpleMessage(sig.genericName, decoded_message);
+ openxc_SimpleMessage s_message = build_SimpleMessage(sig.generic_name, decoded_message);
vehicle_message = build_VehicleMessage_with_SimpleMessage(openxc_DynamicField_Type::openxc_DynamicField_Type_NUM, s_message);
std::lock_guard<std::mutex> decoded_can_message_lock(decoded_can_message_mutex_);
diff --git a/src/can-command.hpp b/src/can-command.hpp
index ee9ea375..62b56c1e 100644
--- a/src/can-command.hpp
+++ b/src/can-command.hpp
@@ -49,7 +49,7 @@ typedef void (*CommandHandler)(const char* name, openxc_DynamicField* value,
* or signals from a signal OpenXC message.
*/
typedef struct {
- const char* genericName; /*!< genericName - The name of the command.*/
+ const char* generic_name; /*!< generic_name - The name of the command.*/
CommandHandler handler; /*!< handler - An function to process the received command's data and perform some
* action.*/
} CanCommand;
diff --git a/src/can-signals.cpp b/src/can-signals.cpp
index 5683862e..c9d9fac0 100644
--- a/src/can-signals.cpp
+++ b/src/can-signals.cpp
@@ -90,10 +90,10 @@ std::vector<CanSignal> find_can_signals(const openxc_DynamicField &key)
case openxc_DynamicField_Type::openxc_DynamicField_Type_STRING:
for(const CanSignal& s : active_signals)
{
- //DEBUG(binder_interface, "Processing signal: %s", s.genericName);
- if(::fnmatch(key.string_value, s.genericName, FNM_CASEFOLD) == 0)
+ //DEBUG(binder_interface, "Processing signal: %s", s.generic_name);
+ if(::fnmatch(key.string_value, s.generic_name, FNM_CASEFOLD) == 0)
{
- //DEBUG(binder_interface, "Matched signal: %s", s.genericName);
+ //DEBUG(binder_interface, "Matched signal: %s", s.generic_name);
found_signals.push_back(s);
}
}
diff --git a/src/can-signals.hpp b/src/can-signals.hpp
index a95b3a3a..2443e63d 100644
--- a/src/can-signals.hpp
+++ b/src/can-signals.hpp
@@ -99,7 +99,7 @@ typedef struct CanSignalState CanSignalState;
*/
struct CanSignal {
struct CanMessageDefinition* message; /*!< message - The message this signal is a part of. */
- const char* genericName; /*!< genericName - The name of the signal to be output over USB.*/
+ const char* generic_name; /*!< generic_name - The name of the signal to be output over USB.*/
uint8_t bitPosition; /*!< bitPosition - The starting bit of the signal in its CAN message (assuming
* non-inverted bit numbering, i.e. the most significant bit of
* each byte is 0) */
diff --git a/src/low-can-binding.cpp b/src/low-can-binding.cpp
index 420ad961..11a310b2 100644
--- a/src/low-can-binding.cpp
+++ b/src/low-can-binding.cpp
@@ -81,7 +81,7 @@ static int subscribe_unsubscribe_signal(struct afb_req request, bool subscribe,
std::lock_guard<std::mutex> subscribed_signals_lock(get_subscribed_signals_mutex());
std::map<std::string, struct afb_event>& s = get_subscribed_signals();
- if (s.find(sig.genericName) != s.end() && !afb_event_is_valid(s[std::string(sig.genericName)]))
+ if (s.find(sig.generic_name) != s.end() && !afb_event_is_valid(s[std::string(sig.generic_name)]))
{
if(!subscribe)
{
@@ -90,14 +90,14 @@ static int subscribe_unsubscribe_signal(struct afb_req request, bool subscribe,
}
else
/* Event it isn't valid annymore, recreate it */
- ret = create_event_handle(sig.genericName, s);
+ ret = create_event_handle(sig.generic_name, s);
}
else
{
/* Event don't exist , so let's create it */
struct afb_event empty_event = {nullptr, nullptr};
- subscribed_signals[sig.genericName] = empty_event;
- ret = create_event_handle(sig.genericName, s);
+ subscribed_signals[sig.generic_name] = empty_event;
+ ret = create_event_handle(sig.generic_name, s);
}
/* Check whether or not the event handler has been correctly created and
@@ -105,7 +105,7 @@ static int subscribe_unsubscribe_signal(struct afb_req request, bool subscribe,
*/
if (ret <= 0)
return ret;
- return make_subscription_unsubscription(request, sig.genericName, s, subscribe);
+ return make_subscription_unsubscription(request, sig.generic_name, s, subscribe);
}
/**
@@ -128,7 +128,7 @@ static int subscribe_unsubscribe_signals(struct afb_req request, bool subscribe,
if(ret <= 0)
return ret;
rets++;
- DEBUG(binder_interface, "Signal: %s subscribed", signal_i.genericName);
+ DEBUG(binder_interface, "Signal: %s subscribed", signal_i.generic_name);
}
return rets;
}
diff --git a/src/obd2.hpp b/src/obd2.hpp
index 54098e37..05387456 100644
--- a/src/obd2.hpp
+++ b/src/obd2.hpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
- #pragma once
+#pragma once
#include <vector>
#include "uds/uds.h"
@@ -67,38 +67,37 @@ const char *UNIT_NAMES[10] = {
*/
typedef struct _Obd2Pid {
uint8_t pid;
- const char* name;
+ const char* generic_name;
const int min;
const int max;
enum UNIT unit;
int frequency;
bool supported;
- struct afb_event event;
} Obd2Pid;
/*
* Pre-defined OBD-II PIDs to query for if supported by the vehicle.
*/
const std::vector<Obd2Pid> OBD2_PIDS {
- { pid: 0x04, name: "obd2.engine.load", min:0, max: 100, unit: POURCENT, frequency: 5, supported: false, event: {nullptr, nullptr} },
- { pid: 0x05, name: "obd2.engine.coolant.temperature", min: -40, max: 215, unit: DEGREES_CELSIUS, frequency: 1, supported: false, event: {nullptr, nullptr} },
- { pid: 0x0a, name: "obd2.fuel.pressure", min: 0, max: 765, unit: KPA, frequency: 1, supported: false, event: {nullptr, nullptr} },
- { pid: 0x0b, name: "obd2.intake.manifold.pressure", min: 0, max: 255, unit: KPA, frequency: 1, supported: false, event: {nullptr, nullptr} },
- { pid: 0x0c, name: "obd2.engine.speed", min: 0, max: 16383, unit: RPM, frequency: 5, supported: false, event: {nullptr, nullptr} },
- { pid: 0x0d, name: "obd2.vehicle.speed", min: 0, max: 255, unit: KM_H, frequency: 5, supported: false, event: {nullptr, nullptr} },
- { pid: 0x0f, name: "obd2.intake.air.temperature", min: -40, max:215, unit: DEGREES_CELSIUS, frequency: 1, supported: false, event: {nullptr, nullptr} },
- { pid: 0x10, name: "obd2.mass.airflow", min: 0, max: 655, unit: GRAMS_SEC, frequency: 5, supported: false, event: {nullptr, nullptr} },
- { pid: 0x11, name: "obd2.throttle.position", min: 0, max: 100, unit: POURCENT, frequency: 5, supported: false, event: {nullptr, nullptr} },
- { pid: 0x1f, name: "obd2.running.time", min: 0, max: 65535, unit: SECONDS, frequency: 1, supported: false, event: {nullptr, nullptr} },
- { pid: 0x2d, name: "obd2.EGR.error", min: -100, max: 99, unit: POURCENT, frequency: 0, supported: false, event: {nullptr, nullptr} },
- { pid: 0x2f, name: "obd2.fuel.level", min: 0, max: 100, unit: POURCENT, frequency: 1, supported: false, event: {nullptr, nullptr} },
- { pid: 0x33, name: "obd2.barometric.pressure", min: 0, max: 255, unit: KPA, frequency: 1, supported: false, event: {nullptr, nullptr} },
- { pid: 0x4c, name: "obd2.commanded.throttle.position", min: 0, max: 100, unit: POURCENT, frequency: 1, supported: false, event: {nullptr, nullptr} },
- { pid: 0x52, name: "obd2.ethanol.fuel.percentage", min: 0, max: 100, unit: POURCENT, frequency: 1, supported: false, event: {nullptr, nullptr} },
- { pid: 0x5a, name: "obd2.accelerator.pedal.position", min: 0, max: 100, unit: POURCENT, frequency: 5, supported: false, event: {nullptr, nullptr} },
- { pid: 0x5b, name: "obd2.hybrid.battery-pack.remaining.life", min: 0, max: 100, unit: POURCENT, frequency: 5, supported: false, event: {nullptr, nullptr} },
- { pid: 0x5c, name: "obd2.engine.oil.temperature",min: -40, max: 210, unit: DEGREES_CELSIUS, frequency: 1, supported: false, event: {nullptr, nullptr} },
- { pid: 0x63, name: "obd2.engine.torque", min: 0, max: 65535, unit: NM, frequency: 1, supported: false, event: {nullptr, nullptr} }
+ { pid: 0x04, name: "obd2.engine.load", min:0, max: 100, unit: POURCENT, frequency: 5, supported: false},
+ { pid: 0x05, name: "obd2.engine.coolant.temperature", min: -40, max: 215, unit: DEGREES_CELSIUS, frequency: 1, supported: false},
+ { pid: 0x0a, name: "obd2.fuel.pressure", min: 0, max: 765, unit: KPA, frequency: 1, supported: false},
+ { pid: 0x0b, name: "obd2.intake.manifold.pressure", min: 0, max: 255, unit: KPA, frequency: 1, supported: false},
+ { pid: 0x0c, name: "obd2.engine.speed", min: 0, max: 16383, unit: RPM, frequency: 5, supported: false},
+ { pid: 0x0d, name: "obd2.vehicle.speed", min: 0, max: 255, unit: KM_H, frequency: 5, supported: false},
+ { pid: 0x0f, name: "obd2.intake.air.temperature", min: -40, max:215, unit: DEGREES_CELSIUS, frequency: 1, supported: false},
+ { pid: 0x10, name: "obd2.mass.airflow", min: 0, max: 655, unit: GRAMS_SEC, frequency: 5, supported: false},
+ { pid: 0x11, name: "obd2.throttle.position", min: 0, max: 100, unit: POURCENT, frequency: 5, supported: false},
+ { pid: 0x1f, name: "obd2.running.time", min: 0, max: 65535, unit: SECONDS, frequency: 1, supported: false},
+ { pid: 0x2d, name: "obd2.EGR.error", min: -100, max: 99, unit: POURCENT, frequency: 0, supported: false},
+ { pid: 0x2f, name: "obd2.fuel.level", min: 0, max: 100, unit: POURCENT, frequency: 1, supported: false},
+ { pid: 0x33, name: "obd2.barometric.pressure", min: 0, max: 255, unit: KPA, frequency: 1, supported: false},
+ { pid: 0x4c, name: "obd2.commanded.throttle.position", min: 0, max: 100, unit: POURCENT, frequency: 1, supported: false},
+ { pid: 0x52, name: "obd2.ethanol.fuel.percentage", min: 0, max: 100, unit: POURCENT, frequency: 1, supported: false},
+ { pid: 0x5a, name: "obd2.accelerator.pedal.position", min: 0, max: 100, unit: POURCENT, frequency: 5, supported: false},
+ { pid: 0x5b, name: "obd2.hybrid.battery-pack.remaining.life", min: 0, max: 100, unit: POURCENT, frequency: 5, supported: false},
+ { pid: 0x5c, name: "obd2.engine.oil.temperature",min: -40, max: 210, unit: DEGREES_CELSIUS, frequency: 1, supported: false},
+ { pid: 0x63, name: "obd2.engine.torque", min: 0, max: 65535, unit: NM, frequency: 1, supported: false}
};
/**