...
This commit is contained in:
@@ -89,7 +89,8 @@ public:
|
||||
typedef std::function<std::vector<char>(std::string_view)> handle_message_func_t;
|
||||
|
||||
|
||||
MccNetworkServer(asio::io_context& ctx, const handle_message_func_t& func, LoggerT logger = MccNullLogger{})
|
||||
MccNetworkServer(asio::io_context& ctx, const handle_message_func_t& func)
|
||||
requires std::same_as<LoggerT, MccNullLogger>
|
||||
: _asioContext(ctx), _handleMessageFunc(func), _stopSignal(ctx), _restartSignal(ctx)
|
||||
{
|
||||
std::stringstream st;
|
||||
@@ -98,6 +99,30 @@ public:
|
||||
logInfo(std::format("Create mount server instance (thread ID = {})", st.str()));
|
||||
}
|
||||
|
||||
template <typename... LoggerArgsTs>
|
||||
MccNetworkServer(asio::io_context& ctx, const handle_message_func_t& func, LoggerArgsTs&&... log_args)
|
||||
requires(not std::same_as<LoggerT, MccNullLogger>)
|
||||
: LoggerT(std::forward<LoggerArgsTs>(log_args)...),
|
||||
_asioContext(ctx),
|
||||
_handleMessageFunc(func),
|
||||
_stopSignal(ctx),
|
||||
_restartSignal(ctx)
|
||||
{
|
||||
std::stringstream st;
|
||||
st << std::this_thread::get_id();
|
||||
|
||||
logInfo(std::format("Create mount server instance (thread ID = {})", st.str()));
|
||||
}
|
||||
|
||||
// MccNetworkServer(asio::io_context& ctx, const handle_message_func_t& func, LoggerT logger = MccNullLogger{})
|
||||
// : _asioContext(ctx), _handleMessageFunc(func), _stopSignal(ctx), _restartSignal(ctx)
|
||||
// {
|
||||
// std::stringstream st;
|
||||
// st << std::this_thread::get_id();
|
||||
|
||||
// logInfo(std::format("Create mount server instance (thread ID = {})", st.str()));
|
||||
// }
|
||||
|
||||
~MccNetworkServer()
|
||||
{
|
||||
std::stringstream st;
|
||||
|
||||
@@ -474,7 +474,7 @@ struct MccNetMessageValidKeywords {
|
||||
|
||||
constexpr static const size_t* isKeywordValid(std::string_view key)
|
||||
{
|
||||
const auto hash = utils::FNV1aHash(key);
|
||||
const auto hash = mcc::utils::FNV1aHash(key);
|
||||
|
||||
for (auto const& h : NETMSG_VALID_KEYWORD_HASHES) {
|
||||
if (h == hash) {
|
||||
@@ -506,10 +506,10 @@ public:
|
||||
};
|
||||
|
||||
protected:
|
||||
class DefaultDeserializer : protected utils::MccSimpleDeserializer
|
||||
class DefaultDeserializer : protected mcc::utils::MccSimpleDeserializer
|
||||
{
|
||||
protected:
|
||||
using base_t = utils::MccSimpleDeserializer;
|
||||
using base_t = mcc::utils::MccSimpleDeserializer;
|
||||
|
||||
public:
|
||||
DefaultDeserializer() : base_t(MCC_COMMPROTO_RANGEPARAM_DELIM_SEQ) {}
|
||||
@@ -713,7 +713,7 @@ public:
|
||||
return withKey(std::string_view{key});
|
||||
}
|
||||
|
||||
return utils::FNV1aHash(key) == _keywordHash;
|
||||
return mcc::utils::FNV1aHash(key) == _keywordHash;
|
||||
}
|
||||
|
||||
|
||||
@@ -921,9 +921,9 @@ public:
|
||||
auto found = std::ranges::search(_msgBuffer, MCC_COMMPROTO_KEYPARAM_DELIM_SEQ);
|
||||
|
||||
if (found.empty()) { // only keyword
|
||||
key = utils::trimSpaces(std::string_view{_msgBuffer.begin(), _msgBuffer.end()});
|
||||
key = mcc::utils::trimSpaces(std::string_view{_msgBuffer.begin(), _msgBuffer.end()});
|
||||
} else {
|
||||
key = utils::trimSpaces(std::string_view{_msgBuffer.begin(), found.begin()});
|
||||
key = mcc::utils::trimSpaces(std::string_view{_msgBuffer.begin(), found.begin()});
|
||||
}
|
||||
|
||||
auto kv = valid_keys_t::isKeywordValid(key);
|
||||
|
||||
@@ -49,7 +49,10 @@ namespace mcc
|
||||
struct MccTelemetryCategory : public std::error_category {
|
||||
MccTelemetryCategory() : std::error_category() {}
|
||||
|
||||
const char* name() const noexcept { return "ALTITUDE-LIMIT-PZ"; }
|
||||
const char* name() const noexcept
|
||||
{
|
||||
return "ALTITUDE-LIMIT-PZ";
|
||||
}
|
||||
|
||||
std::string message(int ec) const
|
||||
{
|
||||
@@ -576,7 +579,10 @@ public:
|
||||
}
|
||||
|
||||
|
||||
bool isInternalTelemetryDataUpdating() const { return *_internalUpdating; }
|
||||
bool isInternalTelemetryDataUpdating() const
|
||||
{
|
||||
return *_internalUpdating;
|
||||
}
|
||||
|
||||
|
||||
error_t updateTelemetryData(traits::mcc_time_duration_c auto const& timeout)
|
||||
@@ -646,7 +652,7 @@ public:
|
||||
{
|
||||
/*
|
||||
* If apparent coordinates are specified (e.g. AZZD),
|
||||
* they are assumed to be fixed in time,
|
||||
* they are assumed to be fixed in time (i.e. pt.time_point will be ignored),
|
||||
* and other coordinates will be calculated from them
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user