Skip to content

Commit 61690fd

Browse files
committed
Add functions description for TimedAttempt class
1 parent 0a3d995 commit 61690fd

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

src/time/TimedAttempt.h

+61
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,81 @@
1212

1313
namespace arduino { namespace time {
1414

15+
/**
16+
* The TimedAttempt class manages retry attempts with configurable delays.
17+
* It allows setting minimum and maximum delays, and provides methods to
18+
* begin, retry, reset, and check the status of attempts.
19+
*/
1520
class TimedAttempt {
1621

1722
public:
23+
/**
24+
* Constructor to initialize TimedAttempt with minimum and maximum delay
25+
* @param minDelay: minimum delay between attempts
26+
* @param maxDelay: maximum delay between attempts
27+
*/
1828
TimedAttempt(unsigned long minDelay, unsigned long maxDelay);
1929

30+
/**
31+
* Begin the attempt with a fixed delay
32+
* @param delay: fixed delay between attempts
33+
*/
2034
void begin(unsigned long delay);
35+
36+
/**
37+
* Begin the attempt with a range of delays
38+
* @param minDelay: minimum delay between attempts
39+
* @param maxDelay: maximum delay between attempts
40+
*/
2141
void begin(unsigned long minDelay, unsigned long maxDelay);
42+
43+
/**
44+
* Reconfigure the attempt with new minimum and maximum delays and reload
45+
* @param minDelay: new minimum delay between attempts
46+
* @param maxDelay: new maximum delay between attempts
47+
* @return the new delay after reconfiguration
48+
*/
2249
unsigned long reconfigure(unsigned long minDelay, unsigned long maxDelay);
50+
51+
/**
52+
* Retry the attempt, incrementing the retry count and reloading the delay
53+
* @return the new delay after retry
54+
*/
2355
unsigned long retry();
56+
57+
/**
58+
* Reload the delay based on the retry count and return the new delay
59+
* @return the new delay after reload
60+
*/
2461
unsigned long reload();
62+
63+
/**
64+
* Reset the retry count to zero
65+
*/
2566
void reset();
67+
68+
/**
69+
* Check if a retry has been attempted
70+
* @return true if a retry has been attempted, false otherwise
71+
*/
2672
bool isRetry();
73+
74+
/**
75+
* Check if the current attempt has expired based on the delay
76+
* @return true if the current attempt has expired, false otherwise
77+
*/
2778
bool isExpired();
79+
80+
/**
81+
* Get the current retry count
82+
* @return the current retry count
83+
*/
2884
unsigned int getRetryCount();
85+
86+
/**
87+
* Get the current wait time for the next retry
88+
* @return the current wait time for the next retry
89+
*/
2990
unsigned int getWaitTime();
3091

3192
private:

0 commit comments

Comments
 (0)