1 /* 2 * Copyright (C) 2023 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_RIL_TEST_UTIL_H 17 #define OHOS_RIL_TEST_UTIL_H 18 19 #include "ril_callback_test.h" 20 #include "telephony_log_wrapper.h" 21 22 namespace OHOS { 23 namespace Telephony { 24 using namespace OHOS::HDI::Ril::V1_3; 25 inline const int32_t BANDWIDTH_HYSTERESIS_MS = 3000; 26 inline const int32_t BANDWIDTH_HYSTERESIS_KBPS = 50; 27 inline const int32_t MAX_UPLINK_LINK_BANDWIDTH[] = { 100, 500, 1000, 5000, 10000, 20000, 50000, 100000, 200000 }; 28 inline const int32_t MAX_DOWNLINK_LINK_BANDWIDTH[] = { 100, // VoIP 29 500, // Web 30 1000, // SD 31 5000, // HD 32 10000, // file 33 20000, // 4K 34 50000, // LTE 35 100000, 36 200000, // 5G 37 500000, 1000000 }; 38 inline const int32_t SYSPARA_SIZE = 128; 39 inline const int32_t SIM_AUTH_EAP_AKA_TYPE = 129; 40 inline const int32_t NR_OPTION_NSA_ONLY = 1; 41 42 class RilTestUtil { 43 public: 44 static void WaitFor(int32_t timeoutSecond); 45 static bool GetBoolResult(HdiId hdiId_); 46 static int32_t GetSerialId(); 47 static bool IsValidSlotId(int32_t slotId); 48 static bool HasVoiceCapability(); 49 static bool IsReady(int32_t slotId); 50 static RilTestUtil &GetInstance(); 51 static sptr<OHOS::HDI::Ril::V1_3::IRil> GetRilInterface(); 52 static sptr<RilCallbackTest> GetCallback(); 53 void Init(); 54 55 private: 56 void WaitForInner(int32_t timeoutSecond); 57 bool GetBoolResultInner(HdiId hdiId_); 58 bool IsValidSlotIdInner(int32_t slotId); 59 bool HasVoiceCapabilityInner(); 60 int32_t GetSerialIdInner(); 61 bool IsReadyInner(int32_t slotId); 62 int32_t GetMaxSimCount(); 63 64 private: 65 int slotCount_; 66 bool hasVoiceCapable_ = true; 67 sptr<OHOS::HDI::Ril::V1_3::IRil> rilInterface_ = nullptr; 68 sptr<RilCallbackTest> callback_; 69 bool isInit_ = false; 70 static RilTestUtil rilTestUtil_; 71 }; 72 73 } // namespace Telephony 74 } // namespace OHOS 75 #endif // OHOS_RIL_TEST_UTIL_H 76