1 /* 2 * Copyright (c) 2024 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 SENSOR_HDI_DUMP_H 17 #define SENSOR_HDI_DUMP_H 18 #include <vector> 19 #include "hdf_sbuf.h" 20 #include "devhost_dump_reg.h" 21 #include "sensor_type.h" 22 #include "sensor_if_service.h" 23 24 namespace OHOS { 25 namespace HDI { 26 namespace Sensor { 27 namespace V2_0 { 28 enum { 29 MEM_X = 1, 30 MEM_XY = 3, 31 MEM_XYZ = 4, 32 MEM_UNCALIBRATED = 6, 33 MEM_POSTURE = 8, 34 MEM_SPE_RGB = 14, 35 MEM_MAX_DATA_SIZE = MEM_SPE_RGB 36 }; 37 38 class SensorHdiDump { 39 public: 40 SensorHdiDump(); 41 ~SensorHdiDump(); 42 static int32_t DevHostSensorHdiDump(struct HdfSBuf *data, struct HdfSBuf *reply); 43 44 private: 45 static int32_t SensorShowList(struct HdfSBuf *reply); 46 static std::string SensorInfoDataToString(const float *data, 47 const int64_t timesTamp, 48 const int32_t dataDimension, 49 const int32_t sensorId); 50 static int32_t ShowData(const float *data, 51 const int64_t timesTamp, 52 const int32_t dataDimension, 53 const int32_t sensorId, 54 struct HdfSBuf *reply); 55 static int32_t SensorShowData(struct HdfSBuf *reply); 56 static int32_t SensorShowClient(struct HdfSBuf *reply); 57 }; 58 59 int32_t GetSensorDump(struct HdfSBuf *data, struct HdfSBuf *reply); 60 61 } // V2_0 62 } // Sensor 63 } // HDI 64 } // OHOS 65 66 #endif //SENSOR_HDI_DUMP_H