blob: 30d3940b710b507ba867aec7f8abde367b6b2963 [file] [log] [blame]
Eino-Ville Talvalad4e240a2013-08-08 12:56:37 -07001## -*- coding: utf-8 -*-
2##
3## Copyright (C) 2013 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## This section of enum integer definitions is inserted into
19## android.hardware.camera2.CameraMetadata.
20 /*@O~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~
21 * The enum values below this point are generated from metadata
22 * definitions in /system/media/camera/docs. Do not modify by hand or
23 * modify the comment blocks at the start or end.
24 *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~*/
25##
26## Generate an enum's integers
27<%def name="generate_enum(entry, target_class)">\
28 //
29 // Enumeration values for ${target_class}#${entry.name | jkey_identifier}
30 //
31
32 % for value in entry.enum.values:
33 /**
34 % if value.notes:
Eino-Ville Talvala63c0fb22014-01-02 16:11:44 -080035${value.notes | javadoc(metadata)}\
Eino-Ville Talvalad4e240a2013-08-08 12:56:37 -070036 % endif
Eino-Ville Talvala0d404952017-11-10 15:13:04 -080037 % if value.sdk_notes:
38${value.sdk_notes | javadoc(metadata)}\
39 % endif
Eino-Ville Talvalad4e240a2013-08-08 12:56:37 -070040 * @see ${target_class}#${entry.name | jkey_identifier}
Yin-Chia Yehc6c24162016-04-02 16:30:30 -070041 % if entry.applied_visibility in ('hidden', 'ndk_public') or value.hidden:
Eino-Ville Talvalad4e240a2013-08-08 12:56:37 -070042 * @hide
43 %endif
Zhijun He7defc682015-05-22 17:04:15 -070044 % if value.deprecated:
45 * @deprecated Please refer to this API documentation to find the alternatives
46 % endif
Eino-Ville Talvalad4e240a2013-08-08 12:56:37 -070047 */
Yin-Chia Yeh77f5ad42017-08-03 18:31:15 -070048 % if value.deprecated:
49 @Deprecated
50 % endif
Eino-Ville Talvalad4e240a2013-08-08 12:56:37 -070051 public static final int ${jenum_value(entry, value)} = ${enum_calculate_value_string(value)};
52
53 % endfor
54</%def>\
55##
56## Generate a list of only Static, Controls, or Dynamic properties.
57<%def name="single_kind_keys(xml_name, target_class)">\
58% for outer_namespace in metadata.outer_namespaces: ## assumes single 'android' namespace
59 % for section in outer_namespace.sections:
60 % if section.find_first(lambda x: isinstance(x, metadata_model.Entry) and x.kind == xml_name) and \
Yin-Chia Yehc6c24162016-04-02 16:30:30 -070061 any_visible(section, xml_name, ('public','hidden', 'ndk_public', 'java_public') ):
Eino-Ville Talvalad4e240a2013-08-08 12:56:37 -070062 % for inner_namespace in get_children_by_filtering_kind(section, xml_name, 'namespaces'):
63## We only support 1 level of inner namespace, i.e. android.a.b and android.a.b.c works, but not android.a.b.c.d
64## If we need to support more, we should use a recursive function here instead.. but the indentation gets trickier.
Yin-Chia Yehc6c24162016-04-02 16:30:30 -070065 % for entry in filter_visibility(inner_namespace.entries, ('hidden','public', 'ndk_public', 'java_public')):
Eino-Ville Talvalad4e240a2013-08-08 12:56:37 -070066 % if entry.enum \
67 and not (entry.typedef and entry.typedef.languages.get('java')) \
68 and not entry.is_clone():
69${generate_enum(entry, target_class)}\
70 % endif
71 % endfor
72 % endfor
73 % for entry in filter_visibility( \
74 get_children_by_filtering_kind(section, xml_name, 'entries'), \
Yin-Chia Yehc6c24162016-04-02 16:30:30 -070075 ('hidden', 'public', 'ndk_public', 'java_public')):
Eino-Ville Talvalad4e240a2013-08-08 12:56:37 -070076 % if entry.enum \
77 and not (entry.typedef and entry.typedef.languages.get('java')) \
78 and not entry.is_clone():
79${generate_enum(entry, target_class)}\
80 % endif
81 % endfor
82 % endif
83 % endfor
84% endfor
85</%def>\
86
87##
88## Static properties only
Igor Murashkin21d0f1a2013-09-10 12:25:56 -070089${single_kind_keys('static','CameraCharacteristics')}\
Eino-Ville Talvalad4e240a2013-08-08 12:56:37 -070090##
91## Controls properties only
92${single_kind_keys('controls','CaptureRequest')}\
93##
94## Dynamic properties only
95${single_kind_keys('dynamic','CaptureResult')}\
96 /*~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~
97 * End generated code
98 *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~O@*/