EVE 1.0
Modbus driver
Collaboration diagram for Modbus driver:

Data Structures

struct  mb_transfer_file_t
 Structure for holding variables related to Transfer File function. More...
 
struct  MbFunctionDescriptor_t
 Structure for holding a callback serving one of Modbus commands. A pointer of array of these structures must be settled as the FuncHandlers member of the modbus_t structure. More...
 
struct  MbVirtualfunc_t
 Structure for holding a number of protocol specific virtual functions. UART related functions are the part of Modbus driver. Other protocols must be implemented on the application level. It is not necessary to implement MbStart and/or MbStop functions, if there is nothing to do. Thus functions can be settlet to NULL in the structure. However MbSendData/MbReceiveData functions are mandatory. A pointer of array of these structures must be settled as the Virtualfunc member of the modbus_t structure. More...
 
struct  modbus_state_t
 modbus_state_t structure holds internal state of the Modbus driver. More...
 
struct  modbus_t
 modbus_t structure is used for configuration of Modbus instance. The structure must be initialized before the Modbus driver may be used. More...
 

Macros

#define MB_SLAVEID_BUF_LEN   32
 Number of bytes which should be allocated for the Report Slave ID command. More...
 
#define MB_SER_PDU_SIZE_MAX   255
 Maximum size of a Modbus RTU frame. 1 byte less than standard because of internal UART limitation.
 
#define MB_TFILE_TARGET_SIZE   31
 Length of bit vector of targets for Transfer File function.
 
#define MB_TFILE_FNAMELEN_MAX   32
 Length of the buffer holding filename for Transfer File function. As file name is null-terminated, actual filenane length cannot exceed 31.
 
#define MB_TFILE_LAST_PACKET   (1 << 31)
 Bit flag in the packet number field of TransferFilePart frame denoting the last packet (file end).
 
#define MB_TFILE_PART_REGADDR   0xFF00
 Server's pseudo-register containing last part number for verification from client (2 registers actually: MB_TFILE_PART_REGADDR and MB_TFILE_PART_REGADDR+1)
 
#define MB_ADDRESS_BROADCAST   ( 0 )
 Modbus server addresses. More...
 
#define MB_ADDRESS_MIN   ( 1 )
 Smallest possible slave address.
 
#define MB_ADDRESS_MAX   ( 247 )
 Biggest possible slave address.
 
#define MB_TCP_PSEUDO_ADDRESS   ( 255 )
 Server address on Modbus over TCP.
 
#define MB_FUNC_NONE   (0x00)
 Modbus function codes. More...
 
#define MB_FUNC_READ_COILS   (0x01)
 Read Coils.
 
#define MB_FUNC_READ_DISCRETE_INPUTS   (0x02)
 Read Discrete Inputs.
 
#define MB_FUNC_READ_HOLDING_REGISTER   (0x03)
 Read Holding Registers.
 
#define MB_FUNC_READ_INPUT_REGISTER   (0x04)
 Read Input Registers.
 
#define MB_FUNC_WRITE_SINGLE_COIL   (0x05)
 Write Single Coil.
 
#define MB_FUNC_WRITE_REGISTER   (0x06)
 Write Single Register.
 
#define MB_FUNC_DIAG_READ_EXCEPTION   (0x07)
 Read Exception Status (Serial Line only)
 
#define MB_FUNC_DIAG_DIAGNOSTIC   (0x08)
 Diagnostics (Serial Line only)
 
#define MB_FUNC_DIAG_GET_COM_EVENT_CNT   (0x0B)
 Get Comm Event Counter (Serial Line only)
 
#define MB_FUNC_DIAG_GET_COM_EVENT_LOG   (0x0C)
 Get Comm Event Log (Serial Line only)
 
#define MB_FUNC_WRITE_MULTIPLE_COILS   (0x0F)
 Write Multiple Coils.
 
#define MB_FUNC_WRITE_MULTIPLE_REGISTERS   (0x10)
 Write Multiple registers.
 
