Agile Modbus  1.1.4
Lightweight modbus protocol stack.
Master Common Operation Functions

Commonly used modbus host operation functions. More...

Collaboration diagram for Master Common Operation Functions:

Functions

int agile_modbus_serialize_read_bits (agile_modbus_t *ctx, int addr, int nb)
 
int agile_modbus_deserialize_read_bits (agile_modbus_t *ctx, int msg_length, uint8_t *dest)
 
int agile_modbus_serialize_read_input_bits (agile_modbus_t *ctx, int addr, int nb)
 
int agile_modbus_deserialize_read_input_bits (agile_modbus_t *ctx, int msg_length, uint8_t *dest)
 
int agile_modbus_serialize_read_registers (agile_modbus_t *ctx, int addr, int nb)
 
int agile_modbus_deserialize_read_registers (agile_modbus_t *ctx, int msg_length, uint16_t *dest)
 
int agile_modbus_serialize_read_input_registers (agile_modbus_t *ctx, int addr, int nb)
 
int agile_modbus_deserialize_read_input_registers (agile_modbus_t *ctx, int msg_length, uint16_t *dest)
 
int agile_modbus_serialize_write_bit (agile_modbus_t *ctx, int addr, int status)
 
int agile_modbus_deserialize_write_bit (agile_modbus_t *ctx, int msg_length)
 
int agile_modbus_serialize_write_register (agile_modbus_t *ctx, int addr, const uint16_t value)
 
int agile_modbus_deserialize_write_register (agile_modbus_t *ctx, int msg_length)
 
int agile_modbus_serialize_write_bits (agile_modbus_t *ctx, int addr, int nb, const uint8_t *src)
 
int agile_modbus_deserialize_write_bits (agile_modbus_t *ctx, int msg_length)
 
int agile_modbus_serialize_write_registers (agile_modbus_t *ctx, int addr, int nb, const uint16_t *src)
 
int agile_modbus_deserialize_write_registers (agile_modbus_t *ctx, int msg_length)
 
int agile_modbus_serialize_mask_write_register (agile_modbus_t *ctx, int addr, uint16_t and_mask, uint16_t or_mask)
 
int agile_modbus_deserialize_mask_write_register (agile_modbus_t *ctx, int msg_length)
 
int agile_modbus_serialize_write_and_read_registers (agile_modbus_t *ctx, int write_addr, int write_nb, const uint16_t *src, int read_addr, int read_nb)
 
int agile_modbus_deserialize_write_and_read_registers (agile_modbus_t *ctx, int msg_length, uint16_t *dest)
 
int agile_modbus_serialize_report_slave_id (agile_modbus_t *ctx)
 
int agile_modbus_deserialize_report_slave_id (agile_modbus_t *ctx, int msg_length, int max_dest, uint8_t *dest)
 

Detailed Description

Commonly used modbus host operation functions.

   The API form is as follows:
   - agile_modbus_serialize_xxx    package request data
   return value:
       >0: Request data length
       Others: Abnormal

   - agile_modbus_deserialize_xxx  parses response data
   return value:
       >=0: The length of the corresponding function code response object (such as 03 function code, the value represents the number of registers)
       Others: exception (-1: message error; others: exception code can be obtained according to `-128 -$return value`)

Function Documentation

◆ agile_modbus_serialize_read_bits()

int agile_modbus_serialize_read_bits ( agile_modbus_t ctx,
int  addr,
int  nb 
)

Definition at line 445 of file agile_modbus.c.

◆ agile_modbus_deserialize_read_bits()

int agile_modbus_deserialize_read_bits ( agile_modbus_t ctx,
int  msg_length,
uint8_t *  dest 
)

Definition at line 461 of file agile_modbus.c.

Here is the call graph for this function:

◆ agile_modbus_serialize_read_input_bits()

int agile_modbus_serialize_read_input_bits ( agile_modbus_t ctx,
int  addr,
int  nb 
)

Definition at line 500 of file agile_modbus.c.

◆ agile_modbus_deserialize_read_input_bits()

int agile_modbus_deserialize_read_input_bits ( agile_modbus_t ctx,
int  msg_length,
uint8_t *  dest 
)

Definition at line 516 of file agile_modbus.c.

Here is the call graph for this function:

◆ agile_modbus_serialize_read_registers()

