19 #ifndef _MODBUS_PRIVATE_H_ 20 #define _MODBUS_PRIVATE_H_ 24 # include <sys/time.h> 30 #include <sys/types.h> 44 #define _MIN_REQ_LENGTH 12 46 #define _REPORT_SLAVE_ID 180 48 #define _MODBUS_EXCEPTION_RSP_LENGTH 5 51 #define _RESPONSE_TIMEOUT 500000 52 #define _BYTE_TIMEOUT 500000 55 #define _FC_READ_COILS 0x01 56 #define _FC_READ_DISCRETE_INPUTS 0x02 57 #define _FC_READ_HOLDING_REGISTERS 0x03 58 #define _FC_READ_INPUT_REGISTERS 0x04 59 #define _FC_WRITE_SINGLE_COIL 0x05 60 #define _FC_WRITE_SINGLE_REGISTER 0x06 61 #define _FC_READ_EXCEPTION_STATUS 0x07 62 #define _FC_WRITE_MULTIPLE_COILS 0x0F 63 #define _FC_WRITE_MULTIPLE_REGISTERS 0x10 64 #define _FC_REPORT_SLAVE_ID 0x11 65 #define _FC_WRITE_AND_READ_REGISTERS 0x17 86 int (*build_request_basis) (
modbus_t *
ctx,
int function,
int addr,
87 int nb, uint8_t *req);
88 int (*build_response_basis) (
sft_t *sft, uint8_t *rsp);
89 int (*prepare_response_tid) (
const uint8_t *req,
int *req_length);
90 int (*send_msg_pre) (uint8_t *req,
int req_length);
91 ssize_t (*send) (
modbus_t *
ctx,
const uint8_t *req,
int req_length);
92 ssize_t (*recv) (
modbus_t *
ctx, uint8_t *rsp,
int rsp_length);
94 const int msg_length);
95 int (*pre_check_confirmation) (
modbus_t *
ctx,
const uint8_t *req,
96 const uint8_t *rsp,
int rsp_length);
100 int (*select) (
modbus_t *
ctx, fd_set *rfds,
struct timeval *tv,
int msg_length);
111 struct timeval response_timeout;
112 struct timeval byte_timeout;
121 size_t strlcpy(
char *dest,
const char *src,
size_t dest_size);
unsigned int header_length
size_t strlcpy(char *dest, const char *src, size_t dest_size)
void _error_print(modbus_t *ctx, const char *context)
unsigned int max_adu_length
const modbus_backend_t * backend
#define MODBUS_BEGIN_DECLS
void _modbus_init_common(modbus_t *ctx)
unsigned int checksum_length
unsigned int backend_type
struct _modbus_backend modbus_backend_t