#define MB_FUNC_REPORT_SERVER_ID   (0x11)
 Report Server ID (Serial Line only)
 
#define MB_FUNC_READ_FILE_RECORD   (0x14)
 Read File Record.
 
#define MB_FUNC_WRITE_FILE_RECORD   (0x15)
 Write File Record.
 
#define MB_FUNC_READWRITE_MULTIPLE_REGISTERS   (0x17)
 Read/Write Multiple registers.
 
#define MB_FUNC_TRANSFER_FILE   (0x64)
 Transfer file - Jetro proprietary.
 
#define MB_FUNC_TRANSFER_FILE_COMPLETED   (0x65)
 Transfer file complete - Jetro proprietary.
 
#define MB_FUNC_NEW_FILE   (0x66)
 New file arrived - pseudo function, Jetro proprietary.
 
#define MB_FUNC_ERROR   (0x80)
 Error flag for responses (ORed with function code)
 

Typedefs

typedef MbException_t(* MbVfuncStart_t) (const struct modbus_t *Mb, void *data)
 Callback specific to the protocol and called on the protocol start. More...
 
typedef MbException_t(* MbVfuncStop_t) (const struct modbus_t *Mb)
 Callback specific to the protocol and called on the protocol stop. More...
 
typedef MbException_t(* MbVfuncSend_t) (const struct modbus_t *Mb)
 Callbacks specific to the protocol and called when the driver wants to send data. More...
 
typedef MbException_t(* MbVfuncReceive_t) (const struct modbus_t *Mb)
 Callbacks specific to the protocol and called when the driver wants to receive data. More...
 
typedef MbException_t(* MbHoldingHandler_t) (const struct modbus_t *Mb, uint16_t SlaveAddr, uint16_t RegAddr, uint16_t *Value)
 Callbacks specific to the Read/Write Holding Register(s) command. They're called when Modbus command or response requires to read or write specific register. It could be both command request on the server side, or command response on the client side. More...
 
typedef MbException_t(* MbTransferFileHandler_t) (const struct modbus_t *Mb, uint16_t SlaveAddr, mb_transfer_file_t *TransferFile)
 Callback specific to the Transfer File command. It is called when Modbus command requests to write a file. More...
 
typedef MbException_t(* MbTransferFileCompletedHandler_t) (const struct modbus_t *Mb, uint16_t SlaveAddr, uint32_t PartNumber)
 Callback specific to the Transfer File Completed command. More...
 
typedef void(* MbNewFileHandler_t) (const struct modbus_t *Mb, uint8_t *FileName)
 Callback specific to the Transfer File command. It is called after a new file arrives to server or sniffer. More...
 
typedef MbException_t(* MbSessionClosed_t) (const struct modbus_t *Mb, MbException_t Error)
 Callback called on the command processing end (reporting overall success/error) More...
 

Enumerations

Functions

MbException_t MbInit (const struct modbus_t *Mb, uint8_t MbAddress)
 Initialise resources used by the protocol stack instance. More...
 
MbException_t MbClose (const struct modbus_t *Mb)
 Release resources used by the protocol stack instance. More...
 
MbException_t MbEnable (const struct modbus_t *Mb, void *Data)
 Enable the Modbus protocol stack instance. More...
 
MbException_t MbDisable (const struct modbus_t *Mb)
 Disable the Modbus protocol stack instance. More...
 
MbException_t MbReqWriteHolding (const struct modbus_t *Mb, uint8_t DestAddr, uint16_t RegAddr, uint16_t RegData, int32_t TimeOut)
 Request to write holding register. More...
 
MbException_t MbReqWriteMultiple (const struct modbus_t *Mb, uint8_t DestAddr, uint16_t RegAddr, uint16_t NRegs, uint16_t *DataBuffer, int32_t TimeOut)
 Request to write multiple holding registers. More...
 
