1 /* 2 * Copyright (C) 2025 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_WIFI_ERRORCODE_TAIHE_H 17 #define OHOS_WIFI_ERRORCODE_TAIHE_H 18 19 #include <map> 20 #include <string> 21 #include "wifi_errcode.h" 22 23 namespace OHOS { 24 namespace Wifi { 25 static const std::int32_t SYSCAP_WIFI_CORE = 2400000; 26 static const std::int32_t SYSCAP_WIFI_STA = 2500000; 27 static const std::int32_t SYSCAP_WIFI_AP_CORE = 2600000; 28 static const std::int32_t SYSCAP_WIFI_AP_EXT = 2700000; 29 static const std::int32_t SYSCAP_WIFI_P2P = 2800000; 30 enum WifiTaiheErrCode { 31 WIFI_ERRCODE_SUCCESS = 0, /* successfully */ 32 WIFI_ERRCODE_PERMISSION_DENIED = 201, /* permission denied */ 33 WIFI_ERRCODE_NON_SYSTEMAPP = 202, /* not system app */ 34 WIFI_ERRCODE_INVALID_PARAM = 401, /* invalid params */ 35 WIFI_ERRCODE_NOT_SUPPORTED = 801, /* not supported */ 36 WIFI_ERRCODE_OPERATION_FAILED = 1000, /* failed */ 37 WIFI_ERRCODE_WIFI_NOT_OPENED = 1001, /* sta service not opened */ 38 WIFI_ERRCODE_OPEN_FAIL_WHEN_CLOSING = 1003, /* forbid when current airplane opened */ 39 WIFI_ERRCODE_CLOSE_FAIL_WHEN_OPENING = 1004, /* forbid when current powersaving opened */ 40 }; 41 42 class WifiIdlErrorCode { 43 public: 44 WifiIdlErrorCode(); 45 ~WifiIdlErrorCode(); 46 static int32_t GetErrCode(const int32_t errCodeIn, const int32_t sysCap); 47 static std::string GetErrMsg(const int32_t errCodeIn, int sysCap); 48 static void TaiheSetBusinessError(const char* funcName, 49 const int32_t errCodeIn, int sysCap); 50 51 private: 52 static std::map<int32_t, int32_t> errCodeMap_; 53 static std::map<int32_t, std::string> errMsgMap_; 54 }; 55 } // namespace Wifi 56 } // namespace OHOS 57 #endif