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 DISPLAY_DUMP_VDI_H 17 #define DISPLAY_DUMP_VDI_H 18 19 #include <securec.h> 20 #include <stdio.h> 21 #include <thread> 22 #include <mutex> 23 #include <condition_variable> 24 #include "hdf_sbuf.h" 25 #include "devhost_dump_reg.h" 26 #include "display_log.h" 27 #include "idisplay_composer_vdi_v1_1.h" 28 29 namespace OHOS { 30 namespace HDI { 31 namespace Display { 32 namespace Composer { 33 namespace V1_0 { 34 35 using namespace OHOS::HDI::Display::Composer::V1_0; 36 37 using GetDumpInfoFunc = int32_t (*)(std::string& result); 38 using UpdateConfigFunc = int32_t (*)(std::string& result); 39 extern "C" int32_t GetDumpInfo(std::string& result); 40 extern "C" int32_t UpdateConfig(std::string& result); 41 42 class VdiDumper { 43 public: ~VdiDumper()44 ~VdiDumper() {}; 45 int32_t ShowDumpMenu(struct HdfSBuf *reply); 46 int32_t ComposerHostDumpProcess(struct HdfSBuf *data, struct HdfSBuf *reply, uint32_t argsNum); 47 void SetDumpInfoFunc(GetDumpInfoFunc DumpInfoFunc_); 48 void SetConfigFunc(UpdateConfigFunc ConfigFunc_); GetInstance()49 static VdiDumper& GetInstance() 50 { 51 static VdiDumper instance_; 52 return instance_; 53 } 54 55 private: VdiDumper()56 VdiDumper() : getDumpInfoFunc_(nullptr), updateConfigFunc_(nullptr) {}; 57 int32_t DumpBuffer(HdfSBuf *reply); 58 int32_t UpdateUserConfig(HdfSBuf *reply); 59 private: 60 GetDumpInfoFunc getDumpInfoFunc_; 61 UpdateConfigFunc updateConfigFunc_; 62 }; 63 64 } //namespace V1_0 65 } //namespace Composer 66 } //namespace Display 67 } //namespace HDI 68 } //namespace OHOS 69 #endif