int agile_modbus_serialize_read_registers ( agile_modbus_t ctx,
int  addr,
int  nb 
)

Definition at line 555 of file agile_modbus.c.

◆ agile_modbus_deserialize_read_registers()

int agile_modbus_deserialize_read_registers ( agile_modbus_t ctx,
int  msg_length,
uint16_t *  dest 
)

Definition at line 571 of file agile_modbus.c.

Here is the call graph for this function:

◆ agile_modbus_serialize_read_input_registers()

int agile_modbus_serialize_read_input_registers ( agile_modbus_t ctx,
int  addr,
int  nb 
)

Definition at line 599 of file agile_modbus.c.

◆ agile_modbus_deserialize_read_input_registers()

int agile_modbus_deserialize_read_input_registers ( agile_modbus_t ctx,
int  msg_length,
uint16_t *  dest 
)

Definition at line 615 of file agile_modbus.c.

Here is the call graph for this function:

◆ agile_modbus_serialize_write_bit()

int agile_modbus_serialize_write_bit ( agile_modbus_t ctx,
int  addr,
int  status 
)

Definition at line 643 of file agile_modbus.c.

◆ agile_modbus_deserialize_write_bit()

int agile_modbus_deserialize_write_bit ( agile_modbus_t ctx,
int  msg_length 
)

Definition at line 656 of file agile_modbus.c.

Here is the call graph for this function:

◆ agile_modbus_serialize_write_register()

int agile_modbus_serialize_write_register ( agile_modbus_t ctx,
int  addr,
const uint16_t  value 
)

Definition at line 673 of file agile_modbus.c.

◆ agile_modbus_deserialize_write_register()

int agile_modbus_deserialize_write_register ( agile_modbus_t ctx,
int  msg_length 
)

Definition at line 686 of file agile_modbus.c.

Here is the call graph for this function:

◆ agile_modbus_serialize_write_bits()

int agile_modbus_serialize_write_bits ( agile_modbus_t ctx,
int  addr,
int  nb,
const uint8_t *  src 
)

Definition at line 703 of file agile_modbus.c.

◆ agile_modbus_deserialize_write_bits()

int agile_modbus_deserialize_write_bits ( agile_modbus_t ctx,
int  msg_length 
)

Definition at line 748 of file agile_modbus.c.

Here is the call graph for this function:

◆ agile_modbus_serialize_write_registers()

int agile_modbus_serialize_write_registers ( agile_modbus_t ctx,
int  addr,
int  nb,
const uint16_t *  src 
)

Definition at line 765 of file agile_modbus.c.

◆ agile_modbus_deserialize_write_registers()

int agile_modbus_deserialize_write_registers ( agile_modbus_t ctx,
int  msg_length 
)

Definition at line 796 of file agile_modbus.c.

Here is the call graph for this function:

◆ agile_modbus_serialize_mask_write_register()

int agile_modbus_serialize_mask_write_register ( agile_modbus_t ctx,
int  addr,
uint16_t  and_mask,
uint16_t  or_mask 
)

Definition at line 813 of file agile_modbus.c.

◆ agile_modbus_deserialize_mask_write_register()

int agile_modbus_deserialize_mask_write_register ( agile_modbus_t ctx,
int  msg_length 
)

Definition at line 835 of file agile_modbus.c.

Here is the call graph for this function:

◆ agile_modbus_serialize_write_and_read_registers()

int agile_modbus_serialize_write_and_read_registers ( agile_modbus_t ctx,
int  write_addr,
int  write_nb,
const uint16_t *  src,
int  read_addr,
int  read_nb 
)

Definition at line 852 of file agile_modbus.c.

◆ agile_modbus_deserialize_write_and_read_registers()

int agile_modbus_deserialize_write_and_read_registers ( agile_modbus_t ctx,
int  msg_length,
uint16_t *  dest 
)

Definition at line 893 of file agile_modbus.c.

Here is the call graph for this function:

◆ agile_modbus_serialize_report_slave_id()

int agile_modbus_serialize_report_slave_id ( agile_modbus_t ctx)

Definition at line 921 of file agile_modbus.c.

◆ agile_modbus_deserialize_report_slave_id()

int agile_modbus_deserialize_report_slave_id ( agile_modbus_t ctx,
int  msg_length,
int  max_dest,
uint8_t *  dest 
)

Definition at line 936 of file agile_modbus.c.

Here is the call graph for this function: