diff --git a/platforms/common/include/libevents_definitions.h b/platforms/common/include/libevents_definitions.h deleted file mode 100644 index 4706a20693..0000000000 --- a/platforms/common/include/libevents_definitions.h +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** - * - * Copyright (c) 2020 PX4 Development Team. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/* - * This header defines the events::EventType type. - */ - -#pragma once - -#include - -namespace events -{ -using EventType = event_s; -} // namespace events - - - diff --git a/platforms/common/include/px4_platform_common/events.h b/platforms/common/include/px4_platform_common/events.h index b7356bed3d..b3dad933ba 100644 --- a/platforms/common/include/px4_platform_common/events.h +++ b/platforms/common/include/px4_platform_common/events.h @@ -45,7 +45,7 @@ #endif #include -#include +#include #include @@ -93,7 +93,7 @@ constexpr unsigned sizeofArguments(const T &t, const Args &... args) /** * publish/send an event */ -void send(EventType &event); +void send(event_s &event); /** * Generate event ID from an event name @@ -109,7 +109,7 @@ constexpr uint32_t ID(const char (&name)[N]) template inline void send(uint32_t id, const LogLevels &log_levels, const char *message, Args... args) { - EventType e{}; + event_s e{}; e.log_levels = ((uint8_t)log_levels.internal << 4) | (uint8_t)log_levels.external; e.id = id; static_assert(util::sizeofArguments(args...) <= sizeof(e.arguments), "Too many arguments"); @@ -120,7 +120,7 @@ inline void send(uint32_t id, const LogLevels &log_levels, const char *message, inline void send(uint32_t id, const LogLevels &log_levels, const char *message) { - EventType e{}; + event_s e{}; e.log_levels = ((uint8_t)log_levels.internal << 4) | (uint8_t)log_levels.external; e.id = id; CONSOLE_PRINT_EVENT(e.log_level_external, e.id, message); diff --git a/src/lib/events/events.cpp b/src/lib/events/events.cpp index 9bb215d356..2cac17c3f1 100644 --- a/src/lib/events/events.cpp +++ b/src/lib/events/events.cpp @@ -45,7 +45,7 @@ static uint16_t event_sequence{events::initial_event_sequence}; namespace events { -void send(EventType &event) +void send(event_s &event) { event.timestamp = hrt_absolute_time(); diff --git a/src/lib/events/events_ioctl.h b/src/lib/events/events_ioctl.h index 7b97c66aa4..e3b6b0e074 100644 --- a/src/lib/events/events_ioctl.h +++ b/src/lib/events/events_ioctl.h @@ -47,5 +47,5 @@ #define EVENTSIOCSEND _EVENTSIOC(1) typedef struct eventiocsend { - events::EventType &event; + event_s &event; } eventiocsend_t; diff --git a/src/lib/events/libevents b/src/lib/events/libevents index 59f7f5c0ec..8d5c44661b 160000 --- a/src/lib/events/libevents +++ b/src/lib/events/libevents @@ -1 +1 @@ -Subproject commit 59f7f5c0ec2e76fadbc1dc40cc0705d614472edc +Subproject commit 8d5c44661bf79106361eb0b5170025b86e85a525 diff --git a/src/lib/events/usr_events.cpp b/src/lib/events/usr_events.cpp index a2f076d065..e989437a77 100644 --- a/src/lib/events/usr_events.cpp +++ b/src/lib/events/usr_events.cpp @@ -44,7 +44,7 @@ namespace events { -void send(EventType &event) +void send(event_s &event) { eventiocsend_t data = {event}; boardctl(EVENTSIOCSEND, reinterpret_cast(&data)); diff --git a/src/modules/commander/HealthAndArmingChecks/Common.cpp b/src/modules/commander/HealthAndArmingChecks/Common.cpp index 678d26636b..796427180f 100644 --- a/src/modules/commander/HealthAndArmingChecks/Common.cpp +++ b/src/modules/commander/HealthAndArmingChecks/Common.cpp @@ -284,7 +284,7 @@ bool Report::report(bool is_armed, bool force) // send all events int offset = 0; - events::EventType event; + event_s event; for (int i = 0; i < max_num_events && offset < _next_buffer_idx; ++i) { EventBufferHeader *header = (EventBufferHeader *)(_event_buffer + offset); diff --git a/src/modules/commander/HealthAndArmingChecks/Common.hpp b/src/modules/commander/HealthAndArmingChecks/Common.hpp index 9c16c6203d..da7c5c2965 100644 --- a/src/modules/commander/HealthAndArmingChecks/Common.hpp +++ b/src/modules/commander/HealthAndArmingChecks/Common.hpp @@ -376,7 +376,7 @@ bool Report::addEvent(uint32_t event_id, const events::LogLevels &log_levels, co Args... args) { constexpr unsigned args_size = events::util::sizeofArguments(modes, args...); - static_assert(args_size <= sizeof(events::EventType::arguments), "Too many arguments"); + static_assert(args_size <= sizeof(event_s::arguments), "Too many arguments"); unsigned total_size = sizeof(EventBufferHeader) + args_size; if (total_size > sizeof(_event_buffer) - _next_buffer_idx) {