Commit 066b56d658737b6033e740f661e9677ca9383ce8

Authored by Stéphane Raimbault
1 parent f83246bb

Remove duplicated documentation for source files

To avoid to duplicate the documentation between source and
documentation. The information already available in documentation
is removed from source.
src/modbus-rtu.c
@@ -165,11 +165,12 @@ int _modbus_rtu_send_msg_pre(uint8_t *req, int req_length) @@ -165,11 +165,12 @@ int _modbus_rtu_send_msg_pre(uint8_t *req, int req_length)
165 } 165 }
166 166
167 #if defined(_WIN32) 167 #if defined(_WIN32)
168 -/* This simple implementation is sort of a substitute of the select() call, working  
169 - * this way: the win32_ser_select() call tries to read some data from the serial port,  
170 - * setting the timeout as the select() call would. Data read is stored into the  
171 - * receive buffer, that is then consumed by the win32_ser_read() call.  
172 - * So win32_ser_select() does both the event waiting and the reading, 168 +
  169 +/* This simple implementation is sort of a substitute of the select() call,
  170 + * working this way: the win32_ser_select() call tries to read some data from
  171 + * the serial port, setting the timeout as the select() call would. Data read is
  172 + * stored into the receive buffer, that is then consumed by the win32_ser_read()
  173 + * call. So win32_ser_select() does both the event waiting and the reading,
173 * while win32_ser_read() only consumes the receive buffer. 174 * while win32_ser_read() only consumes the receive buffer.
174 */ 175 */
175 176
@@ -182,7 +183,8 @@ static void win32_ser_init(struct win32_ser *ws) { @@ -182,7 +183,8 @@ static void win32_ser_init(struct win32_ser *ws) {
182 } 183 }
183 184
184 /* FIXME Try to remove length_to_read -> max_len argument, only used by win32 */ 185 /* FIXME Try to remove length_to_read -> max_len argument, only used by win32 */
185 -static int win32_ser_select(struct win32_ser *ws, int max_len, struct timeval *tv) { 186 +static int win32_ser_select(struct win32_ser *ws, int max_len,
  187 + struct timeval *tv) {
186 COMMTIMEOUTS comm_to; 188 COMMTIMEOUTS comm_to;
187 unsigned int msec = 0; 189 unsigned int msec = 0;
188 190
@@ -223,7 +225,8 @@ static int win32_ser_select(struct win32_ser *ws, int max_len, struct timeval *t @@ -223,7 +225,8 @@ static int win32_ser_select(struct win32_ser *ws, int max_len, struct timeval *t
223 } 225 }
224 } 226 }
225 227
226 -static int win32_ser_read(struct win32_ser *ws, uint8_t *p_msg, unsigned int max_len) { 228 +static int win32_ser_read(struct win32_ser *ws, uint8_t *p_msg,
  229 + unsigned int max_len) {
227 unsigned int n = ws->n_bytes; 230 unsigned int n = ws->n_bytes;
228 231
229 if (max_len < n) { 232 if (max_len < n) {
@@ -312,7 +315,8 @@ static int _modbus_rtu_connect(modbus_t *ctx) @@ -312,7 +315,8 @@ static int _modbus_rtu_connect(modbus_t *ctx)
312 */ 315 */
313 win32_ser_init(&ctx_rtu->w_ser); 316 win32_ser_init(&ctx_rtu->w_ser);
314 317
315 - /* ctx_rtu->device should contain a string like "COMxx:" xx being a decimal number */ 318 + /* ctx_rtu->device should contain a string like "COMxx:" xx being a decimal
  319 + * number */
316 ctx_rtu->w_ser.fd = CreateFileA(ctx_rtu->device, 320 ctx_rtu->w_ser.fd = CreateFileA(ctx_rtu->device,
317 GENERIC_READ | GENERIC_WRITE, 321 GENERIC_READ | GENERIC_WRITE,
318 0, 322 0,
@@ -716,11 +720,13 @@ int _modbus_rtu_flush(modbus_t *ctx) @@ -716,11 +720,13 @@ int _modbus_rtu_flush(modbus_t *ctx)
716 #endif 720 #endif
717 } 721 }
718 722
719 -int _modbus_rtu_select(modbus_t *ctx, fd_set *rfds, struct timeval *tv, int length_to_read) 723 +int _modbus_rtu_select(modbus_t *ctx, fd_set *rfds,
  724 + struct timeval *tv, int length_to_read)
720 { 725 {
721 int s_rc; 726 int s_rc;
722 #if defined(_WIN32) 727 #if defined(_WIN32)
723 - s_rc = win32_ser_select(&(((modbus_rtu_t*)ctx->backend_data)->w_ser), length_to_read, tv); 728 + s_rc = win32_ser_select(&(((modbus_rtu_t*)ctx->backend_data)->w_ser),
  729 + length_to_read, tv);
724 if (s_rc == 0) { 730 if (s_rc == 0) {
725 errno = ETIMEDOUT; 731 errno = ETIMEDOUT;
726 return -1; 732 return -1;
@@ -805,16 +811,6 @@ const modbus_backend_t _modbus_rtu_backend = { @@ -805,16 +811,6 @@ const modbus_backend_t _modbus_rtu_backend = {
805 _modbus_rtu_filter_request 811 _modbus_rtu_filter_request
806 }; 812 };
807 813
808 -/* Allocate and initialize the modbus_t structure for RTU  
809 - - device: "/dev/ttyS0"  
810 - On Win32, it's necessary to prepend COM name with "\\.\" for COM number  
811 - greater than 9, eg. "\\\\.\\COM10". See  
812 - http://msdn.microsoft.com/en-us/library/aa365247(v=vs.85).aspx for details.  
813 - - baud: 9600, 19200, 57600, 115200, etc  
814 - - parity: 'N' stands for None, 'E' for Even and 'O' for odd  
815 - - data_bits: 5, 6, 7, 8  
816 - - stop_bits: 1, 2  
817 -*/  
818 modbus_t* modbus_new_rtu(const char *device, 814 modbus_t* modbus_new_rtu(const char *device,
819 int baud, char parity, int data_bit, 815 int baud, char parity, int data_bit,
820 int stop_bit) 816 int stop_bit)
src/modbus-tcp.c
@@ -613,15 +613,6 @@ const modbus_backend_t _modbus_tcp_pi_backend = { @@ -613,15 +613,6 @@ const modbus_backend_t _modbus_tcp_pi_backend = {
613 _modbus_tcp_filter_request 613 _modbus_tcp_filter_request
614 }; 614 };
615 615
616 -/* Allocates and initializes the modbus_t structure for TCP.  
617 - - ip: '192.168.0.5'  
618 - - port: 1099  
619 -  
620 - Set the port to MODBUS_TCP_DEFAULT_PORT to use the default one  
621 - (502). It's convenient to use a port number greater than or equal  
622 - to 1024 because it's not necessary to be root to use this port  
623 - number.  
624 -*/  
625 modbus_t* modbus_new_tcp(const char *ip, int port) 616 modbus_t* modbus_new_tcp(const char *ip, int port)
626 { 617 {
627 modbus_t *ctx; 618 modbus_t *ctx;
@@ -674,14 +665,6 @@ modbus_t* modbus_new_tcp(const char *ip, int port) @@ -674,14 +665,6 @@ modbus_t* modbus_new_tcp(const char *ip, int port)
674 return ctx; 665 return ctx;
675 } 666 }
676 667
677 -/* Allocates and initializes the modbus_t structure for TCP in a protocol  
678 - indepedent fashin, i.e. IPv4/IPv6 agnostic.  
679 -  
680 - - node: host name or IP address of the host to connect to, eg. '192.168.0.5'  
681 - or 'server.com'.  
682 - - service: service name/port number to connect to. Use NULL for the default  
683 - port, 502/TCP.  
684 -*/  
685 modbus_t* modbus_new_tcp_pi(const char *node, const char *service) 668 modbus_t* modbus_new_tcp_pi(const char *node, const char *service)
686 { 669 {
687 modbus_t *ctx; 670 modbus_t *ctx;
src/modbus.c
@@ -1285,19 +1285,6 @@ int modbus_set_slave(modbus_t *ctx, int slave) @@ -1285,19 +1285,6 @@ int modbus_set_slave(modbus_t *ctx, int slave)
1285 return ctx->backend->set_slave(ctx, slave); 1285 return ctx->backend->set_slave(ctx, slave);
1286 } 1286 }
1287 1287
1288 -/*  
1289 - When disabled (default), it is expected that the application will check for  
1290 - error returns and deal with them as necessary.  
1291 -  
1292 - It's not recommanded to enable error recovery for slave/server.  
1293 -  
1294 - When enabled, the library will attempt an immediate reconnection which may  
1295 - hang for several seconds if the network to the remote target unit is down.  
1296 - The write will try a infinite close/connect loop until to be successful and  
1297 - the select/read calls will just try to retablish the connection one time then  
1298 - will return an error (if the connecton was down, the values to read are  
1299 - certainly not available anymore after reconnection, except for slave/server).  
1300 -*/  
1301 int modbus_set_error_recovery(modbus_t *ctx, int enabled) 1288 int modbus_set_error_recovery(modbus_t *ctx, int enabled)
1302 { 1289 {
1303 if (enabled == TRUE || enabled == FALSE) { 1290 if (enabled == TRUE || enabled == FALSE) {
@@ -1344,7 +1331,6 @@ int modbus_connect(modbus_t *ctx) @@ -1344,7 +1331,6 @@ int modbus_connect(modbus_t *ctx)
1344 return ctx->backend->connect(ctx); 1331 return ctx->backend->connect(ctx);
1345 } 1332 }
1346 1333
1347 -/* Closes a connection */  
1348 void modbus_close(modbus_t *ctx) 1334 void modbus_close(modbus_t *ctx)
1349 { 1335 {
1350 if (ctx == NULL) 1336 if (ctx == NULL)
@@ -1353,7 +1339,6 @@ void modbus_close(modbus_t *ctx) @@ -1353,7 +1339,6 @@ void modbus_close(modbus_t *ctx)
1353 ctx->backend->close(ctx); 1339 ctx->backend->close(ctx);
1354 } 1340 }
1355 1341
1356 -/* Free an initialized modbus_t */  
1357 void modbus_free(modbus_t *ctx) 1342 void modbus_free(modbus_t *ctx)
1358 { 1343 {
1359 if (ctx == NULL) 1344 if (ctx == NULL)
@@ -1363,7 +1348,6 @@ void modbus_free(modbus_t *ctx) @@ -1363,7 +1348,6 @@ void modbus_free(modbus_t *ctx)
1363 free(ctx); 1348 free(ctx);
1364 } 1349 }
1365 1350
1366 -/* Activates the debug messages */  
1367 void modbus_set_debug(modbus_t *ctx, int boolean) 1351 void modbus_set_debug(modbus_t *ctx, int boolean)
1368 { 1352 {
1369 ctx->debug = boolean; 1353 ctx->debug = boolean;