'\" t .\" Title: modbus_reply_exception .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: 10/15/2022 .\" Manual: libmodbus Manual .\" Source: libmodbus v3.1.6 .\" Language: English .\" .TH "MODBUS_REPLY_EXCEPTI" "3" "10/15/2022" "libmodbus v3\&.1\&.6" "libmodbus Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" modbus_reply_exception \- send an exception response .SH "SYNOPSIS" .sp *int modbus_reply_exception(modbus_t *\fIctx\fR, const uint8_t *\fIreq\fR, unsigned int \fIexception_code\fR); .SH "DESCRIPTION" .sp The \fBmodbus_reply_exception()\fR function shall send an exception response based on the \fIexception_code\fR in argument\&. .sp The libmodbus provides the following exception codes: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} MODBUS_EXCEPTION_ILLEGAL_FUNCTION (1) .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS (2) .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE (3) .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} MODBUS_EXCEPTION_SLAVE_OR_SERVER_FAILURE (4) .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} MODBUS_EXCEPTION_ACKNOWLEDGE (5) .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} MODBUS_EXCEPTION_SLAVE_OR_SERVER_BUSY (6) .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} MODBUS_EXCEPTION_NEGATIVE_ACKNOWLEDGE (7) .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} MODBUS_EXCEPTION_MEMORY_PARITY (8) .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} MODBUS_EXCEPTION_NOT_DEFINED (9) .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} MODBUS_EXCEPTION_GATEWAY_PATH (10) .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} MODBUS_EXCEPTION_GATEWAY_TARGET (11) .RE .sp The initial request \fIreq\fR is required to build a valid response\&. .SH "RETURN VALUE" .sp The function shall return the length of the response sent if successful\&. Otherwise it shall return \-1 and set errno\&. .SH "ERRORS" .PP \fBEINVAL\fR .RS 4 The exception code is invalid .RE .SH "SEE ALSO" .sp \fBmodbus_reply\fR(3) \fBlibmodbus\fR(7) .SH "AUTHORS" .sp The libmodbus documentation was written by Stéphane Raimbault