Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
ApiEventLoggerCommunicationProtocol.hpp
Go to the documentation of this file.
1
2#ifndef IV_SRC_COMMS_APIS_EVENTLOGGER_APIDATALOGGERCOMMUNICATIONPROTOCOL_HPP_
3#define IV_SRC_COMMS_APIS_EVENTLOGGER_APIDATALOGGERCOMMUNICATIONPROTOCOL_HPP_
8
10{
13{
14public:
16 const std::shared_ptr<iv::comms::ICommunicationDriver> &driver,
17 const std::shared_ptr<iv::model::comms::NetworkData> &networkData,
18 const std::weak_ptr<iv::channels::AbstractChannel> &heartbeatChannel,
19 const std::weak_ptr<iv::diamar::AppFailuresLoggerManager> &appFailuresLoggerManager, bool sendToCloud);
21
22 bool sendValues() override;
23 [[nodiscard]] bool isOnline() override;
24 [[nodiscard]] iv::comms::api::ApiResponse getValues(const IApiQueryParamsBuilder &queryParams) const override;
25
27 deleteValues(const IApiQueryParamsBuilder &queryParams) const override;
28
29 void registerValue(const std::shared_ptr<iv::comms::api::ILoggerMessage> &message) override;
30
31private:
32 static constexpr std::size_t m_sendQueueSize {5000};
33 std::unique_ptr<iv::containers::CircularQueue<std::shared_ptr<iv::comms::api::eventLogger::EventLoggerMessage>,
36
37 struct EventsApi
38 {
39 static constexpr std::string_view route {"/event"};
40
41 struct Fields
42 {
43 static constexpr std::string_view id {"id"};
44 static constexpr std::string_view timestamp {"event_timestamp"};
45 static constexpr std::string_view message {"event_message"};
46 static constexpr std::string_view source {"event_source"};
47 static constexpr std::string_view type {"event_type"};
48 static constexpr std::string_view category {"event_category"};
49 static constexpr std::string_view data {"event_data"};
50
51 static constexpr std::string_view cloud {"cloud"};
52
53 static constexpr std::string_view ipAddress {"ipAddress"};
54 static constexpr std::string_view ipPort {"ipPort"};
55
56 static constexpr std::string_view userProfileIn {"userProfileIn"};
57 static constexpr std::string_view userProfileOut {"userProfileOut"};
58
59 static constexpr std::string_view unitId {"unitId"};
60 static constexpr std::string_view channelId {"channelId"};
61 static constexpr std::string_view groupId {"groupId"};
62
63 static constexpr std::string_view backupName {"backupName"};
64 };
65 struct Request
66 {
67 static constexpr std::string_view offset {"offset"};
68 static constexpr std::string_view limit {"limit"};
69 static constexpr std::string_view category {"category"};
70 static constexpr std::string_view source {"source"};
71 static constexpr std::string_view startTimestamp {"startTimestamp"};
72 static constexpr std::string_view endTimestamp {"endTimestamp"};
73 };
74 struct Response
75 {
76 static constexpr std::string_view data {"data"};
77 };
78 };
79};
80}// namespace iv::comms::api::eventLogger
81#endif//IV_SRC_COMMS_APIS_EVENTLOGGER_APIDATALOGGERCOMMUNICATIONPROTOCOL_HPP_
Definition ICommunicationProtocol.hpp:12
Definition IApiCommunicationProtocol.hpp:16
Definition IApiQueryParamsBuilder.hpp:13
Definition ApiEventLoggerCommunicationProtocol.hpp:13
iv::comms::api::ApiDeleteResponse deleteValues(const IApiQueryParamsBuilder &queryParams) const override
Delete values from the API.
Definition ApiEventLoggerCommunicationProtocol.cpp:240
static constexpr std::size_t m_sendQueueSize
Definition ApiEventLoggerCommunicationProtocol.hpp:32
bool isOnline() override
Definition ApiEventLoggerCommunicationProtocol.cpp:28
std::unique_ptr< iv::containers::CircularQueue< std::shared_ptr< iv::comms::api::eventLogger::EventLoggerMessage >, m_sendQueueSize > > m_sendQueue
Definition ApiEventLoggerCommunicationProtocol.hpp:35
void registerValue(const std::shared_ptr< iv::comms::api::ILoggerMessage > &message) override
Registers an API message without blocking the thread.
Definition ApiEventLoggerCommunicationProtocol.cpp:38
iv::comms::api::ApiResponse getValues(const IApiQueryParamsBuilder &queryParams) const override
Get values from the API.
Definition ApiEventLoggerCommunicationProtocol.cpp:154
bool sendValues() override
Send all registered messages to the API.
Definition ApiEventLoggerCommunicationProtocol.cpp:51
ApiEventLoggerCommunicationProtocol(const std::shared_ptr< iv::comms::ICommunicationDriver > &driver, const std::shared_ptr< iv::model::comms::NetworkData > &networkData, const std::weak_ptr< iv::channels::AbstractChannel > &heartbeatChannel, const std::weak_ptr< iv::diamar::AppFailuresLoggerManager > &appFailuresLoggerManager, bool sendToCloud)
Definition ApiEventLoggerCommunicationProtocol.cpp:10
Definition ApiEventLoggerCommunicationProtocol.cpp:8
Definition structs.hpp:69
Definition structs.hpp:63
static constexpr std::string_view userProfileIn
Definition ApiEventLoggerCommunicationProtocol.hpp:56
static constexpr std::string_view cloud
Definition ApiEventLoggerCommunicationProtocol.hpp:51
static constexpr std::string_view source
Definition ApiEventLoggerCommunicationProtocol.hpp:46
static constexpr std::string_view userProfileOut
Definition ApiEventLoggerCommunicationProtocol.hpp:57
static constexpr std::string_view type
Definition ApiEventLoggerCommunicationProtocol.hpp:47
static constexpr std::string_view message
Definition ApiEventLoggerCommunicationProtocol.hpp:45
static constexpr std::string_view data
Definition ApiEventLoggerCommunicationProtocol.hpp:49
static constexpr std::string_view channelId
Definition ApiEventLoggerCommunicationProtocol.hpp:60
static constexpr std::string_view ipPort
Definition ApiEventLoggerCommunicationProtocol.hpp:54
static constexpr std::string_view ipAddress
Definition ApiEventLoggerCommunicationProtocol.hpp:53
static constexpr std::string_view unitId
Definition ApiEventLoggerCommunicationProtocol.hpp:59
static constexpr std::string_view category
Definition ApiEventLoggerCommunicationProtocol.hpp:48
static constexpr std::string_view groupId
Definition ApiEventLoggerCommunicationProtocol.hpp:61
static constexpr std::string_view backupName
Definition ApiEventLoggerCommunicationProtocol.hpp:63
static constexpr std::string_view timestamp
Definition ApiEventLoggerCommunicationProtocol.hpp:44
static constexpr std::string_view source
Definition ApiEventLoggerCommunicationProtocol.hpp:70
static constexpr std::string_view endTimestamp
Definition ApiEventLoggerCommunicationProtocol.hpp:72
static constexpr std::string_view offset
Definition ApiEventLoggerCommunicationProtocol.hpp:67
static constexpr std::string_view limit
Definition ApiEventLoggerCommunicationProtocol.hpp:68
static constexpr std::string_view startTimestamp
Definition ApiEventLoggerCommunicationProtocol.hpp:71
static constexpr std::string_view category
Definition ApiEventLoggerCommunicationProtocol.hpp:69
static constexpr std::string_view data
Definition ApiEventLoggerCommunicationProtocol.hpp:76
Definition ApiEventLoggerCommunicationProtocol.hpp:38
static constexpr std::string_view route
Definition ApiEventLoggerCommunicationProtocol.hpp:39