summaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding/can/can-signals.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-05-10 18:39:25 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-05-10 18:45:56 +0200
commitd253ada94487232ccd33b68a69fd44ff7840fab7 (patch)
tree67f5959138d0ddcad413f9ee692d087200e0b4df /CAN-binder/low-can-binding/can/can-signals.cpp
parent3e2be4237ac6f3e8bcec8b10d295182cefe67330 (diff)
Use a tree instead of separated object lists. WIP
Now we respect JSON description file, which is can_message_set contains can_message_definition which contains can_signals. Diagnostic messages aren't processed for now. Change-Id: I94aaf5eded14dd84395bd4fd749df58dee5f533e Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/low-can-binding/can/can-signals.cpp')
-rw-r--r--CAN-binder/low-can-binding/can/can-signals.cpp37
1 files changed, 30 insertions, 7 deletions
diff --git a/CAN-binder/low-can-binding/can/can-signals.cpp b/CAN-binder/low-can-binding/can/can-signals.cpp
index 7726bfc1..96d0b707 100644
--- a/CAN-binder/low-can-binding/can/can-signals.cpp
+++ b/CAN-binder/low-can-binding/can/can-signals.cpp
@@ -29,8 +29,7 @@
std::string can_signal_t::prefix_ = "messages";
-can_signal_t::can_signal_t(std::uint8_t message_set_id,
- std::uint8_t message_id,
+can_signal_t::can_signal_t(
std::string generic_name,
uint8_t bit_position,
uint8_t bit_size,
@@ -46,9 +45,8 @@ can_signal_t::can_signal_t(std::uint8_t message_set_id,
SignalDecoder decoder,
SignalEncoder encoder,
bool received)
- : message_set_id_{ message_set_id }
- , message_id_{ message_id }
- , generic_name_{ generic_name }
+ : parent_{nullptr},
+ generic_name_{ generic_name }
, bit_position_{ bit_position }
, bit_size_{ bit_size }
, factor_{ factor }
@@ -66,14 +64,34 @@ can_signal_t::can_signal_t(std::uint8_t message_set_id,
, last_value_{.0f}
{}
+/*can_signal_t::can_signal_t(const can_signal_t& b)
+ : parent_{b.parent_},
+ generic_name_{ b.generic_name_}
+ , bit_position_{ b.bit_position_}
+ , bit_size_{ b.bit_size_}
+ , factor_{ b.factor_ }
+ , offset_{ b.offset_}
+ , min_value_{b.min_value_}
+ , max_value_{b.max_value_}
+ , frequency_{b.frequency_}
+ , send_same_{b.send_same_}
+ , force_send_changed_{b.force_send_changed_}
+ , states_{b.states_}
+ , writable_{b.writable_}
+ , decoder_{b.decoder_}
+ , encoder_{b.encoder_}
+ , received_{b.received_}
+ , last_value_{b.last_value_}
+{}*/
+
utils::socketcan_bcm_t can_signal_t::get_socket() const
{
return socket_;
}
-can_message_definition_t& can_signal_t::get_message() const
+std::shared_ptr<can_message_definition_t> can_signal_t::get_message() const
{
- return configuration_t::instance().get_can_message_definition(message_set_id_, message_id_);
+ return parent_;
}
const std::string& can_signal_t::get_generic_name() const
@@ -177,6 +195,11 @@ float can_signal_t::get_last_value() const
return last_value_;
}
+void can_signal_t::set_parent(std::shared_ptr<can_message_definition_t> parent)
+{
+ parent_(parent);
+}
+
void can_signal_t::set_prefix(std::string val)
{
prefix_ = val;