~aleteoryx/muditaos

ref: sign_test muditaos/module-utils/log/LoggerWorker.hpp -rw-r--r-- 975 bytes
a217eeb3 — Dawid Wojtas [BH-2024] Fix lack of alarm directory after updating software 1 year, 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include <Service/Worker.hpp>

namespace Log
{
    static constexpr auto workerName = "LoggerWorker";

    class LoggerWorker : public sys::Worker
    {
      public:
        enum class Signal
        {
            DumpFilledBuffer,
            DumpIntervalBuffer,
            DumpDiagnostic
        };

        static constexpr auto SignalQueueName   = "LoggerSignal";
        static constexpr auto SignalSize        = sizeof(Signal);
        static constexpr auto SignalQueueLength = 1;

        explicit LoggerWorker(const std::string &name);
        void notify(Signal command);
        bool handleMessage(std::uint32_t queueID) override;
        void handleCommand(Signal command);

      private:
        static constexpr auto priority = static_cast<UBaseType_t>(sys::ServicePriority::Idle);
    };

} // namespace Log