1<?xml version="1.0" encoding="UTF-8"?>
2<!-- Copyright (C) 2012 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<schema xmlns="http://www.w3.org/2001/XMLSchema"
17    xmlns:tns="http://schemas.android.com/service/camera/metadata/"
18    targetNamespace="http://schemas.android.com/service/camera/metadata/"
19    elementFormDefault="qualified">
20
21    <element name="metadata" type="tns:MetadataType">
22        <key name="TypeNameKey">
23            <selector xpath="tns:types/tns:typedef" />
24            <field xpath="@name" />
25        </key>
26
27        <!-- ensure that <entry typedef="..."> refers to a valid <typedef name='..."/> -->
28        <keyref name="TypeNameKeyRef" refer="tns:TypeNameKey">
29            <selector xpath=".//tns:entry" /> <!-- recursively find any descendant entry -->
30            <field xpath="@typedef" />
31        </keyref>
32    </element>
33
34    <complexType name="MetadataType">
35        <sequence>
36            <element name="tags" type="tns:TagsType" maxOccurs="1" minOccurs="0"></element>
37            <element name="types" type="tns:TypesType" maxOccurs="1" minOccurs="0"></element>
38            <element name="namespace" type="tns:NamespaceType"
39                maxOccurs="unbounded" minOccurs="1">
40            </element>
41        </sequence>
42    </complexType>
43
44    <complexType name="NamespaceType">
45        <sequence>
46            <element name="section" type="tns:SectionType" maxOccurs="unbounded" minOccurs="1"></element>
47        </sequence>
48        <attribute name="name" type="string" use="required"></attribute>
49    </complexType>
50
51    <complexType name="SectionType">
52        <sequence>
53            <choice maxOccurs="unbounded">
54                <element name="controls" type="tns:SectionKindType" maxOccurs="unbounded" minOccurs="0"></element>
55                <element name="static" type="tns:SectionKindType" maxOccurs="unbounded" minOccurs="0"></element>
56                <element name="dynamic" type="tns:SectionKindType" maxOccurs="unbounded" minOccurs="0"></element>
57            </choice>
58        </sequence>
59        <attribute name="name" type="string" use="required"></attribute>
60    </complexType>
61
62    <complexType name="SectionKindType">
63        <complexContent>
64            <extension base="tns:BaseNamespaceOrSectionKindType">
65            </extension>
66        </complexContent>
67    </complexType>
68
69    <complexType name="InnerNamespaceType">
70        <complexContent>
71            <extension base="tns:BaseNamespaceOrSectionKindType">
72                <attribute name="name" type="string" use="required"></attribute>
73            </extension>
74        </complexContent>
75    </complexType>
76
77    <complexType name="BaseNamespaceOrSectionKindType">
78        <sequence maxOccurs="unbounded">
79            <choice>
80                <element name="namespace" type="tns:InnerNamespaceType"></element>
81                <element name="entry" type="tns:EntryType"></element>
82                <element name="clone" type="tns:CloneType"></element>
83            </choice>
84        </sequence>
85    </complexType>
86
87    <complexType name="TagsType">
88        <sequence>
89            <element name="tag" type="tns:TagType" maxOccurs="unbounded" minOccurs="0"></element>
90        </sequence>
91    </complexType>
92
93    <complexType name="TagType">
94        <simpleContent>
95            <extension base="string">
96                <attribute name="id" type="string" use="required"></attribute>
97            </extension>
98        </simpleContent>
99    </complexType>
100
101    <complexType name="TypesType">
102        <sequence>
103            <element name="typedef" type="tns:TypedefType" maxOccurs="unbounded" minOccurs="0">
104            </element>
105        </sequence>
106    </complexType>
107
108    <complexType name="TypedefType">
109        <sequence>
110            <element name="language" type="tns:LanguageType" maxOccurs="unbounded" minOccurs="1"></element>
111        </sequence>
112        <attribute name="name" type="string" use="required" />
113    </complexType>
114
115    <complexType name="LanguageType">
116        <simpleContent>
117            <extension base="string">
118                <attribute name="name" use="required">
119                    <simpleType>
120                        <restriction base="string">
121                            <enumeration value="java" />
122                            <enumeration value="c" />
123                            <enumeration value="c++" />
124                        </restriction>
125                    </simpleType>
126                </attribute>
127            </extension>
128        </simpleContent>
129    </complexType>
130
131    <group name="BaseEntryGroup">
132        <sequence>
133            <element name="description" type="string" maxOccurs="1"
134                minOccurs="0">
135            </element>
136            <element name="units" type="string" maxOccurs="1"
137                minOccurs="0">
138            </element>
139            <element name="range" type="string" maxOccurs="1"
140                minOccurs="0">
141            </element>
142            <element name="details" type="string" maxOccurs="1"
143                minOccurs="0">
144            </element>
145            <element name="hal_details" type="string" maxOccurs="1"
146                minOccurs="0">
147            </element>
148
149            <element name="tag" type="tns:TagType" maxOccurs="unbounded"
150                minOccurs="0">
151            </element>
152        </sequence>
153    </group>
154
155    <complexType name="EntryType">
156        <sequence>
157            <element name="array" type="tns:ArrayType" maxOccurs="1" minOccurs="0"></element>
158            <element name="enum" type="tns:EnumType" maxOccurs="1" minOccurs="0"></element>
159            <element name="tuple" type="tns:TupleType" maxOccurs="1" minOccurs="0"></element>
160
161            <group ref="tns:BaseEntryGroup" />
162        </sequence>
163
164        <attribute name="name" type="string" use="required" />
165        <attribute name="type" use="required">
166            <simpleType>
167                <restriction base="string">
168                    <enumeration value="byte" />
169                    <enumeration value="int32" />
170                    <enumeration value="int64" />
171                    <enumeration value="float" />
172                    <enumeration value="double" />
173                    <enumeration value="rational" />
174                </restriction>
175            </simpleType>
176        </attribute>
177        <attribute name="type_notes" type="string" />
178        <attribute name="container">
179            <simpleType>
180                <restriction base="string">
181                    <enumeration value="array" />
182                    <enumeration value="tuple" />
183                </restriction>
184            </simpleType>
185        </attribute>
186        <attribute name="enum">
187            <simpleType>
188                <restriction base="string">
189                    <enumeration value="true"></enumeration>
190                    <enumeration value="false"></enumeration>
191                </restriction>
192            </simpleType>
193        </attribute>
194        <attribute name="visibility">
195            <simpleType>
196                <restriction base="string">
197                    <enumeration value="system" /> <!-- do not expose to java -->
198                    <enumeration value="hidden" /> <!-- java as @hide -->
199                    <enumeration value="public" /> <!-- java as public SDK -->
200                </restriction>
201            </simpleType>
202        </attribute>
203        <attribute name="synthetic" default="false">
204            <simpleType>
205                <restriction base="string">
206                    <enumeration value="false" /> <!-- expose to C -->
207                    <enumeration value="true" /> <!-- do not expose to C -->
208                </restriction>
209            </simpleType>
210        </attribute>
211        <attribute name="deprecated" default="false">
212            <simpleType>
213                <restriction base="string">
214                    <enumeration value="false" /> <!-- normal -->
215                    <enumeration value="true" /> <!-- mark @Deprecated -->
216                </restriction>
217            </simpleType>
218        </attribute>
219        <attribute name="optional" default="false">
220            <simpleType>
221                <restriction base="string">
222                    <enumeration value="false" />
223                    <enumeration value="true" />
224                </restriction>
225            </simpleType>
226        </attribute>
227        <attribute name="typedef" type="string" />
228        <attribute name="hwlevel" default="full">
229            <simpleType>
230                <restriction base="string">
231                    <enumeration value="full" />
232                    <enumeration value="limited" />
233                    <enumeration value="legacy" />
234                </restriction>
235            </simpleType>
236        </attribute>
237    </complexType>
238
239    <complexType name="EnumType">
240        <sequence>
241            <element name="value" type="tns:EnumValueType" maxOccurs="unbounded"></element>
242        </sequence>
243    </complexType>
244
245    <complexType name="TupleType">
246        <sequence>
247            <element name="value" type="string" minOccurs="1" maxOccurs="unbounded"></element>
248        </sequence>
249    </complexType>
250
251    <complexType name="ArrayType">
252        <sequence>
253            <element name="size" type="string" minOccurs="1" maxOccurs="unbounded"></element>
254        </sequence>
255    </complexType>
256
257    <complexType name="EnumValueType" mixed="true">
258
259        <sequence>
260            <element name="notes" type="string" minOccurs="0" maxOccurs="1" />
261        </sequence>
262
263        <attribute name="deprecated" default="false">
264            <simpleType>
265                <restriction base="string">
266                    <enumeration value="true"></enumeration>
267                    <enumeration value="false"></enumeration>
268                </restriction>
269            </simpleType>
270        </attribute>
271        <attribute name="optional">
272            <simpleType>
273                <restriction base="string">
274                    <enumeration value="true"></enumeration>
275                    <enumeration value="false"></enumeration>
276                </restriction>
277            </simpleType>
278        </attribute>
279        <attribute name="hidden">
280            <simpleType>
281                <restriction base="string">
282                    <enumeration value="true"></enumeration>
283                    <enumeration value="false"></enumeration>
284                </restriction>
285            </simpleType>
286        </attribute>
287        <attribute name="id" type="string" />
288    </complexType>
289
290    <complexType name="CloneType">
291        <sequence>
292                <group ref="tns:BaseEntryGroup" />
293        </sequence>
294
295        <!--
296             the semantic correctness of the next 2 attributes
297             are validated by metadata_validate.py
298
299             due to the inability of XSD to generate paths recursively
300        -->
301        <attribute name="entry">
302        </attribute>
303        <attribute name="kind">
304            <simpleType>
305                <restriction base="string">
306                    <enumeration value="controls"></enumeration>
307                    <enumeration value="static"></enumeration>
308                    <enumeration value="dynamic"></enumeration>
309                </restriction>
310            </simpleType>
311        </attribute>
312    </complexType>
313</schema>
314