Commit cfaa872f73cde0f89ff19b4870a98eae3d3825d8

Authored by Stéphane Raimbault
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)
src/modbus-private.h
@@ -45,9 +45,9 @@ MODBUS_BEGIN_DECLS @@ -45,9 +45,9 @@ MODBUS_BEGIN_DECLS
45 45
46 #define _MODBUS_EXCEPTION_RSP_LENGTH 5 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 /* Function codes */ 52 /* Function codes */
53 #define _FC_READ_COILS 0x01 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 * This program is free software: you can redistribute it and/or modify 4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser Public License as published by 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,7 +377,7 @@ static int receive_msg(modbus_t *ctx, uint8_t *msg, msg_type_t msg_type)
377 377
378 if (length_to_read > 0) { 378 if (length_to_read > 0) {
379 /* If no character at the buffer wait 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 tv.tv_sec = ctx->timeout_end.tv_sec; 381 tv.tv_sec = ctx->timeout_end.tv_sec;
382 tv.tv_usec = ctx->timeout_end.tv_usec; 382 tv.tv_usec = ctx->timeout_end.tv_usec;
383 } 383 }
@@ -1273,10 +1273,10 @@ void _modbus_init_common(modbus_t *ctx) @@ -1273,10 +1273,10 @@ void _modbus_init_common(modbus_t *ctx)
1273 ctx->error_recovery = FALSE; 1273 ctx->error_recovery = FALSE;
1274 1274
1275 ctx->timeout_begin.tv_sec = 0; 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 ctx->timeout_end.tv_sec = 0; 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 /* Define the slave number */ 1282 /* Define the slave number */
@@ -1297,25 +1297,25 @@ int modbus_set_error_recovery(modbus_t *ctx, int enabled) @@ -1297,25 +1297,25 @@ int modbus_set_error_recovery(modbus_t *ctx, int enabled)
1297 return 0; 1297 return 0;
1298 } 1298 }
1299 1299
1300 -/* Get the timeout of begin of trame */ 1300 +/* Get the timeout of begin of message */
1301 void modbus_get_timeout_begin(modbus_t *ctx, struct timeval *timeout) 1301 void modbus_get_timeout_begin(modbus_t *ctx, struct timeval *timeout)
1302 { 1302 {
1303 *timeout = ctx->timeout_begin; 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 void modbus_set_timeout_begin(modbus_t *ctx, const struct timeval *timeout) 1307 void modbus_set_timeout_begin(modbus_t *ctx, const struct timeval *timeout)
1308 { 1308 {
1309 ctx->timeout_begin = *timeout; 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 void modbus_get_timeout_end(modbus_t *ctx, struct timeval *timeout) 1313 void modbus_get_timeout_end(modbus_t *ctx, struct timeval *timeout)
1314 { 1314 {
1315 *timeout = ctx->timeout_end; 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 void modbus_set_timeout_end(modbus_t *ctx, const struct timeval *timeout) 1319 void modbus_set_timeout_end(modbus_t *ctx, const struct timeval *timeout)
1320 { 1320 {
1321 ctx->timeout_end = *timeout; 1321 ctx->timeout_end = *timeout;