Commit cfaa872f73cde0f89ff19b4870a98eae3d3825d8
1 parent
d7846ead
Replace the term "trame" by "message"
- updated comments - renamed internal constants (eg. _TIME_OUT_BEGIN_OF_TRAME in _TIME_OUT_BEGIN_OF_MESSAGE)
Showing
2 changed files
with
11 additions
and
11 deletions
src/modbus-private.h
| ... | ... | @@ -45,9 +45,9 @@ MODBUS_BEGIN_DECLS |
| 45 | 45 | |
| 46 | 46 | #define _MODBUS_EXCEPTION_RSP_LENGTH 5 |
| 47 | 47 | |
| 48 | -/* Time out between trames in microsecond */ | |
| 49 | -#define _TIME_OUT_BEGIN_OF_TRAME 500000 | |
| 50 | -#define _TIME_OUT_END_OF_TRAME 500000 | |
| 48 | +/* Time out between messages in microsecond */ | |
| 49 | +#define _TIME_OUT_BEGIN_OF_MESSAGE 500000 | |
| 50 | +#define _TIME_OUT_END_OF_MESSAGE 500000 | |
| 51 | 51 | |
| 52 | 52 | /* Function codes */ |
| 53 | 53 | #define _FC_READ_COILS 0x01 | ... | ... |
src/modbus.c
| 1 | 1 | /* |
| 2 | - * Copyright © 2001-2010 Stéphane Raimbault <stephane.raimbault@gmail.com> | |
| 2 | + * Copyright © 2001-2011 Stéphane Raimbault <stephane.raimbault@gmail.com> | |
| 3 | 3 | * |
| 4 | 4 | * This program is free software: you can redistribute it and/or modify |
| 5 | 5 | * it under the terms of the GNU Lesser Public License as published by |
| ... | ... | @@ -377,7 +377,7 @@ static int receive_msg(modbus_t *ctx, uint8_t *msg, msg_type_t msg_type) |
| 377 | 377 | |
| 378 | 378 | if (length_to_read > 0) { |
| 379 | 379 | /* If no character at the buffer wait |
| 380 | - TIME_OUT_END_OF_TRAME before raising an error. */ | |
| 380 | + TIME_OUT_END_OF_MESSAGE before raising an error. */ | |
| 381 | 381 | tv.tv_sec = ctx->timeout_end.tv_sec; |
| 382 | 382 | tv.tv_usec = ctx->timeout_end.tv_usec; |
| 383 | 383 | } |
| ... | ... | @@ -1273,10 +1273,10 @@ void _modbus_init_common(modbus_t *ctx) |
| 1273 | 1273 | ctx->error_recovery = FALSE; |
| 1274 | 1274 | |
| 1275 | 1275 | ctx->timeout_begin.tv_sec = 0; |
| 1276 | - ctx->timeout_begin.tv_usec = _TIME_OUT_BEGIN_OF_TRAME; | |
| 1276 | + ctx->timeout_begin.tv_usec = _TIME_OUT_BEGIN_OF_MESSAGE; | |
| 1277 | 1277 | |
| 1278 | 1278 | ctx->timeout_end.tv_sec = 0; |
| 1279 | - ctx->timeout_end.tv_usec = _TIME_OUT_END_OF_TRAME; | |
| 1279 | + ctx->timeout_end.tv_usec = _TIME_OUT_END_OF_MESSAGE; | |
| 1280 | 1280 | } |
| 1281 | 1281 | |
| 1282 | 1282 | /* Define the slave number */ |
| ... | ... | @@ -1297,25 +1297,25 @@ int modbus_set_error_recovery(modbus_t *ctx, int enabled) |
| 1297 | 1297 | return 0; |
| 1298 | 1298 | } |
| 1299 | 1299 | |
| 1300 | -/* Get the timeout of begin of trame */ | |
| 1300 | +/* Get the timeout of begin of message */ | |
| 1301 | 1301 | void modbus_get_timeout_begin(modbus_t *ctx, struct timeval *timeout) |
| 1302 | 1302 | { |
| 1303 | 1303 | *timeout = ctx->timeout_begin; |
| 1304 | 1304 | } |
| 1305 | 1305 | |
| 1306 | -/* Set timeout when waiting the beginning of a trame */ | |
| 1306 | +/* Set timeout when waiting the beginning of a message */ | |
| 1307 | 1307 | void modbus_set_timeout_begin(modbus_t *ctx, const struct timeval *timeout) |
| 1308 | 1308 | { |
| 1309 | 1309 | ctx->timeout_begin = *timeout; |
| 1310 | 1310 | } |
| 1311 | 1311 | |
| 1312 | -/* Get the timeout of end of trame */ | |
| 1312 | +/* Get the timeout of end of message */ | |
| 1313 | 1313 | void modbus_get_timeout_end(modbus_t *ctx, struct timeval *timeout) |
| 1314 | 1314 | { |
| 1315 | 1315 | *timeout = ctx->timeout_end; |
| 1316 | 1316 | } |
| 1317 | 1317 | |
| 1318 | -/* Set timeout when waiting the end of a trame */ | |
| 1318 | +/* Set timeout when waiting the end of a message */ | |
| 1319 | 1319 | void modbus_set_timeout_end(modbus_t *ctx, const struct timeval *timeout) |
| 1320 | 1320 | { |
| 1321 | 1321 | ctx->timeout_end = *timeout; | ... | ... |