Align participant documentation
This commit is contained in:
parent
fe69419010
commit
df1a769d10
@ -6,8 +6,6 @@ namespace RoboidControl {
|
|||||||
|
|
||||||
std::list<Participant*> Participant::participants;
|
std::list<Participant*> Participant::participants;
|
||||||
|
|
||||||
Participant::Participant() {}
|
|
||||||
|
|
||||||
Participant::Participant(const char* ipAddress, int port) {
|
Participant::Participant(const char* ipAddress, int port) {
|
||||||
// make a copy of the ip address string
|
// make a copy of the ip address string
|
||||||
int addressLength = (int)strlen(ipAddress);
|
int addressLength = (int)strlen(ipAddress);
|
||||||
|
@ -13,60 +13,56 @@ constexpr int MAX_THING_COUNT = 256;
|
|||||||
/// reference to remote participants.
|
/// reference to remote participants.
|
||||||
class Participant {
|
class Participant {
|
||||||
public:
|
public:
|
||||||
/// @brief The Ip Address of a participant. When the participant is local,
|
/// @brief The Ip Address of a participant.
|
||||||
/// this contains 0.0.0.0
|
|
||||||
const char* ipAddress = "0.0.0.0";
|
const char* ipAddress = "0.0.0.0";
|
||||||
/// @brief The port number for UDP communication with the participant. This is
|
/// @brief The port number for UDP communication with the participant.
|
||||||
/// 0 for isolated participants.
|
|
||||||
unsigned int port = 0;
|
unsigned int port = 0;
|
||||||
|
|
||||||
/// @brief The network Id to identify the participant.
|
/// @brief The network Id to identify the participant
|
||||||
/// @note This field is likely to disappear in future versions
|
|
||||||
unsigned char networkId = 0;
|
unsigned char networkId = 0;
|
||||||
|
|
||||||
/// @brief Default constructor
|
|
||||||
Participant();
|
|
||||||
/// @brief Create a new participant with the given communcation info
|
/// @brief Create a new participant with the given communcation info
|
||||||
/// @param ipAddress The IP address of the participant
|
/// @param ipAddress The IP address of the participant
|
||||||
/// @param port The port of the participant
|
/// @param port The UDP port of the participant
|
||||||
Participant(const char* ipAddress, int port);
|
Participant(const char* ipAddress, int port);
|
||||||
/// @brief Destructor for the participant
|
/// @brief Destructor for the participant
|
||||||
~Participant();
|
~Participant();
|
||||||
|
|
||||||
virtual void Update(unsigned long currentTimeMs = 0);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
#if defined(NO_STD)
|
#if defined(NO_STD)
|
||||||
unsigned char thingCount = 0;
|
unsigned char thingCount = 0;
|
||||||
Thing* things[MAX_THING_COUNT];
|
Thing* things[MAX_THING_COUNT];
|
||||||
#else
|
#else
|
||||||
/// @brief The list of known participants
|
/// @brief The things managed by this participant
|
||||||
static std::list<Participant*> participants;
|
|
||||||
|
|
||||||
/// @brief The list of things managed by this participant
|
|
||||||
std::list<Thing*> things;
|
std::list<Thing*> things;
|
||||||
#endif
|
#endif
|
||||||
|
/// @brief Find a thing managed by this participant
|
||||||
|
/// @param thingId The ID of the thing
|
||||||
|
/// @return The thing if found, nullptr when no thing has been found
|
||||||
|
Thing* Get(unsigned char thingId);
|
||||||
|
/// @brief Add a new thing for this participant.
|
||||||
|
/// @param thing The thing to add
|
||||||
|
/// @param checkId If true, the thing.id is regenerated if it is zero
|
||||||
|
void Add(Thing* thing, bool checkId = true);
|
||||||
|
/// @brief Remove a thing for this participant
|
||||||
|
/// @param thing The thing to remove
|
||||||
|
void Remove(Thing* thing);
|
||||||
|
|
||||||
|
/// @brief Update all things for this participant
|
||||||
|
/// @param currentTimeMs The current time in milliseconds (optional)
|
||||||
|
virtual void Update(unsigned long currentTimeMs = 0);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
#if defined(NO_STD)
|
||||||
|
#else
|
||||||
|
/// @brief The list of known participants
|
||||||
|
static std::list<Participant*> participants;
|
||||||
|
#endif
|
||||||
static Participant* GetParticipant(const char* ipAddress, unsigned int port);
|
static Participant* GetParticipant(const char* ipAddress, unsigned int port);
|
||||||
static Participant* GetParticipant(unsigned char participantId);
|
static Participant* GetParticipant(unsigned char participantId);
|
||||||
static Participant* AddParticipant(const char* ipAddress, unsigned int port);
|
static Participant* AddParticipant(const char* ipAddress, unsigned int port);
|
||||||
static void AddParticipant(Participant* participant);
|
static void AddParticipant(Participant* participant);
|
||||||
|
|
||||||
/// @brief Find a thing managed by this participant
|
|
||||||
/// @param networkId The network ID for the thing
|
|
||||||
/// @param thingId The ID of the thing
|
|
||||||
/// @return The thing if found or nullptr when no thing has been found
|
|
||||||
/// @note The use of the network ID is likely to disappear in future versions.
|
|
||||||
Thing* Get(unsigned char thingId);
|
|
||||||
/// @brief Add a new thing for this participant.
|
|
||||||
/// @param thing The thing to add
|
|
||||||
/// @param checkId Checks the thing ID of the thing. If it is 0, a new thing
|
|
||||||
/// Id will be assigned.
|
|
||||||
void Add(Thing* thing, bool checkId = true);
|
|
||||||
/// @brief Remove a thing for this participant
|
|
||||||
/// @param thing The thing to remove
|
|
||||||
void Remove(Thing* thing);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace RoboidControl
|
} // namespace RoboidControl
|
||||||
|
Loading…
x
Reference in New Issue
Block a user