8#include <px4_msgs/msg/arming_check_reply.hpp>
10namespace px4_ros2::events
13using EventType = px4_msgs::msg::Event;
15enum class LogLevel : uint8_t
31enum class LogLevelInternal : uint8_t
48using 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};
66constexpr uint32_t kVal32Const = 0x811c9dc5;
67constexpr uint32_t kPrime32Const = 0x1000193;
68inline 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);
78inline constexpr void fillEventArguments(uint8_t * buf, T arg)
81 memcpy(buf, &arg,
sizeof(T));
84template<
typename T,
typename ... Args>
85inline constexpr void fillEventArguments(uint8_t * buf, T arg, Args... args)
87 fillEventArguments(buf, arg);
88 fillEventArguments(buf +
sizeof(T), args ...);
91constexpr unsigned sizeofArguments() {
return 0;}
93template<
typename T,
typename ... Args>
94constexpr unsigned sizeofArguments(
const T & t,
const Args &... args)
96 return sizeof(T) + sizeofArguments(args ...);
105constexpr uint32_t ID(
const char (& name)[N])
108 const uint32_t component_id = 1U << 24;
109 return (0xffffff & util::hash32Fnv1aConst(name)) | component_id;