// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #pragma once #include #include #include #include namespace sys { class Service; } // namespace sys extern "C" { #include // for xQueueHandle #include } namespace parserFSM { class MessageHandler { static xQueueHandle sendQueue; json11::Json messageJson; std::string JsonErrorMsg; sys::Service *OwnerServicePtr = nullptr; public: MessageHandler(const std::string &message, sys::Service *OwnerService); [[nodiscard]] auto isJSONNull() const -> bool { return messageJson.is_null(); }; [[nodiscard]] auto isValid() const noexcept -> bool { return JsonErrorMsg.empty(); } [[nodiscard]] auto getErrorString() const -> const std::string & { return JsonErrorMsg; }; void processMessage(); static void putToSendQueue(const std::string &msg); static void setSendQueueHandle(xQueueHandle handle) { sendQueue = handle; } }; } // namespace parserFSM