• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  def annotated_type(entry):
19    if entry.enum:
20       type = 'enum'
21    else:
22       type = entry.type
23    if entry.container == 'array':
24       type += '[]'
25
26    return type
27
28  def annotated_enum_type(entry):
29    if entry.type == 'int64' and entry.container == 'array':
30       type = 'long'
31    else:
32       type = 'int'
33
34    return type
35
36  def val_id_to_literal(entry, id):
37    if entry.type == 'int64' and entry.container == 'array':
38      return "%sL" % id
39    else:
40      return id
41%>\
42
43/*
44 * Autogenerated from camera metadata definitions in
45 * /system/media/camera/docs/metadata_definitions.xml
46 * *** DO NOT EDIT BY HAND ***
47 */
48
49package android.hardware.camera.metadata;
50<%
51  _entry = None
52  _enum_name = None
53  for sec in find_all_sections(metadata):
54    for entry in remove_hal_non_visible(find_unique_entries(sec)):
55      if entry.name == enum():
56        _entry = entry
57        _enum_name = entry.name.removeprefix("android.")
58        s = _enum_name.split(".")
59        s = [x[0].capitalize() + x[1:] for x in s]
60        _enum_name = ''.join(s)
61%>\
62
63/**
64 * ${_entry.name} enumeration values
65 * @see ${_entry.name | csym}
66 * See system/media/camera/docs/metadata_definitions.xml for details.
67 */
68@VintfStability
69@Backing(type="${annotated_enum_type(_entry)}")
70enum ${_enum_name} {
71  % for val in aidl_enum_values(_entry):
72    % if val.id is None:
73    ${aidl_enum_value_name('%s_%s'%(csym(_entry.name), val.name))},
74    % else:
75    ${aidl_enum_value_name('%s_%s'%(csym(_entry.name), val.name))} = ${val_id_to_literal(_entry, val.id)},
76    % endif
77  % endfor
78}
79