#include <stdint.h>
#include <sys/time.h>
#include "libmodbus/modbus-version.h"
#include "modbus-tcp.h"
#include "modbus-rtu.h"
Go to the source code of this file.
Classes | |
struct | modbus_mapping_t |
Typedefs | |
typedef struct _modbus | modbus_t |
Functions | |
void | modbus_close (modbus_t *ctx) |
int | modbus_connect (modbus_t *ctx) |
int | modbus_flush (modbus_t *ctx) |
void | modbus_free (modbus_t *ctx) |
uint8_t | modbus_get_byte_from_bits (const uint8_t *src, int index, unsigned int nb_bits) |
void | modbus_get_byte_timeout (modbus_t *ctx, struct timeval *timeout) |
float | modbus_get_float (const uint16_t *src) |
int | modbus_get_header_length (modbus_t *ctx) |
void | modbus_get_response_timeout (modbus_t *ctx, struct timeval *timeout) |
int | modbus_get_socket (modbus_t *ctx) |
void | modbus_mapping_free (modbus_mapping_t *mb_mapping) |
modbus_mapping_t * | modbus_mapping_new (int nb_coil_status, int nb_input_status, int nb_holding_registers, int nb_input_registers) |
int | modbus_read_bits (modbus_t *ctx, int addr, int nb, uint8_t *dest) |
int | modbus_read_input_bits (modbus_t *ctx, int addr, int nb, uint8_t *dest) |
int | modbus_read_input_registers (modbus_t *ctx, int addr, int nb, uint16_t *dest) |
int | modbus_read_registers (modbus_t *ctx, int addr, int nb, uint16_t *dest) |
int | modbus_receive (modbus_t *ctx, uint8_t *req) |
int | modbus_receive_confirmation (modbus_t *ctx, uint8_t *rsp) |
int | modbus_receive_from (modbus_t *ctx, int sockfd, uint8_t *req) |
int | modbus_reply (modbus_t *ctx, const uint8_t *req, int req_length, modbus_mapping_t *mb_mapping) |
int | modbus_reply_exception (modbus_t *ctx, const uint8_t *req, unsigned int exception_code) |
int | modbus_report_slave_id (modbus_t *ctx, uint8_t *dest) |
int | modbus_send_raw_request (modbus_t *ctx, uint8_t *raw_req, int raw_req_length) |
void | modbus_set_bits_from_byte (uint8_t *dest, int index, const uint8_t value) |
void | modbus_set_bits_from_bytes (uint8_t *dest, int index, unsigned int nb_bits, const uint8_t *tab_byte) |
void | modbus_set_byte_timeout (modbus_t *ctx, const struct timeval *timeout) |
void | modbus_set_debug (modbus_t *ctx, int boolean) |
int | modbus_set_error_recovery (modbus_t *ctx, modbus_error_recovery_mode error_recovery) |
void | modbus_set_float (float f, uint16_t *dest) |
void | modbus_set_response_timeout (modbus_t *ctx, const struct timeval *timeout) |
int | modbus_set_slave (modbus_t *ctx, int slave) |
void | modbus_set_socket (modbus_t *ctx, int socket) |
const char * | modbus_strerror (int errnum) |
int | modbus_write_and_read_registers (modbus_t *ctx, int write_addr, int write_nb, const uint16_t *src, int read_addr, int read_nb, uint16_t *dest) |
int | modbus_write_bit (modbus_t *ctx, int coil_addr, int status) |
int | modbus_write_bits (modbus_t *ctx, int addr, int nb, const uint8_t *data) |
int | modbus_write_register (modbus_t *ctx, int reg_addr, int value) |
int | modbus_write_registers (modbus_t *ctx, int addr, int nb, const uint16_t *data) |
Variables | |
const unsigned int | libmodbus_version_major |
const unsigned int | libmodbus_version_micro |
const unsigned int | libmodbus_version_minor |
#define EMBXACK (MODBUS_ENOBASE + MODBUS_EXCEPTION_ACKNOWLEDGE) |
#define EMBXGPATH (MODBUS_ENOBASE + MODBUS_EXCEPTION_GATEWAY_PATH) |
#define EMBXGTAR (MODBUS_ENOBASE + MODBUS_EXCEPTION_GATEWAY_TARGET) |
#define EMBXILADD (MODBUS_ENOBASE + MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS) |
#define EMBXILFUN (MODBUS_ENOBASE + MODBUS_EXCEPTION_ILLEGAL_FUNCTION) |
#define EMBXILVAL (MODBUS_ENOBASE + MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE) |
#define EMBXMEMPAR (MODBUS_ENOBASE + MODBUS_EXCEPTION_MEMORY_PARITY) |
#define EMBXNACK (MODBUS_ENOBASE + MODBUS_EXCEPTION_NEGATIVE_ACKNOWLEDGE) |
#define EMBXSBUSY (MODBUS_ENOBASE + MODBUS_EXCEPTION_SLAVE_OR_SERVER_BUSY) |
#define EMBXSFAIL (MODBUS_ENOBASE + MODBUS_EXCEPTION_SLAVE_OR_SERVER_FAILURE) |
#define MODBUS_GET_HIGH_BYTE | ( | data | ) | (((data) >> 8) & 0xFF) |
#define MODBUS_GET_INT16_FROM_INT8 | ( | tab_int8, | |
index | |||
) | ((tab_int8[(index)] << 8) + tab_int8[(index) + 1]) |
#define MODBUS_GET_INT32_FROM_INT16 | ( | tab_int16, | |
index | |||
) | ((tab_int16[(index)] << 16) + tab_int16[(index) + 1]) |
#define MODBUS_SET_INT16_TO_INT8 | ( | tab_int8, | |
index, | |||
value | |||
) |
anonymous enum |
uint8_t modbus_get_byte_from_bits | ( | const uint8_t * | src, |
int | index, | ||
unsigned int | nb_bits | ||
) |
Definition at line 57 of file modbus-data.c.
void modbus_get_byte_timeout | ( | modbus_t * | ctx, |
struct timeval * | timeout | ||
) |
float modbus_get_float | ( | const uint16_t * | src | ) |
Definition at line 77 of file modbus-data.c.
void modbus_get_response_timeout | ( | modbus_t * | ctx, |
struct timeval * | timeout | ||
) |
void modbus_mapping_free | ( | modbus_mapping_t * | mb_mapping | ) |
modbus_mapping_t* modbus_mapping_new | ( | int | nb_coil_status, |
int | nb_input_status, | ||
int | nb_holding_registers, | ||
int | nb_input_registers | ||
) |
int modbus_read_bits | ( | modbus_t * | ctx, |
int | addr, | ||
int | nb, | ||
uint8_t * | dest | ||
) |
int modbus_read_input_bits | ( | modbus_t * | ctx, |
int | addr, | ||
int | nb, | ||
uint8_t * | dest | ||
) |
int modbus_read_input_registers | ( | modbus_t * | ctx, |
int | addr, | ||
int | nb, | ||
uint16_t * | dest | ||
) |
int modbus_read_registers | ( | modbus_t * | ctx, |
int | addr, | ||
int | nb, | ||
uint16_t * | dest | ||
) |
int modbus_receive_confirmation | ( | modbus_t * | ctx, |
uint8_t * | rsp | ||
) |
int modbus_receive_from | ( | modbus_t * | ctx, |
int | sockfd, | ||
uint8_t * | req | ||
) |
int modbus_reply | ( | modbus_t * | ctx, |
const uint8_t * | req, | ||
int | req_length, | ||
modbus_mapping_t * | mb_mapping | ||
) |
int modbus_reply_exception | ( | modbus_t * | ctx, |
const uint8_t * | req, | ||
unsigned int | exception_code | ||
) |
int modbus_report_slave_id | ( | modbus_t * | ctx, |
uint8_t * | dest | ||
) |
int modbus_send_raw_request | ( | modbus_t * | ctx, |
uint8_t * | raw_req, | ||
int | raw_req_length | ||
) |
void modbus_set_bits_from_byte | ( | uint8_t * | dest, |
int | index, | ||
const uint8_t | value | ||
) |
Definition at line 30 of file modbus-data.c.
void modbus_set_bits_from_bytes | ( | uint8_t * | dest, |
int | index, | ||
unsigned int | nb_bits, | ||
const uint8_t * | tab_byte | ||
) |
Definition at line 41 of file modbus-data.c.
void modbus_set_byte_timeout | ( | modbus_t * | ctx, |
const struct timeval * | timeout | ||
) |
int modbus_set_error_recovery | ( | modbus_t * | ctx, |
modbus_error_recovery_mode | error_recovery | ||
) |
void modbus_set_float | ( | float | f, |
uint16_t * | dest | ||
) |
Definition at line 89 of file modbus-data.c.
void modbus_set_response_timeout | ( | modbus_t * | ctx, |
const struct timeval * | timeout | ||
) |
int modbus_write_and_read_registers | ( | modbus_t * | ctx, |
int | write_addr, | ||
int | write_nb, | ||
const uint16_t * | src, | ||
int | read_addr, | ||
int | read_nb, | ||
uint16_t * | dest | ||
) |
int modbus_write_bit | ( | modbus_t * | ctx, |
int | coil_addr, | ||
int | status | ||
) |
int modbus_write_bits | ( | modbus_t * | ctx, |
int | addr, | ||
int | nb, | ||
const uint8_t * | data | ||
) |
int modbus_write_register | ( | modbus_t * | ctx, |
int | reg_addr, | ||
int | value | ||
) |
int modbus_write_registers | ( | modbus_t * | ctx, |
int | addr, | ||
int | nb, | ||
const uint16_t * | data | ||
) |