RoboidControl-cpp/RemoteParticipant.h
2025-02-21 14:40:51 +01:00

46 lines
1.4 KiB
C++

#pragma once
#include "Thing.h"
namespace Passer {
namespace RoboidControl {
/// @brief A reference to a participant, possibly on a remote location
class RemoteParticipant {
public:
/// @brief The internet address of the participant
const char *ipAddress = "0.0.0.0";
/// @brief The UDP port on which the participant can be reached
int port = 0;
/// @brief The network ID of the participant
unsigned char networkId = 0;
/// @brief The default constructor
RemoteParticipant();
/// @brief Create a new participant
/// @param ipAddress The IP address of the participant
/// @param port The UDP port of the participant
RemoteParticipant(const char *ipAddress, int port);
protected:
/// @brief The things reported by this participant
std::list<Thing *> things;
public:
/// @brief Get a thing with the give ids
/// @param networkId The network ID of the thing
/// @param thingId The ID of the thing
/// @return The thing when it is found, nullptr in other cases
Thing *Get(unsigned char networkId, unsigned char thingId);
/// @brief Add a new thing for this participant
/// @param thing The thing to add
void Add(Thing *thing);
/// @brief Remove a thing fror this participant
/// @param thing The thing to remove
void Remove(Thing *thing);
//void UpdateAll(unsigned long currentTimeMs);
};
} // namespace Control
} // namespace Passer