From 944295b5af95fdcb1a33e2028ef709e7bf60cb6e Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Thu, 20 Jul 2017 10:14:56 +0200 Subject: Fix: align bindingv2 struct with dab appfw version DAB Fixes follows appfw API break. Following functions now return 0 on success and negative value on failure : o afb_req_subcall o afb_req_subcall_sync o afb_service_call o afb_service_call_sync Verbosity macros used in v2 bindings now needs to be prefixed with AFB_ (ERROR -> AFB_ERROR) New field for afb_verb_v2 and afb_binding_v2 structures Fix: uninitialized variables. Change-Id: Ia728b9ac4576b9b44c8c7c054820b7c64a314942 Signed-off-by: Romain Forlot --- low-can-binding/can/can-message.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'low-can-binding/can/can-message.cpp') diff --git a/low-can-binding/can/can-message.cpp b/low-can-binding/can/can-message.cpp index 057bc71..8221e30 100644 --- a/low-can-binding/can/can-message.cpp +++ b/low-can-binding/can/can-message.cpp @@ -176,7 +176,7 @@ void can_message_t::set_format(const can_message_format_t new_format) if(new_format == can_message_format_t::STANDARD || new_format == can_message_format_t::EXTENDED || new_format == can_message_format_t::INVALID) format_ = new_format; else - ERROR("Can set format, wrong format chosen"); + AFB_ERROR("Can set format, wrong format chosen"); } /// @brief Take a canfd_frame struct to initialize class members @@ -189,7 +189,7 @@ void can_message_t::set_format(const can_message_format_t new_format) /// @return A can_message_t object fully initialized with canfd_frame values. can_message_t can_message_t::convert_from_frame(const struct canfd_frame& frame, size_t nbytes, uint64_t timestamp) { - uint8_t maxdlen, length, flags = (uint8_t)NULL; + uint8_t maxdlen = 0, length = 0, flags = 0; uint32_t id; can_message_format_t format; bool rtr_flag; @@ -198,15 +198,15 @@ can_message_t can_message_t::convert_from_frame(const struct canfd_frame& frame, switch(nbytes) { case CANFD_MTU: - DEBUG("Got an CAN FD frame"); + AFB_DEBUG("Got an CAN FD frame"); maxdlen = CANFD_MAX_DLEN; break; case CAN_MTU: - DEBUG("Got a legacy CAN frame"); + AFB_DEBUG("Got a legacy CAN frame"); maxdlen = CAN_MAX_DLEN; break; default: - ERROR("unsupported CAN frame"); + AFB_ERROR("unsupported CAN frame"); break; } @@ -260,7 +260,7 @@ can_message_t can_message_t::convert_from_frame(const struct canfd_frame& frame, data.push_back(frame.data[i]); }; - DEBUG("Found id: %X, format: %X, length: %X, data %02X%02X%02X%02X%02X%02X%02X%02X", + AFB_DEBUG("Found id: %X, format: %X, length: %X, data %02X%02X%02X%02X%02X%02X%02X%02X", id, (uint8_t)format, length, data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]); } @@ -277,7 +277,7 @@ can_message_t can_message_t::convert_from_frame(const struct canfd_frame& frame, /// @return A can_message_t object fully initialized with can_frame values. can_message_t can_message_t::convert_from_frame(const struct can_frame& frame, size_t nbytes, uint64_t timestamp) { - uint8_t maxdlen, length, flags = (uint8_t)NULL; + uint8_t maxdlen = 0, length = 0, flags = 0; uint32_t id; can_message_format_t format; bool rtr_flag; @@ -285,12 +285,12 @@ can_message_t can_message_t::convert_from_frame(const struct can_frame& frame, s if(nbytes <= CAN_MTU) { - DEBUG("Got a legacy CAN frame"); + AFB_DEBUG("Got a legacy CAN frame"); maxdlen = CAN_MAX_DLEN; } else { - ERROR("unsupported CAN frame"); + AFB_ERROR("unsupported CAN frame"); } if (frame.can_id & CAN_ERR_FLAG) @@ -339,7 +339,7 @@ can_message_t can_message_t::convert_from_frame(const struct can_frame& frame, s data.push_back(frame.data[i]); }; -// DEBUG("Found id: %X, format: %X, length: %X, data %02X%02X%02X%02X%02X%02X%02X%02X", +// AFB_DEBUG("Found id: %X, format: %X, length: %X, data %02X%02X%02X%02X%02X%02X%02X%02X", // id, (uint8_t)format, length, data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]); } @@ -362,7 +362,7 @@ struct canfd_frame can_message_t::convert_to_canfd_frame() ::memcpy(frame.data, get_data(), length_); } else - ERROR("can_message_t not correctly initialized to be sent"); + AFB_ERROR("can_message_t not correctly initialized to be sent"); return frame; } @@ -383,7 +383,7 @@ struct can_frame can_message_t::convert_to_can_frame() ::memcpy(frame.data, get_data(), length_); } else - ERROR("can_message_t not correctly initialized to be sent"); + AFB_ERROR("can_message_t not correctly initialized to be sent"); return frame; } -- cgit 1.2.3-korg