1 /* 2 * Copyright (C) 2021 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 #include "cellular_call_dump_helper.h" 17 #include "cellular_call_service.h" 18 #include "module_service_utils.h" 19 #include "standardize_utils.h" 20 21 namespace OHOS { 22 namespace Telephony { Dump(const std::vector<std::string> & args,std::string & result) const23bool CellularCallDumpHelper::Dump(const std::vector<std::string> &args, std::string &result) const 24 { 25 result.clear(); 26 bool retRes = true; 27 ShowHelp(result); 28 ShowCellularCallInfo(result); 29 return retRes; 30 } 31 ShowHelp(std::string & result) const32void CellularCallDumpHelper::ShowHelp(std::string &result) const 33 { 34 result.append("------------------------------------------------------------------\n"); 35 result.append("Usage : dump <command> [options]\n") 36 .append("Description :\n") 37 .append(" -cellular_call_info : ") 38 .append("dump all cellular_call information in the system\n"); 39 } 40 ShowCellularCallInfo(std::string & result) const41void CellularCallDumpHelper::ShowCellularCallInfo(std::string &result) const 42 { 43 int32_t slotId = DEFAULT_SIM_SLOT_ID; 44 result.append("\n*******************CellularCallInfo*********************\n"); 45 result.append("SlotId : ").append(std::to_string(slotId)).append("\n"); 46 result.append("CellularCallBindTime : ") 47 .append(DelayedSingleton<CellularCallService>::GetInstance()->GetBindTime()) 48 .append("\n"); 49 result.append("CellularCallEndTime : ") 50 .append(DelayedSingleton<CellularCallService>::GetInstance()->GetEndTime()) 51 .append("\n"); 52 result.append("CellularCallSpendTime : ") 53 .append(DelayedSingleton<CellularCallService>::GetInstance()->GetSpendTime()) 54 .append("\n"); 55 } 56 } // namespace Telephony 57 } // namespace OHOS