'\" t .\" Title: modbus_reply_exception .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: 10/18/2014 .\" Manual: Libmodbus Manual .\" Source: libmodbus 3.0.6 .\" Language: English .\" .TH "MODBUS_REPLY_EXCEPTI" "3" "10/18/2014" "libmodbus 3\&.0\&.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 reponse .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 \fImodbus_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 \fImodbus_reply_exception()\fR 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\('ephane Raimbault <\m[blue]\fBstephane\&.raimbault@gmail\&.com\fR\m[]\&\s-2\u[1]\d\s+2> .SH "NOTES" .IP " 1." 4 stephane.raimbault@gmail.com .RS 4 \%mailto:stephane.raimbault@gmail.com .RE