1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_ROSEN_COLOR_MANAGER_COMMON_H 17 #define OHOS_ROSEN_COLOR_MANAGER_COMMON_H 18 19 #include <cstdint> 20 21 namespace OHOS { 22 namespace ColorManager { 23 enum class CMError : int32_t { 24 CM_OK = 0, 25 CM_ERROR_NULLPTR, 26 CM_ERROR_INVALID_PARAM, 27 CM_ERROR_INVALID_ENUM_USAGE, 28 }; 29 30 enum class CMErrorCode : int32_t { 31 CM_OK = 0, 32 CM_ERROR_NO_PERMISSION = 201, // the value do not change. It is defined on all system 33 CM_ERROR_INVALID_PARAM = 401, // the value do not change. It is defined on all system 34 CM_ERROR_DEVICE_NOT_SUPPORT = 801, // the value do not change. It is defined on all system 35 CM_ERROR_ABNORMAL_PARAM_VALUE = 18600001, // the value do not change. It is defined on color manager system 36 }; 37 38 const std::map<CMError, CMErrorCode> JS_TO_ERROR_CODE_MAP { 39 { CMError::CM_OK, CMErrorCode::CM_OK }, 40 { CMError::CM_ERROR_NULLPTR, CMErrorCode::CM_ERROR_INVALID_PARAM }, 41 { CMError::CM_ERROR_INVALID_PARAM, CMErrorCode::CM_ERROR_INVALID_PARAM }, 42 { CMError::CM_ERROR_INVALID_ENUM_USAGE, CMErrorCode::CM_ERROR_ABNORMAL_PARAM_VALUE }, 43 }; 44 } // namespace ColorManager 45 } // namespace OHOS 46 47 #endif // OHOS_ROSEN_COLOR_MANAGER_COMMON_H