|
55 | 55 | #include <string.h> |
56 | 56 | #include <sstream> |
57 | 57 |
|
| 58 | +#define ROK4_OBJECT_READ_ATTEMPTS "ROK4_OBJECT_READ_ATTEMPTS" |
| 59 | +#define ROK4_OBJECT_WRITE_ATTEMPTS "ROK4_OBJECT_WRITE_ATTEMPTS" |
| 60 | +#define ROK4_OBJECT_ATTEMPTS_WAIT "ROK4_OBJECT_ATTEMPTS_WAIT" |
| 61 | + |
58 | 62 | /** |
59 | 63 | * \author Institut national de l'information géographique et forestière |
60 | 64 | * \~french \brief Gestion des informations liées au format de canal |
@@ -138,26 +142,68 @@ class Context { |
138 | 142 | bool connected; |
139 | 143 |
|
140 | 144 | /** |
141 | | - * \~french \brief Nombre de tentatives pour en lecture ou écriture |
142 | | - * \~english \brief Attempts number to read or write |
| 145 | + * \~french \brief Nombre de tentatives pour en lecture |
| 146 | + * \~english \brief Attempts number to read |
| 147 | + */ |
| 148 | + int read_attempts; |
| 149 | + |
| 150 | + /** |
| 151 | + * \~french \brief Nombre de tentatives pour en écriture |
| 152 | + * \~english \brief Attempts number to write |
143 | 153 | */ |
144 | | - int attempts; |
| 154 | + int write_attempts; |
| 155 | + |
| 156 | + /** |
| 157 | + * \~french \brief Temps d'attente en secondes entre 2 tentatives |
| 158 | + * \~english \brief Waiting time, in seconds between two attempts |
| 159 | + */ |
| 160 | + int waiting_time; |
145 | 161 |
|
146 | 162 | /** |
147 | 163 | * \~french \brief Crée un objet Context |
148 | 164 | * \~english \brief Create a Context object |
149 | 165 | */ |
150 | | - Context () : connected(false), attempts(1) { } |
| 166 | + Context (); |
151 | 167 |
|
152 | 168 | public: |
153 | 169 |
|
154 | 170 | /** |
155 | | - * \~french \brief Modifie le nombre de tentative |
156 | | - * \~english \brief Change attempts number |
| 171 | + * \~french \brief Modifie le temps d'attente entre deux tentatives |
| 172 | + * \param[in] t Temps en secondes |
| 173 | + * \~english \brief Change waiting time between two attempts |
| 174 | + * \param[in] t Time, in seconds |
| 175 | + */ |
| 176 | + void setWaitingTime (int t) { |
| 177 | + if (t < 0) t = 0; |
| 178 | + waiting_time = t; |
| 179 | + } |
| 180 | + |
| 181 | + /** |
| 182 | + * \~french \brief Modifie le nombre de tentative pour la lecture |
| 183 | + * \~english \brief Change attempts number for readings |
| 184 | + */ |
| 185 | + void setReadAttempts (int a) { |
| 186 | + if (a < 1) a = 1; |
| 187 | + read_attempts = a; |
| 188 | + } |
| 189 | + |
| 190 | + /** |
| 191 | + * \~french \brief Modifie le nombre de tentative pour l'écriture |
| 192 | + * \~english \brief Change attempts number for writtings |
| 193 | + */ |
| 194 | + void setWriteAttempts (int a) { |
| 195 | + if (a < 1) a = 1; |
| 196 | + write_attempts = a; |
| 197 | + } |
| 198 | + |
| 199 | + /** |
| 200 | + * \~french \brief Modifie le nombre de tentative pour l'écriture et la lecture |
| 201 | + * \~english \brief Change attempts number for writtings and readings |
157 | 202 | */ |
158 | 203 | void setAttempts (int a) { |
159 | 204 | if (a < 1) a = 1; |
160 | | - attempts = a; |
| 205 | + read_attempts = a; |
| 206 | + write_attempts = a; |
161 | 207 | } |
162 | 208 |
|
163 | 209 | /** |
|
0 commit comments