Program Listing for File EmodRet.hpp

Return to documentation for file (doc/include/EmodRet.hpp)

#ifndef EMOD_RET_HPP_
#define EMOD_RET_HPP_

#include <cstdint>

/*
 * Function return status coding system
 *
 * --------------------------------------
 * | Module  | Function |  Status code  |
 * |-------------------------------------
 * |  1 Byte |  1 Byte  |   2 Bytes     |
 * --------------------------------------
 *
 * Module and Status codes are mandatories.
 *
 */

typedef int32_t EmodRet;

// System-wide return codes
static const EmodRet EmodRetOk = 0;        // SUCCESS
static const EmodRet EmodRetErr = 0xffff;  // ERROR

/* Standard errno error codes (1-133)
 * ----------------------------------
 * The <errno.h> header file defines the integer variable errno, which
 * is set by system calls and some library functions in the event of an
 * error to indicate what went wrong.
 *
 * First 133 return codes are reserved to errno codes.
 */
#ifdef __linux__
#include <asm-generic/errno-base.h>
#include <asm-generic/errno.h>
#endif

// eMOD error codes (0x1001-1fff)
// ----------------------------
static const EmodRet EmodRetErrWriteBus = 0x1001;           // Cannot write frame into eMod bus
static const EmodRet EmodRetErrNoDataReceived = 0x1002;     // No module data received
static const EmodRet EmodRetErrWrongdataReceived = 0x1003;  // Wrong data received
static const EmodRet EmodRetErrNotAck = 0x1004;             // Command that requires acknowledgement, has not been acked
static const EmodRet EmodRetErrSendConfig = 0x1005;         // Configuration could not be sent to module
static const EmodRet EmodRetErrRecvConfig = 0x1006;         // Configuration could not be retrieved from module
static const EmodRet EmodRetErrModuleNotFound = 0x1007;     // Module not found
static const EmodRet EmodRetErrNoModulesFound = 0x1008;     // None of the modules have been found
static const EmodRet EmodRetErrValueOutOfRange = 0x1009;    // Array index or parameter out of range
static const EmodRet EmodRetErrConfigMismatch = 0x100a;     // Config is not possible due to incoherent variables or types
static const EmodRet EmodRetErrReadFileError = 0x100b;      // Error reading from file
static const EmodRet EmodRetErrWriteFileError = 0x100c;     // Error writing to file
static const EmodRet EmodRetErrSendBuffer = 0x100d;         // Error trying to send buffer over the module
static const EmodRet EmodRetErrInputConfig = 0x100e;        // Wrongly configured input.
static const EmodRet EmodRetErrOldFirmware = 0x100f;        // Old module firmware detected.

// eMOD warning codes (0x2001-0x2fff)
// ------------------------------
static const EmodRet EmodRetWrnPollingNotApply = 0x2001;  // Callback is enabled. Polling does not apply
static const EmodRet EmodRetWrnBadInputParam = 0x2002;    // The value of the parameter passed to the function is incorrect

// eMOD information codes (0x3001-0x3fff)
// ----------------------------------

#endif /* EMOD_RET_HPP_ */