1## -*- coding: utf-8 -*- 2/* 3 * Copyright (C) ${copyright_year()} The Android Open Source Project 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18/** 19 * ! Do not edit this file directly ! 20 * 21 * Generated automatically from camera_metadata_asserts.mako 22 */ 23<% 24def annotated_enum_type(entry): 25 if entry.type == 'int64' and entry.container == 'array': 26 type = 'int64_t' 27 else: 28 type = 'int32_t' 29 return type 30 31def aidl_namespace(path): 32 return "::aidl::android::hardware::camera::metadata::" + path 33 34def aidl_camera_metadata_section(id): 35 return aidl_namespace("CameraMetadataSection::" + id) 36 37def aidl_camera_metadata_section_start(id): 38 return aidl_namespace("CameraMetadataSectionStart::" + id) 39 40def aidl_camera_metadata_tag(id): 41 return aidl_namespace("CameraMetadataTag::" + id) 42 43def aidl_enum_name(entry): 44 enum_name = entry.name.removeprefix("android.") 45 s = enum_name.split(".") 46 s = [x[0].capitalize() + x[1:] for x in s] 47 return ''.join(s) 48%> 49#include <aidl/android/hardware/camera/metadata/CameraMetadataSection.h> 50#include <aidl/android/hardware/camera/metadata/CameraMetadataSectionStart.h> 51#include <aidl/android/hardware/camera/metadata/CameraMetadataTag.h> 52% for sec in find_all_sections_filtered(metadata, ('extension')): 53 % for entry in remove_hal_non_visible(find_unique_entries(sec)): 54 % if entry.enum: 55#include <aidl/android/hardware/camera/metadata/${aidl_enum_name(entry)}.h> 56 % endif 57 % endfor 58% endfor 59 60#include <system/camera_metadata_tags.h> 61 62% for sec in find_all_sections_filtered(metadata, ('extension')): 63static_assert(static_cast<int>(${path_name(sec) | csym}) 64 == static_cast<int>(${aidl_camera_metadata_section(csym(path_name(sec)))})); 65% endfor 66static_assert(static_cast<int>(VENDOR_SECTION) 67 == static_cast<int>(${aidl_camera_metadata_section("VENDOR_SECTION")})); 68 69% for sec in find_all_sections_filtered(metadata, ('extension')): 70static_assert(static_cast<int>(${path_name(sec) + '.start' | csym}) 71 == static_cast<int>(${aidl_camera_metadata_section_start(csym(path_name(sec) + '.start'))})); 72% endfor 73static_assert(static_cast<int>(VENDOR_SECTION_START) 74 == static_cast<int>(${aidl_camera_metadata_section_start("VENDOR_SECTION_START")})); 75 76% for sec in find_all_sections_filtered(metadata, ('extension')): 77 % for idx,entry in enumerate(remove_hal_non_visible(find_unique_entries(sec))): 78static_assert(static_cast<int>(${csym(entry.name)}) 79 == static_cast<int>(${aidl_camera_metadata_tag(csym(entry.name))})); 80 % endfor 81% endfor 82% for sec in find_all_sections_filtered(metadata, ('extension')): 83 % for entry in remove_hal_non_visible(find_unique_entries(sec)): 84 % if entry.enum: 85 86 % for val in aidl_enum_values(entry): 87static_assert(static_cast<${annotated_enum_type(entry)}>(${csym(entry.name)}_${val.name}) 88 == static_cast<${annotated_enum_type(entry)}>(${aidl_namespace(aidl_enum_name(entry) + "::" + aidl_enum_value_name(csym(entry.name) + "_" + val.name))})); 89 % endfor 90 % endif 91 % endfor 92% endfor