MbException_t MbReqReadHolding (const struct modbus_t *Mb, uint8_t DestAddr, uint16_t RegAddr, uint16_t NRegs, int32_t TimeOut)
 Request to read holding registers. More...
 
MbException_t MbReqWriteFile (const struct modbus_t *Mb, uint8_t DestAddr, uint16_t FileNum, uint16_t RecNum, uint8_t *Data, uint16_t DataLen, int32_t TimeOut)
 Request to write file. More...
 
MbException_t MbReqTransferFile (const struct modbus_t *Mb, uint8_t *Targets, uint32_t FileSize, uint32_t Crc32, uint8_t *FileName, int32_t TimeOut)
 Request to transfer file header. More...
 
MbException_t MbReqTransferFileData (const struct modbus_t *Mb, uint32_t PartNumber, uint8_t PartSize, uint8_t *Data, int32_t TimeOut)
 Request to transfer file data. More...
 
MbException_t MbReqTransferFileCompleted (const struct modbus_t *Mb, uint8_t MyAddress, uint32_t PartNumber, int32_t TimeOut)
 Request to send "transfer file complete" message. More...
 

Variables

const struct MbVirtualfunc_t MbVirtualFuncRtu
 Virtual functions for the UART protocol. Included in the driver and ready to be included in modbus_t as an address of this structure.
 
const struct MbVirtualfunc_t MbVirtualFuncTcp
 Virtual functions for the standard unsecured TCP protocol (using socket API). Included in the driver and ready to be included in modbus_t as an address of this structure.
 

Detailed Description

Macro Definition Documentation

#define MB_SLAVEID_BUF_LEN   32

Number of bytes which should be allocated for the Report Slave ID command.

This module defines the Modbus driver interface for the application. It contains the basic functions and types required to use the Modbus protocol stack. A typical application will want to call MbInit() first. If the device is ready to answer network requests it must then call MbEnable() to activate the protocol stack.

Definition at line 88 of file modbus.h.

#define MB_ADDRESS_BROADCAST   ( 0 )

Modbus server addresses.

Modbus broadcast address.

Definition at line 101 of file modbus.h.

#define MB_FUNC_NONE   (0x00)

Modbus function codes.

Used as "invalid function"

Definition at line 110 of file modbus.h.

Typedef Documentation

typedef MbException_t(* MbVfuncStart_t) (const struct modbus_t *Mb, void *data)

Callback specific to the protocol and called on the protocol start.

This callback can be implemented in the application for transport layers other than UART if some special processing required and settled to the Virtualfunc member of the modbus_t structure.

Parameters
MbModbus driver instance that should be started
ErrorError code occured while command was processed
Returns
MbException_t Error code of the operation (MB_EX_NONE on success)

Definition at line 249 of file modbus.h.

typedef MbException_t(* MbVfuncStop_t) (const struct modbus_t *Mb)

Callback specific to the protocol and called on the protocol stop.

This callback can be implemented in the application for transport layers other than UART if some special processing required and settled to the Virtualfunc member of the modbus_t structure.

Parameters
MbModbus driver instance that should be stopped.
Returns
MbException_t Error code of the operation (MB_EX_NONE on success)

Definition at line 263 of file modbus.h.

typedef MbException_t(* MbVfuncSend_t) (const struct modbus_t *Mb)

Callbacks specific to the protocol and called when the driver wants to send data.

This callback must be implemented in the application for transport layers other than UART and settled to the Virtualfunc member of the modbus_t structure.

Implementation must write Mb->State->MbFrameLen bytes from the Mb->State->MbFrame pointer to the callback specific interface.

Parameters
MbModbus driver instance which called the callback
Returns
MbException_t MB_EX_NONE on success, MB_EX_PROTOCOL_ERROR on error

Definition at line 281 of file modbus.h.

typedef MbException_t(* MbVfuncReceive_t) (const struct modbus_t *Mb)

Callbacks specific to the protocol and called when the driver wants to receive data.

