Blame view

stack/modbus-tcp.h 729 Bytes
b85a3e4a   Peter M. Groen   Setting up workin...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  #pragma once
  
  #include "modbus.h"
  
  MODBUS_BEGIN_DECLS
  
  #define MODBUS_TCP_DEFAULT_PORT   502
  #define MODBUS_TCP_SLAVE         0xFF
  
  /* Modbus_Application_Protocol_V1_1b.pdf Chapter 4 Section 1 Page 5
   * TCP MODBUS ADU = 253 bytes + MBAP (7 bytes) = 260 bytes
   */
  #define MODBUS_TCP_MAX_ADU_LENGTH  260
  
  MODBUS_API modbus_t* modbus_new_tcp(const char *ip_address, int port);
  MODBUS_API int modbus_tcp_listen(modbus_t *ctx, int nb_connection);
  MODBUS_API int modbus_tcp_accept(modbus_t *ctx, int *s);
  
  MODBUS_API modbus_t* modbus_new_tcp_pi(const char *node, const char *service);
  MODBUS_API int modbus_tcp_pi_listen(modbus_t *ctx, int nb_connection);
  MODBUS_API int modbus_tcp_pi_accept(modbus_t *ctx, int *s);
  
  MODBUS_END_DECLS