HiveMindBridge
HiveMindHostApiResponseHandler.h
Go to the documentation of this file.
1 #ifndef HIVEMINDBRIDGE_HIVEMINDHOSTAPIRESPONSEHANDLER_H
2 #define HIVEMINDBRIDGE_HIVEMINDHOSTAPIRESPONSEHANDLER_H
3 
5 #include "pheromones/GetNeighborResponseDTO.h"
6 #include "pheromones/GetNeighborsListResponseDTO.h"
7 #include "pheromones/PheromonesSettings.h"
8 #include <cpp-common/ILogger.h>
9 #include <functional>
10 
12 
13  public:
14  HiveMindHostApiResponseHandler(ILogger& logger);
15 
16  void handleMessage(const MessageDTO& message,
17  const HiveMindHostApiResponseDTO& hmResponse) override;
18 
19  bool onNeighborListUpdated(std::function<void(std::array<uint16_t, NEIGHBORS_MAX_SIZE>,
20  uint64_t bytesLength)> callback);
21 
22  bool onNeighborUpdated(
23  std::function<void(uint16_t neighborId, std::optional<Position> position)> callback);
24 
25  private:
26  ILogger& m_logger;
27 
28  std::function<void(std::array<uint16_t, NEIGHBORS_MAX_SIZE>, uint64_t bytesLength)>
30  std::function<void(uint16_t neighborId, std::optional<Position> position)>
32 
33  void handleNeighborList(const MessageDTO& message, const GetNeighborsListResponseDTO& list);
34  void handleNeighbor(const MessageDTO& message, const GetNeighborResponseDTO& neighbor);
35 };
36 
37 #endif // HIVEMINDBRIDGE_HIVEMINDHOSTAPIRESPONSEHANDLER_H
HiveMindHostApiResponseHandler::m_logger
ILogger & m_logger
Definition: HiveMindHostApiResponseHandler.h:26
HiveMindHostApiResponseHandler::onNeighborUpdated
bool onNeighborUpdated(std::function< void(uint16_t neighborId, std::optional< Position > position)> callback)
Definition: HiveMindHostApiResponseHandler.cpp:28
HiveMindHostApiResponseHandler::HiveMindHostApiResponseHandler
HiveMindHostApiResponseHandler(ILogger &logger)
Definition: HiveMindHostApiResponseHandler.cpp:3
HiveMindHostApiResponseHandler::m_neighborUpdateCallback
std::function< void(uint16_t neighborId, std::optional< Position > position)> m_neighborUpdateCallback
Definition: HiveMindHostApiResponseHandler.h:31
IHiveMindHostApiResponseHandler
Definition: IHiveMindHostApiResponseHandler.h:15
HiveMindHostApiResponseHandler::handleNeighbor
void handleNeighbor(const MessageDTO &message, const GetNeighborResponseDTO &neighbor)
Definition: HiveMindHostApiResponseHandler.cpp:50
HiveMindHostApiResponseHandler
Definition: HiveMindHostApiResponseHandler.h:11
HiveMindHostApiResponseHandler::onNeighborListUpdated
bool onNeighborListUpdated(std::function< void(std::array< uint16_t, NEIGHBORS_MAX_SIZE >, uint64_t bytesLength)> callback)
Definition: HiveMindHostApiResponseHandler.cpp:19
HiveMindHostApiResponseHandler::m_neighborListUpdateCallback
std::function< void(std::array< uint16_t, NEIGHBORS_MAX_SIZE >, uint64_t bytesLength)> m_neighborListUpdateCallback
Definition: HiveMindHostApiResponseHandler.h:29
IHiveMindHostApiResponseHandler.h
HiveMindHostApiResponseHandler::handleMessage
void handleMessage(const MessageDTO &message, const HiveMindHostApiResponseDTO &hmResponse) override
Definition: HiveMindHostApiResponseHandler.cpp:6
HiveMindHostApiResponseHandler::handleNeighborList
void handleNeighborList(const MessageDTO &message, const GetNeighborsListResponseDTO &list)
Definition: HiveMindHostApiResponseHandler.cpp:37