This callback must be implemented in the application for transport layers other than UART and settled to the Virtualfunc member of the modbus_t structure.

Implementation must read all available bytes from the callback specific interface to the Mb->State->MbFrame pointer. Mb->State->MbFrameLen must be settled to the received data length.

Parameters
MbModbus driver instance which called the callback
Returns
MbException_t MB_EX_NONE on success (even if nothing to read, MB_EX_PROTOCOL_ERROR on error.

Definition at line 301 of file modbus.h.

typedef MbException_t(* MbHoldingHandler_t) (const struct modbus_t *Mb, uint16_t SlaveAddr, uint16_t RegAddr, uint16_t *Value)

Callbacks specific to the Read/Write Holding Register(s) command. They're called when Modbus command or response requires to read or write specific register. It could be both command request on the server side, or command response on the client side.

These callbacks must be implemented in the application for Read Holding Register, Write Holding Register, Write Multiple Registers command support and settled via the FuncHandlers member of the modbus_t structure.

Implementation must read or write one register.

Parameters
MbModbus driver instance which called the callback
SlaveAddrSlave address from the Modbus request/response frame
RegAddrRegister address to read or write
ValuePointer to the value to set / buffer for output value
Returns
MbException_t MB_EX_NONE on success, MB_EX_PROTOCOL_ERROR on error.

Definition at line 323 of file modbus.h.

typedef MbException_t(* MbTransferFileHandler_t) (const struct modbus_t *Mb, uint16_t SlaveAddr, mb_transfer_file_t *TransferFile)

Callback specific to the Transfer File command. It is called when Modbus command requests to write a file.

This callback must be implemented in the application for Transfer File command support and settled via the FuncHandlers member of the modbus_t structure.

Parameters
MbModbus driver instance which called the callback
SlaveAddrSlave address from the Modbus request/response frame
TransferFileStructure with information about the file and current part
Returns
MbException_t MB_EX_NONE on success, MB_EX_PROTOCOL_ERROR on error.

Definition at line 340 of file modbus.h.

typedef MbException_t(* MbTransferFileCompletedHandler_t) (const struct modbus_t *Mb, uint16_t SlaveAddr, uint32_t PartNumber)

Callback specific to the Transfer File Completed command.

Parameters
MbModbus driver instance which called the callback
SlaveAddrSlave address from the Modbus request/response frame
PartNumberReported file part number completed
Returns
MbException_t MB_EX_NONE on success, MB_EX_PROTOCOL_ERROR on error.

Definition at line 352 of file modbus.h.

typedef void(* MbNewFileHandler_t) (const struct modbus_t *Mb, uint8_t *FileName)

Callback specific to the Transfer File command. It is called after a new file arrives to server or sniffer.

Parameters
MbModbus driver instance which called the callback
FileNameName of the new file in file system.

Definition at line 363 of file modbus.h.

typedef MbException_t(* MbSessionClosed_t) (const struct modbus_t *Mb, MbException_t Error)

Callback called on the command processing end (reporting overall success/error)

This callback should be implemented in the application and settled to the MbSessionClosedCb member of the modbus_t structure.

Parameters
MbModbus driver instance which called the callback
ErrorError code occured while command was processed
Returns
MbException_t Error code to return to the client in the Modbus reply frame (MB_EX_NONE on success)

Definition at line 379 of file modbus.h.

Enumeration Type Documentation

enum MbEvent_t

Modbus events used in ModbusServerProcess and ModbusClientProcess.

Enumerator
EV_MB_READY 

Modbus event: Startup finished.

EV_MB_FRAME_RECEIVED 

Modbus event: Frame received.

EV_MB_FRAME_SENT 

Modbus event: Frame sent.

EV_MB_SEND 

Modbus event: Request to send frame.

EV_MB_CLOSE_SESSION 

Modbus event: Data exchange ended.

EVT_MB_T35_TIMEOUT 

3.5 chars timeout expired

EV_MB_FT_CONTINUE 

Continue file transfer procedure.

Definition at line 139 of file modbus.h.

enum MbMode_t

Modbus serial transmission modes (RTU/ASCII/TCP).

Enumerator
MB_RTU 

RTU transmission mode.

MB_ASCII 

ASCII transmission mode.

MB_TCP 

TCP mode.

Definition at line 157 of file modbus.h.

enum MbRole_t

Modbus device role (MASTER/SLAVE/SNIFFER).

Enumerator
MB_SERVER 

Server (slave) role.

MB_CLIENT 

Client (master) role.

MB_SNIFFER 

Sniffer role.

Definition at line 169 of file modbus.h.

Modbus standard exception codes plus internal error codes used by all function in the protocol stack.

Enumerator
MB_EX_NONE 

no error.

MB_EX_ILLEGAL_FUNCTION 

The function code received in the query is not an allowable action for the server.

MB_EX_ILLEGAL_DATA_ADDRESS 

illegal register address.

MB_EX_ILLEGAL_DATA_VALUE 

illegal argument.

MB_EX_SERVER_DEVICE_FAILURE 

An unrecoverable error occurred while the server was attempting to perform the requested action.

MB_EX_ACKNOWLEDGE 

The server has accepted the request and is processing it, but a long duration of time will be required to do so. This response is returned to prevent a timeout error from occurring in the client.

MB_EX_SERVER_DEVICE_BUSY 

The client should retransmit the message later when the server is free.

MB_EX_MEMORY_PARITY_ERROR 

In conjunction with function codes 20 and 21: The server attempted to read record file, but detected a parity error in the memory.

MB_EX_GATEWAY_PATH_FAILED 

In conjunction with gateways: indicates that the gateway was unable to allocate an internal communication path from the input port to the output port.

MB_EX_GATEWAY_TGT_FAILED 

In conjunction with gateways: Specialized use in conjunction with gateways, indicates that no response was obtained from the target device.

MB_EX_BUSY 

ModbusLib INTERNAL exception: Master is busy (awaiting response) or UART is busy (sending/receiving data).

MB_EX_TIMEOUT 

ModbusLib INTERNAL exception: timeout error occurred.

MB_EX_ILLEGAL_STATE 

ModbusLib INTERNAL exception: protocol stack in illegal state.

MB_EX_PROTOCOL_ERROR 

ModbusLib INTERNAL exception: Communication error (unexpected or invalid frame).

MB_EX_FT_DONE 

ModbusLib INTERNAL exception: Transfer File function is done.

Definition at line 182 of file modbus.h.

enum MbState_t

Modbus driver state.

Enumerator
STATE_NOT_INITIALIZED 

Modbus instance was not initialised. Use MbInit().

STATE_DISABLED 

Modbus instance was initialised but currently disabled. Use MbEnable().

STATE_ENABLED 

Modbus instance is listening remote part and ready for transmission.

STATE_BUSY 

Modbus instance is busy with data transfer, or (for client) awaiting reply.

Definition at line 206 of file modbus.h.

Function Documentation

MbException_t MbInit ( const struct modbus_t Mb,
uint8_t  MbAddress 
)

Initialise resources used by the protocol stack instance.

This function initialises Modbus instance' state (modbus_state_t) and starts a new OS process for the instance. MbInit() does not allow to use the instance, MbEnable() call is required after initialisation in order to send/receive frames.

Note
NB: The function can be called only if the instance is not initialised (first time after reset, or after had been closed by MbClose()).
Parameters
MbModbus driver instance which called the callback
MbAddressSlave address for the instance (ignored for Client role and for TCP protocol)
Returns
MbException_t MB_EX_NONE on success, some other exception on error.
MbException_t MbClose ( const struct modbus_t Mb)

Release resources used by the protocol stack instance.

This function releases all the resources and stops the OS process for the instance.

Note
NB: The function can be called only if the instance is initialised by MbInit() and either not yet enabled by MbEnable(), or disabled by MbDisable().
Parameters
MbModbus driver instance which called the callback
Returns
MbException_t MB_EX_NONE on success, some other exception on error.
MbException_t MbEnable ( const struct modbus_t Mb,
void *  Data 
)

Enable the Modbus protocol stack instance.

This function enables processing of Modbus frames. Enabling the protocol stack is only possible if it is in the disabled state: after MbInit() or MbDisable().

Note
NB: Mb->Virtualfunc->MbStart callback is called from within this function if not NULL.
Parameters
MbModbus driver instance which called the callback
DataPointer to the transport level instance descriptor (uart_t for UART, tls_conn_t for TLS).
Returns
MbException_t MB_EX_NONE on success, some other exception on error.
MbException_t MbDisable ( const struct modbus_t Mb)

Disable the Modbus protocol stack instance.

Enabling the protocol stack is only possible if it is in the enabled state: after MbEnable().

Note
NB: Mb->Virtualfunc->MbStop callback is called from within this function if not NULL.
Parameters
MbModbus driver instance which called the callback
Returns
MbException_t MB_EX_NONE on success, some other exception on error.
MbException_t MbReqWriteHolding ( const struct modbus_t Mb,
uint8_t  DestAddr,
uint16_t  RegAddr,
uint16_t  RegData,
int32_t  TimeOut 
)

Request to write holding register.

Send Modbus command "write holding register" to the bus and set the response timer. It is impossible to send another request before the current one is finished (with success, error or timeout): in such case MB_EX_BUSY is returned. In the end of command execution the callback Mb->MbSessionClosedCb will be called with the result.

Note
NB: This function is valid for instances having Client role only.
Parameters
MbModbus driver instance which called the callback
DestAddrSlave address to send to (can be MB_ADDRESS_BROADCAST)
RegAddrRegister to write to
RegDataData to write
TimeOutCommand timeout in ms (if 0, the default for modbus_t is used).
Returns
MbException_t MB_EX_NONE on success, some other exception on error.
MbException_t MbReqWriteMultiple ( const struct modbus_t Mb,
uint8_t  DestAddr,
uint16_t  RegAddr,
uint16_t  NRegs,
uint16_t *  DataBuffer,
int32_t  TimeOut 
)

Request to write multiple holding registers.

Send Modbus command "write multiple registers" to the bus and set the response timer. It is impossible to send another request before the current one is finished (with success, error or timeout): in such case MB_EX_BUSY is returned. In the end of command execution the callback Mb->MbSessionClosedCb will be called with the result.

Note
NB: This function is valid for instances having Client role only.
Parameters
MbModbus driver instance which called the callback
DestAddrSlave address to send to (can be MB_ADDRESS_BROADCAST)
RegAddrFirst register to write to
NRegsNumber of registers to write
DataBufferPointer to the data to write (must be NRegs*2 bytes long).
TimeOutCommand timeout in ms (if 0, the default for modbus_t is used).
Returns
MbException_t MB_EX_NONE on success, some other exception on error.
MbException_t MbReqReadHolding ( const struct modbus_t Mb,
uint8_t  DestAddr,
uint16_t  RegAddr,
uint16_t  NRegs,
int32_t  TimeOut 
)

Request to read holding registers.

Send Modbus command "read holding registers" to the bus and set the response timer. It is impossible to send another request before the current one is finished (with success, error or timeout): in such case MB_EX_BUSY is returned. In the end of command execution the callback Mb->MbSessionClosedCb will be called with the result.

Note
NB: This function is valid for instances having Client role only.
Parameters
MbModbus driver instance which called the callback
DestAddrSlave address to send to
RegAddrFirst register to read from
NRegsNumber of registers to read
TimeOutCommand timeout in ms (if 0, the default for modbus_t is used).
Returns
MbException_t MB_EX_NONE on success, some other exception on error.
MbException_t MbReqWriteFile ( const struct modbus_t Mb,
uint8_t  DestAddr,
uint16_t  FileNum,
uint16_t  RecNum,
uint8_t *  Data,
uint16_t  DataLen,
int32_t  TimeOut 
)

Request to write file.

Send Modbus command "write file record" to the bus and set the response timer. It is impossible to send another request before the current one is finished (with success, error or timeout): in such case MB_EX_BUSY is returned. In the end of command execution the callback Mb->MbSessionClosedCb will be called with the result.

Note
NB: This function is valid for instances having Client role only.
Parameters
MbModbus driver instance which called the callback
DestAddrSlave address to send to (can be MB_ADDRESS_BROADCAST)
FileNumFile number to write to
RecNumRecord number to write
DataPointer to the data to write.
DataLenData length in bytes.
TimeOutCommand timeout in ms (if 0, the default for modbus_t is used).
Returns
MbException_t MB_EX_NONE on success, some other exception on error.
MbException_t MbReqTransferFile ( const struct modbus_t Mb,
uint8_t *  Targets,
uint32_t  FileSize,
uint32_t  Crc32,
uint8_t *  FileName,
int32_t  TimeOut 
)

Request to transfer file header.

Send Jetro proprietary Modbus command "transfer file" with file header information (the first PDU in file transfer procedure) to the bus and set the response timer. It is impossible to send another request before the current one is finished (with success, error or timeout): in such case MB_EX_BUSY is returned. In the end of command execution the callback Mb->MbSessionClosedCb will be called with the result.

Note
NB: This function is valid for instances having Client role only.
Parameters
MbModbus driver instance which called the callback
Targetsuint8_t[31] is actually 248 bit array of Modbus device addresses the file transfers to.
FileSizeFile size in bytes
Crc32File Crc calculated by crc32_compute() from nRF SDK from 1) file name, 2) file size (4 bytes), 3) file content.
FileNamePointer to an ASCII null-terminated string containing file name.
TimeOutCommand timeout in ms (if 0, the default for modbus_t is used).
Returns
MbException_t MB_EX_NONE on success, some other exception on error.
MbException_t MbReqTransferFileData ( const struct modbus_t Mb,
uint32_t  PartNumber,
uint8_t  PartSize,
uint8_t *  Data,
int32_t  TimeOut 
)

