8 #include <px4_msgs/msg/arming_check_reply.hpp>
10 namespace px4_ros2::events
13 using EventType = px4_msgs::msg::Event;
15 enum class LogLevel : uint8_t
31 enum class LogLevelInternal : uint8_t
48 using LogInternal = LogLevelInternal;
54 : external(external_level),
internal(
static_cast<LogInternal
>(external_level)) {}
55 LogLevels(Log external_level, LogInternal internal_level)
56 : external(external_level),
internal(internal_level) {}
58 Log external{Log::Info};
59 LogInternal
internal{LogInternal::Info};
66 constexpr uint32_t kVal32Const = 0x811c9dc5;
67 constexpr uint32_t kPrime32Const = 0x1000193;
68 inline constexpr uint32_t hash32Fnv1aConst(
69 const char *
const str,
70 const uint32_t value = kVal32Const) noexcept
72 return (str[0] ==
'\0') ? value : hash32Fnv1aConst(
73 &str[1], (value ^
static_cast<uint32_t
>(
74 str[0])) * kPrime32Const);
78 inline constexpr
void fillEventArguments(uint8_t * buf, T arg)
81 memcpy(buf, &arg,
sizeof(T));
84 template<
typename T,
typename ... Args>
85 inline constexpr
void fillEventArguments(uint8_t * buf, T arg, Args... args)
87 fillEventArguments(buf, arg);
88 fillEventArguments(buf +
sizeof(T), args ...);
91 constexpr
unsigned sizeofArguments() {
return 0;}
93 template<
typename T,
typename ... Args>
94 constexpr
unsigned sizeofArguments(
const T & t,
const Args &... args)
96 return sizeof(T) + sizeofArguments(args ...);
105 constexpr uint32_t ID(
const char (& name)[N])
108 const uint32_t component_id = 1U << 24;
109 return (0xffffff & util::hash32Fnv1aConst(name)) | component_id;
Definition: events.hpp:51