• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 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 #ifndef ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_CONFIGMANAGERUTIL_H
17 #define ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_CONFIGMANAGERUTIL_H
18 
19 #include <android/hardware/automotive/evs/1.1/types.h>
20 #include <system/camera_metadata.h>
21 #include <string>
22 #include <utility>
23 
24 namespace android::hardware::automotive::evs::V1_1::implementation {
25 
26 class ConfigManagerUtil {
27   public:
28     /**
29      * Convert a given string into V4L2_CID_*
30      */
31     static bool convertToEvsCameraParam(const std::string& id, CameraParam& camParam);
32     /**
33      * Convert a given string into android.hardware.graphics.common.PixelFormat
34      */
35     static bool convertToPixelFormat(const std::string& format, int32_t& pixelFormat);
36     /**
37      * Convert a given string into corresponding camera metadata data tag defined in
38      * system/media/camera/include/system/camera_metadta_tags.h
39      */
40     static bool convertToMetadataTag(const char* name, camera_metadata_tag& aTag);
41     /**
42      * Convert a given string into a floating value array
43      */
44     static float* convertFloatArray(const char* sz, const char* vals, size_t& count,
45                                     const char delimiter = ',');
46     /**
47      * Trim a string
48      */
49     static std::string trimString(const std::string& src, const std::string& ws = " \n\r\t\f\v");
50 
51     /**
52      * Convert a given string to corresponding camera capabilities
53      */
54     static bool convertToCameraCapability(
55             const char* name, camera_metadata_enum_android_request_available_capabilities_t& cap);
56 };
57 
58 }  // namespace android::hardware::automotive::evs::V1_1::implementation
59 
60 #endif  // ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_CONFIGMANAGERUTIL_H
61