Index: sources/device/DeviceError.h =================================================================== diff -u -rf38edd22f7b63694c21b83d6f4b69ea618390126 -r6c6f1f5d466badd9b4fd67be7c907234c342b2a2 --- sources/device/DeviceError.h (.../DeviceError.h) (revision f38edd22f7b63694c21b83d6f4b69ea618390126) +++ sources/device/DeviceError.h (.../DeviceError.h) (revision 6c6f1f5d466badd9b4fd67be7c907234c342b2a2) @@ -1,15 +1,15 @@ /*! * - * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * Copyright (c) 2021-2023 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 + * \date (last) 23-Feb-2022 * \author (original) Behrouz NematiPour - * \date (original) 03-Jun-2020 + * \date (original) 06-Jun-2021 * */ #pragma once @@ -38,34 +38,41 @@ public: enum Scripts_Error_Enum { - eScripts_OK = 0 , + eDevice_OK = 0 , - eScripts_Error_Start = 1000 , // the script itself in system starts from 0 so give it enough gap + // 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_Unknown = 1000, - eScripts_Error_NotFound , - eScripts_Error_NotExecutable, - eScripts_Error_IsRunning , - eScripts_Error_OutOfRange , - eScripts_Error_Incorrect_Req, - eScripts_Error_Incorrect_Rsp, + 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 , - eScripts_Error_End + 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_CryptSetup_Error , + eDevice_FactoryReset_Error , + eDevice_Decommission_Error , + eDevice_USBMount_Error , + + eDevice_Error_End + }; Q_ENUM(Scripts_Error_Enum) - static QString scriptErrorText( DeviceError::Scripts_Error_Enum vError ) { - QString message; - if (eScripts_Error_Start < vError && vError < eScripts_Error_End) { - message += QObject::tr(Scripts_Error_Text[vError - eScripts_Error_Start - 1]); - } - else { - message += QObject::tr("Device error"); - } - return message; - } - + static QString deviceErrorText( DeviceError::Scripts_Error_Enum vError , int vExitCode ); static Scripts_Error_Enum checkScript(QString &vScript, const QString &vShellScript); - }; }