Преглед на файлове

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.
Stéphane Raimbault преди 14 години
родител
ревизия
066b56d658
променени са 3 файла, в които са добавени 16 реда и са изтрити 53 реда
  1. 16 20
      src/modbus-rtu.c
  2. 0 17
      src/modbus-tcp.c
  3. 0 16
      src/modbus.c

+ 16 - 20
src/modbus-rtu.c

@@ -165,11 +165,12 @@ int _modbus_rtu_send_msg_pre(uint8_t *req, int req_length)
 }
 
 #if defined(_WIN32)
-/* This simple implementation is sort of a substitute of the select() call, working
- * this way: the win32_ser_select() call tries to read some data from the serial port,
- * setting the timeout as the select() call would. Data read is stored into the
- * receive buffer, that is then consumed by the win32_ser_read() call.
- * So win32_ser_select() does both the event waiting and the reading,
+
+/* This simple implementation is sort of a substitute of the select() call,
+ * working this way: the win32_ser_select() call tries to read some data from
+ * the serial port, setting the timeout as the select() call would. Data read is
+ * stored into the receive buffer, that is then consumed by the win32_ser_read()
+ * call.  So win32_ser_select() does both the event waiting and the reading,
  * while win32_ser_read() only consumes the receive buffer.
  */
 
@@ -182,7 +183,8 @@ static void win32_ser_init(struct win32_ser *ws) {
 }
 
 /* FIXME Try to remove length_to_read -> max_len argument, only used by win32 */
-static int win32_ser_select(struct win32_ser *ws, int max_len, struct timeval *tv) {
+static int win32_ser_select(struct win32_ser *ws, int max_len,
+                            struct timeval *tv) {
     COMMTIMEOUTS comm_to;
     unsigned int msec = 0;
 
@@ -223,7 +225,8 @@ static int win32_ser_select(struct win32_ser *ws, int max_len, struct timeval *t
     }
 }
 
-static int win32_ser_read(struct win32_ser *ws, uint8_t *p_msg, unsigned int max_len) {
+static int win32_ser_read(struct win32_ser *ws, uint8_t *p_msg,
+                          unsigned int max_len) {
     unsigned int n = ws->n_bytes;
 
     if (max_len < n) {
@@ -312,7 +315,8 @@ static int _modbus_rtu_connect(modbus_t *ctx)
      */
     win32_ser_init(&ctx_rtu->w_ser);
 
-    /* ctx_rtu->device should contain a string like "COMxx:" xx being a decimal number */
+    /* ctx_rtu->device should contain a string like "COMxx:" xx being a decimal
+     * number */
     ctx_rtu->w_ser.fd = CreateFileA(ctx_rtu->device,
                                     GENERIC_READ | GENERIC_WRITE,
                                     0,
@@ -716,11 +720,13 @@ int _modbus_rtu_flush(modbus_t *ctx)
 #endif
 }
 
-int _modbus_rtu_select(modbus_t *ctx, fd_set *rfds, struct timeval *tv, int length_to_read)
+int _modbus_rtu_select(modbus_t *ctx, fd_set *rfds,
+                       struct timeval *tv, int length_to_read)
 {
     int s_rc;
 #if defined(_WIN32)
-    s_rc = win32_ser_select(&(((modbus_rtu_t*)ctx->backend_data)->w_ser), length_to_read, tv);
+    s_rc = win32_ser_select(&(((modbus_rtu_t*)ctx->backend_data)->w_ser),
+                            length_to_read, tv);
     if (s_rc == 0) {
         errno = ETIMEDOUT;
         return -1;
@@ -805,16 +811,6 @@ const modbus_backend_t _modbus_rtu_backend = {
     _modbus_rtu_filter_request
 };
 
-/* Allocate and initialize the modbus_t structure for RTU
-   - device: "/dev/ttyS0"
-     On Win32, it's necessary to prepend COM name with "\\.\" for COM number
-     greater than 9, eg. "\\\\.\\COM10". See
-     http://msdn.microsoft.com/en-us/library/aa365247(v=vs.85).aspx for details.
-   - baud: 9600, 19200, 57600, 115200, etc
-   - parity: 'N' stands for None, 'E' for Even and 'O' for odd
-   - data_bits: 5, 6, 7, 8
-   - stop_bits: 1, 2
-*/
 modbus_t* modbus_new_rtu(const char *device,
                          int baud, char parity, int data_bit,
                          int stop_bit)

+ 0 - 17
src/modbus-tcp.c

@@ -613,15 +613,6 @@ const modbus_backend_t _modbus_tcp_pi_backend = {
     _modbus_tcp_filter_request
 };
 
-/* Allocates and initializes the modbus_t structure for TCP.
-   - ip: '192.168.0.5'
-   - port: 1099
-
-   Set the port to MODBUS_TCP_DEFAULT_PORT to use the default one
-   (502). It's convenient to use a port number greater than or equal
-   to 1024 because it's not necessary to be root to use this port
-   number.
-*/
 modbus_t* modbus_new_tcp(const char *ip, int port)
 {
     modbus_t *ctx;
@@ -674,14 +665,6 @@ modbus_t* modbus_new_tcp(const char *ip, int port)
     return ctx;
 }
 
-/* Allocates and initializes the modbus_t structure for TCP in a protocol
-   indepedent fashin, i.e. IPv4/IPv6 agnostic.
-
-   - node: host name or IP address of the host to connect to, eg. '192.168.0.5'
-     or 'server.com'.
-   - service: service name/port number to connect to. Use NULL for the default
-     port, 502/TCP.
-*/
 modbus_t* modbus_new_tcp_pi(const char *node, const char *service)
 {
     modbus_t *ctx;

+ 0 - 16
src/modbus.c

@@ -1285,19 +1285,6 @@ int modbus_set_slave(modbus_t *ctx, int slave)
     return ctx->backend->set_slave(ctx, slave);
 }
 
-/*
-  When disabled (default), it is expected that the application will check for
-  error returns and deal with them as necessary.
-
-  It's not recommanded to enable error recovery for slave/server.
-
-  When enabled, the library will attempt an immediate reconnection which may
-  hang for several seconds if the network to the remote target unit is down.
-  The write will try a infinite close/connect loop until to be successful and
-  the select/read calls will just try to retablish the connection one time then
-  will return an error (if the connecton was down, the values to read are
-  certainly not available anymore after reconnection, except for slave/server).
-*/
 int modbus_set_error_recovery(modbus_t *ctx, int enabled)
 {
     if (enabled == TRUE || enabled == FALSE) {
@@ -1344,7 +1331,6 @@ int modbus_connect(modbus_t *ctx)
     return ctx->backend->connect(ctx);
 }
 
-/* Closes a  connection */
 void modbus_close(modbus_t *ctx)
 {
     if (ctx == NULL)
@@ -1353,7 +1339,6 @@ void modbus_close(modbus_t *ctx)
     ctx->backend->close(ctx);
 }
 
-/* Free an initialized modbus_t */
 void modbus_free(modbus_t *ctx)
 {
     if (ctx == NULL)
@@ -1363,7 +1348,6 @@ void modbus_free(modbus_t *ctx)
     free(ctx);
 }
 
-/* Activates the debug messages */
 void modbus_set_debug(modbus_t *ctx, int boolean)
 {
     ctx->debug = boolean;