1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 19 #include <aidl/android/hardware/automotive/evs/CameraParam.h> 20 #include <aidl/android/hardware/graphics/common/PixelFormat.h> 21 #include <android-base/macros.h> 22 #include <system/camera_metadata.h> 23 24 #include <string> 25 #include <utility> 26 27 class ConfigManagerUtil final { 28 public: 29 /** 30 * Convert a given string into V4L2_CID_* 31 */ 32 static bool convertToEvsCameraParam( 33 const std::string& id, 34 ::aidl::android::hardware::automotive::evs::CameraParam& camParam); 35 /** 36 * Convert a given string into android.hardware.graphics.common.PixelFormat 37 */ 38 static bool convertToPixelFormat(const std::string& in, 39 ::aidl::android::hardware::graphics::common::PixelFormat& out); 40 /** 41 * Convert a given string into corresponding camera metadata data tag defined in 42 * system/media/camera/include/system/camera_metadata_tags.h 43 */ 44 static bool convertToMetadataTag(const char* name, camera_metadata_tag& aTag); 45 /** 46 * Convert a given string into a floating value array 47 */ 48 static float* convertFloatArray(const char* sz, const char* vals, size_t& count, 49 const char delimiter = ','); 50 /** 51 * Trim a string 52 */ 53 static std::string trimString(const std::string& src, const std::string& ws = " \n\r\t\f\v"); 54 55 /** 56 * Convert a given string to corresponding camera capabilities 57 */ 58 static bool convertToCameraCapability( 59 const char* name, camera_metadata_enum_android_request_available_capabilities_t& cap); 60 61 DISALLOW_IMPLICIT_CONSTRUCTORS(ConfigManagerUtil); 62 }; 63