Request to transfer file data.

Send Jetro proprietary Modbus command "transfer file" with file data (all but the first PDU in file transfer procedure) to the bus and set the response timer. It is impossible to send another request before the current one is finished (with success, error or timeout): in such case MB_EX_BUSY is returned. In the end of command execution the callback Mb->MbSessionClosedCb will be called with the result.

Note
NB: This function is valid for instances having Client role only.
Parameters
MbModbus driver instance which called the callback
PartNumberFile part number (1-0x7FFFFFFF). Can't be 0 as 0th part transfers with MbReqTransferFileHeader() function.
Highest bit denotes last part.
PartSizePart size in bytes (247 bytes max)
DataPointer to the data to transfer.
TimeOutCommand timeout in ms (if 0, the default for modbus_t is used).
Returns
MbException_t MB_EX_NONE on success, some other exception on error.
MbException_t MbReqTransferFileCompleted ( const struct modbus_t Mb,
uint8_t  MyAddress,
uint32_t  PartNumber,
int32_t  TimeOut 
)

Request to send "transfer file complete" message.

Send Jetro proprietary Modbus command "transfer file complete" to the bus and set the response timer. It is impossible to send another request before the current one is finished (with success, error or timeout): in such case MB_EX_BUSY is returned. In the end of command execution the callback Mb->MbSessionClosedCb will be called with the result.

Note
NB: This function is valid for instances having Client role only.
Parameters
MbModbus driver instance which called the callback
MyAddressModbus own sniffer address of the device
PartNumberPart number received
TimeOutCommand timeout in ms (if 0, the default for modbus_t is used).
Returns
MbException_t MB_EX_NONE on success, some other exception on error.