/*! * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file DeviceError.h * \author (last) Behrouz NematiPour * \date (last) 03-Jun-2021 * \author (original) Behrouz NematiPour * \date (original) 03-Jun-2020 * */ #pragma once // Qt #include // Project // Define // forward declarations namespace Device { /*! * \brief The DeviceError class * \details This class contains the device script errors and its message mapping * */ class DeviceError { Q_GADGET static const char *Scripts_Error_Text[]; public: enum Scripts_Error_Enum { eDevice_OK = 0 , // The scripts can use the exit code of each commands they execute and the assumption is most of Linux commands exit codes are less than 1000. // so any error less that 1000 will be identified as device error eDevice_Scripts_Error_Start = 1000 , // the script itself in system starts from 0 so give it enough gap eDevice_Scripts_Error_Status , eDevice_Scripts_Error_NotFound , eDevice_Scripts_Error_NotExecutable , eDevice_Scripts_Error_IsRunning , eDevice_Scripts_Error_OutOfRange , eDevice_Scripts_Error_Incorrect_Req , eDevice_Scripts_Error_Incorrect_Rsp , eDevice_Watch_Error_NotFound , eDevice_Watch_Error_NotAdded , eDevice_BCuff_Error_Reset , eDevice_BCuff_Error_Query , eDevice_BCuff_Error_Query_Empty , eDevice_BCuff_Error_Query_Addr , eDevice_Error_End }; Q_ENUM(Scripts_Error_Enum) static QString deviceErrorText( DeviceError::Scripts_Error_Enum vError , int vExitCode ); static Scripts_Error_Enum checkScript(QString &vScript, const QString &vShellScript); }; }