summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/can/can-bus.cpp4
-rw-r--r--src/can/can-command.hpp2
-rw-r--r--src/can/can-decoder.cpp40
-rw-r--r--src/can/can-message.hpp8
-rw-r--r--src/can/can-signals.cpp4
-rw-r--r--src/can/can-signals.hpp7
-rw-r--r--src/configuration-generated.cpp4
-rw-r--r--src/low-can-binding.cpp4
-rw-r--r--src/utils/signals.cpp2
9 files changed, 38 insertions, 37 deletions
diff --git a/src/can/can-bus.cpp b/src/can/can-bus.cpp
index 7721132..4416452 100644
--- a/src/can/can-bus.cpp
+++ b/src/can/can-bus.cpp
@@ -66,7 +66,7 @@ can_bus_t::can_bus_t(int conf_file)
void can_bus_t::can_decode_message()
{
can_message_t can_message;
- std::vector <CanSignal*> signals;
+ std::vector <can_signal_t*> signals;
openxc_VehicleMessage vehicle_message;
openxc_DynamicField search_key, decoded_message;
@@ -78,7 +78,7 @@ void can_bus_t::can_decode_message()
new_can_message_cv_.wait(can_message_lock);
can_message = next_can_message();
- /* First we have to found which CanSignal it is */
+ /* First we have to found which can_signal_t it is */
search_key = build_DynamicField((double)can_message.get_id());
signals.clear();
find_can_signals(search_key, signals);
diff --git a/src/can/can-command.hpp b/src/can/can-command.hpp
index a11c2b9..062cbd7 100644
--- a/src/can/can-command.hpp
+++ b/src/can/can-command.hpp
@@ -32,7 +32,7 @@
* @param[in] signalCount - The length of the signals array.
*/
typedef void (*CommandHandler)(const char* name, openxc_DynamicField* value,
- openxc_DynamicField* event, CanSignal* signals, int signalCount);
+ openxc_DynamicField* event, can_signal_t* signals, int signalCount);
/* @struct CanCommand
* @brief The structure to represent a supported custom OpenXC command.
diff --git a/src/can/can-decoder.cpp b/src/can/can-decoder.cpp
index 0347139..9059f97 100644
--- a/src/can/can-decoder.cpp
+++ b/src/can/can-decoder.cpp
@@ -18,15 +18,15 @@
#include "can-decoder.hpp"
#include "canutil/read.h"
-float decoder_t::parseSignalBitfield(CanSignal& signal, const can_message_t& message)
+float decoder_t::parseSignalBitfield(can_signal_t& signal, const can_message_t& message)
{
return bitfield_parse_float(message.get_data(), CAN_MESSAGE_SIZE,
signal.bitPosition, signal.bitSize, signal.factor,
signal.offset);
}
-openxc_DynamicField decoder_t::noopDecoder(CanSignal& signal,
- const std::vector<CanSignal>& signals, float value, bool* send)
+openxc_DynamicField decoder_t::noopDecoder(can_signal_t& signal,
+ const std::vector<can_signal_t>& signals, float value, bool* send)
{
openxc_DynamicField decoded_value;
decoded_value.has_type = true;
@@ -37,8 +37,8 @@ openxc_DynamicField decoder_t::noopDecoder(CanSignal& signal,
return decoded_value;
}
-openxc_DynamicField decoder_t::booleanDecoder(CanSignal& signal,
- const std::vector<CanSignal>& signals, float value, bool* send)
+openxc_DynamicField decoder_t::booleanDecoder(can_signal_t& signal,
+ const std::vector<can_signal_t>& signals, float value, bool* send)
{
openxc_DynamicField decoded_value;
decoded_value.has_type = true;
@@ -49,8 +49,8 @@ openxc_DynamicField decoder_t::booleanDecoder(CanSignal& signal,
return decoded_value;
}
-openxc_DynamicField decoder_t::ignoreDecoder(CanSignal& signal,
- const std::vector<CanSignal>& signals, float value, bool* send)
+openxc_DynamicField decoder_t::ignoreDecoder(can_signal_t& signal,
+ const std::vector<can_signal_t>& signals, float value, bool* send)
{
if(send)
*send = false;
@@ -60,8 +60,8 @@ openxc_DynamicField decoder_t::ignoreDecoder(CanSignal& signal,
return decoded_value;
}
-openxc_DynamicField decoder_t::stateDecoder(CanSignal& signal,
- const std::vector<CanSignal>& signals, float value, bool* send)
+openxc_DynamicField decoder_t::stateDecoder(can_signal_t& signal,
+ const std::vector<can_signal_t>& signals, float value, bool* send)
{
openxc_DynamicField decoded_value = {0, openxc_DynamicField_Type_BOOL, 0, "", 0, 0, 0, 0};
decoded_value.has_type = true;
@@ -69,7 +69,7 @@ openxc_DynamicField decoder_t::stateDecoder(CanSignal& signal,
decoded_value.has_string_value = true;
/* TODO: Handle SignalState
- const CanSignalState* signalState = lookupSignalState(value, signal);
+ const can_signal_tState* signalState = lookupSignalState(value, signal);
if(signalState != NULL) {
::strcpy(decoded_value.string_value, signalState->name);
} else {
@@ -78,8 +78,8 @@ openxc_DynamicField decoder_t::stateDecoder(CanSignal& signal,
return decoded_value;
}
-openxc_DynamicField decoder_t::translateSignal(CanSignal& signal, can_message_t& message,
- const std::vector<CanSignal>& signals)
+openxc_DynamicField decoder_t::translateSignal(can_signal_t& signal, can_message_t& message,
+ const std::vector<can_signal_t>& signals)
{
if(&signal == nullptr || &message == nullptr)
{
@@ -87,22 +87,22 @@ openxc_DynamicField decoder_t::translateSignal(CanSignal& signal, can_message_t&
return ret;
}
- float value = parseSignalBitfield(signal, message);
+ float value = decoder_t::parseSignalBitfield(signal, message);
DEBUG(binder_interface, "translateSignal: Decoded message: %f", value);
bool send = true;
// Must call the decoders every time, regardless of if we are going to
// decide to send the signal or not.
- openxc_DynamicField decoded_value = decodeSignal(signal,
+ openxc_DynamicField decoded_value = decoder_t::decodeSignal(signal,
value, signals, &send);
- signal.received = true;
- signal.lastValue = value;
+ signal.received_ = true;
+ signal.last_value_ = value;
return decoded_value;
}
-openxc_DynamicField decoder_t::decodeSignal( CanSignal& signal,
- float value, const std::vector<CanSignal>& signals, bool* send)
+openxc_DynamicField decoder_t::decodeSignal( can_signal_t& signal,
+ float value, const std::vector<can_signal_t>& signals, bool* send)
{
SignalDecoder decoder = signal.decoder == NULL ?
noopDecoder : signal.decoder;
@@ -111,8 +111,8 @@ openxc_DynamicField decoder_t::decodeSignal( CanSignal& signal,
return decoded_value;
}
-openxc_DynamicField decoder_t::decodeSignal( CanSignal& signal,
- const can_message_t& message, const std::vector<CanSignal>& signals, bool* send)
+openxc_DynamicField decoder_t::decodeSignal( can_signal_t& signal,
+ const can_message_t& message, const std::vector<can_signal_t>& signals, bool* send)
{
float value = parseSignalBitfield(signal, message);
return decodeSignal(signal, value, signals, send);
diff --git a/src/can/can-message.hpp b/src/can/can-message.hpp
index fc85ed9..0e46cc8 100644
--- a/src/can/can-message.hpp
+++ b/src/can/can-message.hpp
@@ -87,8 +87,8 @@ class can_message_definition_t
uint32_t id_; /*!< id_ - The ID of the message.*/
can_message_format format_; /*!< format_ - the format of the message's ID.*/
FrequencyClock clock_; /*!< clock_ - an optional frequency clock to control the output of this
- * message, if sent raw, or simply to mark the max frequency for custom
- * handlers to retrieve.*/
+ * message, if sent raw, or simply to mark the max frequency for custom
+ * handlers to retrieve.*/
bool force_send_changed_; /*!< force_send_changed_ - If true, regardless of the frequency, it will send CAN
* message if it has changed when using raw passthrough.*/
std::vector<uint8_t> last_value_; /*!< last_value_ - The last received value of the message. Defaults to undefined.
@@ -125,7 +125,7 @@ class can_message_set_t
*
* Returns a pointer to an array of all configurations.
*/
-CanMessageSet* getMessageSets();
+can_message_set_t* getMessageSets();
/** Public: Return the length of the array returned by getMessageSets() */
int getMessageSetCount();
@@ -133,7 +133,7 @@ int getMessageSetCount();
/* Public: Return an array of all CAN messages to be processed in the active
* configuration.
*/
-CanMessageDefinition* getMessages();
+can_message_definition_t* getMessages();
/* Public: Return the length of the array returned by getMessages(). */
int getMessageCount(); \ No newline at end of file
diff --git a/src/can/can-signals.cpp b/src/can/can-signals.cpp
index d369057..af95769 100644
--- a/src/can/can-signals.cpp
+++ b/src/can/can-signals.cpp
@@ -35,7 +35,7 @@ std::string& can_signal_t::get_generic_name() const
}
/**
- * @fn void find_can_signals(const openxc_DynamicField& key, std::vector<CanSignal*>& found_signals)
+ * @fn void find_can_signals(const openxc_DynamicField& key, std::vector<can_signal_t*>& found_signals)
* @brief return signals name found searching through CAN_signals and OBD2 pid
*
* @param[in] key - can contain numeric or string value in order to search against
@@ -43,7 +43,7 @@ std::string& can_signal_t::get_generic_name() const
* @param[out] found_signals - provided vector to fill with ponter to signals matched.
*
*/
-void find_can_signals(const openxc_DynamicField& key, std::vector<CanSignal*>& found_signals)
+void find_can_signals(const openxc_DynamicField& key, std::vector<can_signal_t*>& found_signals)
{
switch(key.type)
{
diff --git a/src/can/can-signals.hpp b/src/can/can-signals.hpp
index 3bfc2b8..e5e0f31 100644
--- a/src/can/can-signals.hpp
+++ b/src/can/can-signals.hpp
@@ -37,6 +37,8 @@ extern "C"
#define MESSAGE_SET_ID 0
+class can_signal_t;
+
/**
* @brief The type signature for a CAN signal decoder.
*
@@ -54,7 +56,7 @@ extern "C"
* @return a decoded value in an openxc_DynamicField struct.
*/
typedef openxc_DynamicField (*SignalDecoder)(can_signal_t& signal,
- const std::vector<CanSignal>& signals, float value, bool* send);
+ const std::vector<can_signal_t>& signals, float value, bool* send);
/**
* @brief: The type signature for a CAN signal encoder.
@@ -70,7 +72,6 @@ typedef openxc_DynamicField (*SignalDecoder)(can_signal_t& signal,
typedef uint64_t (*SignalEncoder)(can_signal_t* signal,
openxc_DynamicField* value, bool* send);
-
class can_signal_t
{
private:
@@ -111,4 +112,4 @@ public:
std::string& get_generic_name() const;
};
-void find_can_signals(const openxc_DynamicField &key, std::vector<CanSignal*>& found_signals);
+void find_can_signals(const openxc_DynamicField &key, std::vector<can_signal_t*>& found_signals);
diff --git a/src/configuration-generated.cpp b/src/configuration-generated.cpp
index e2939f9..6b14adc 100644
--- a/src/configuration-generated.cpp
+++ b/src/configuration-generated.cpp
@@ -21,8 +21,8 @@ std::vector<std::vector<can_message_definition_t>> CAN_MESSAGES_DEFINTION = {
};
/**
- * @brief Dumb SIGNALS array. It is composed by CanMessageSet
- * SIGNALS[MESSAGE_SET_ID][CanSignal]
+ * @brief Dumb SIGNALS array. It is composed by can_message_set_t
+ * SIGNALS[MESSAGE_SET_ID][can_signal_t]
*/
std::vector<std::vector<can_signal_t>> SIGNALS = {
{
diff --git a/src/low-can-binding.cpp b/src/low-can-binding.cpp
index 46dcbf2..9357490 100644
--- a/src/low-can-binding.cpp
+++ b/src/low-can-binding.cpp
@@ -109,12 +109,12 @@ static int subscribe_unsubscribe_signal(struct afb_req request, bool subscribe,
}
/**
- * @fn static int subscribe_unsubscribe_signals(struct afb_req request, bool subscribe, const std::vector<CanSignal>& signals)
+ * @fn static int subscribe_unsubscribe_signals(struct afb_req request, bool subscribe, const std::vector<can_signal_t>& signals)
* @brief subscribe to all signals in the vector signals
*
* @param[in] afb_req request : contain original request use to subscribe or unsubscribe
* @param[in] subscribe boolean value used to chose between a subscription operation or an unsubscription
- * @param[in] CanSignal vector with CanSignal to subscribe
+ * @param[in] can_signal_t vector with can_signal_t to subscribe
*
* @return Number of correctly subscribed signal
*/
diff --git a/src/utils/signals.cpp b/src/utils/signals.cpp
index a7510dc..9da04f5 100644
--- a/src/utils/signals.cpp
+++ b/src/utils/signals.cpp
@@ -21,7 +21,7 @@
* @brief Can signal event map making access to afb_event
* externaly to an openxc existing structure.
*
- * @desc Event map is making relation between CanSignal generic name
+ * @desc Event map is making relation between can_signal_t generic name
* and the afb_event struct used by application framework to pushed
* to the subscriber.
*/