blob: 4c5442754c0e176244d99f9331bc50d534f89a7c [file] [log] [blame]
Martijn Coenencbe590c2016-08-30 11:27:56 -07001/*
2 * Copyright (C) 2016 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
Steven Moreland61651882016-08-11 12:52:43 -070017package android.hardware.tests.foo@1.0;
18
19import IFooCallback;
Yifan Hong799ebcb2016-10-05 12:15:51 -070020import IMyTypes.SomeStruct;
Andreas Huber847b1452016-10-19 14:10:55 -070021import ISimple;
Yifan Hong799ebcb2016-10-05 12:15:51 -070022import ITheirTypes.FloatArray;
Steven Moreland61651882016-08-11 12:52:43 -070023
24interface IFoo {
25
26 enum SomeBaseEnum : uint8_t {
27 bar = 66
28 };
29
30 enum SomeEnum : SomeBaseEnum {
31 quux = 33,
32 goober = 192,
33 blah = goober
34 };
35
Yifan Honge7ce8222016-12-05 12:34:42 -080036 enum BitField : uint8_t {
37 V0 = 1 << 0,
38 V1 = 1 << 1,
39 V2 = 1 << 2,
40 V3 = 1 << 3,
Yifan Hong4093a442017-02-22 16:07:33 -080041 VALL = V0 | V1 | V2 | V3,
Yifan Honge7ce8222016-12-05 12:34:42 -080042 };
43
Steven Moreland61651882016-08-11 12:52:43 -070044 struct Fumble {
Yifan Hong61db8542016-10-03 10:30:55 -070045 Outer.Inner data;
Steven Moreland61651882016-08-11 12:52:43 -070046 };
47
48 typedef Fumble Gumble;
49
50 struct Goober {
51 int32_t q;
52 string name;
53 string address;
54 double[10] numbers;
55 Fumble fumble;
56 Gumble gumble;
57 // vec<double> lotsOfFumbles;
58 // handle loveHandle;
59 };
60
Andreas Hubercf8560c2016-09-12 15:01:02 -070061 typedef float[3] ThreeFloats;
62 typedef float[5] FiveFloats;
63
64 struct Quux {
65 string first;
66 string last;
67 };
68
69 typedef Quux[3] ThreeQuuxes;
70
71 struct MultiDimensional {
72 ThreeQuuxes[5] quuxMatrix;
73 };
74
Andreas Huber8e237942016-09-19 13:59:52 -070075 typedef string[3] ThreeStrings;
76 typedef string[5] FiveStrings;
77
78 struct StringMatrix3x5 {
79 FiveStrings[3] s;
80 };
81
82 struct StringMatrix5x3 {
83 ThreeStrings[5] s;
84 };
85
Yifan Hong799ebcb2016-10-05 12:15:51 -070086 struct MyStruct {
87 SomeStruct innerStruct;
88 FloatArray myFloatArray;
89 };
90
Yifan Hongebfa6332016-10-14 10:41:41 -070091 struct MyHandle {
92 handle h;
93 int32_t guard;
94 };
95
Yifan Honge7ce8222016-12-05 12:34:42 -080096 struct MyMask {
97 bitfield<BitField> value;
98 };
99
100 typedef bitfield<BitField> Mask;
101
Yifan Hong04e53a12017-01-06 09:10:11 -0800102 struct Everything {
103 union U {
104 int8_t number;
105 int8_t[1][2] multidimArray;
Yifan Hong04e53a12017-01-06 09:10:11 -0800106 Fumble anotherStruct;
107 bitfield<BitField> bf;
108 } u;
109
110 int8_t number;
111 handle h;
112 fmq_sync<uint8_t> descSync;
113 fmq_unsync<uint8_t> descUnsync;
114 memory mem;
115 pointer p;
116 string s;
117 vec<string> vs;
118 string[2][2] multidimArray;
119 string[3] sArray;
120 Quux anotherStruct;
121 bitfield<BitField> bf;
122 };
123
Steven Moreland2b019562018-10-05 09:42:21 -0700124 struct WithFmq {
Steven Morelandbd5b4dc2018-10-09 15:10:48 -0700125 struct ScatterGather {
126 fmq_sync<uint8_t> descSync;
127 } scatterGathered;
128
129 struct ContainsPointer {
130 fmq_sync<uint8_t> descSync;
131 interface foo;
132 } containsPointer;
Steven Moreland2b019562018-10-05 09:42:21 -0700133 };
134
Steven Moreland3bcfa472017-12-13 18:12:45 -0800135 enum Discriminator : uint8_t {
136 BOOL,
137 INT,
138 };
139 union Union {
140 bool boolValue;
141 int64_t intValue;
142 };
143 struct ContainsUnion {
144 Discriminator discriminator;
145 Union value;
146 };
147
Timur Iskhakova3b0f1f2017-08-31 15:18:45 -0700148 typedef int32_t[5][6][7] multidimArrayOne;
149 typedef multidimArrayOne[8][9][10] multidimArrayTwo;
150 typedef multidimArrayTwo[2][3][4] multidimArrayThree;
151
Timur Iskhakovd8299ff2017-09-13 17:35:10 -0700152 struct InnerTestStruct {};
153 typedef InnerTestStruct InnerTestStructTypedef;
154 struct S1 {
155 struct InnerTestStruct {};
156 InnerTestStructTypedef foo;
157 };
158
159 enum InnerTestEnum : int32_t {
160 VALUE = 0
161 };
162 typedef InnerTestEnum InnerTestEnumTypedef;
163 struct S2 {
164 enum InnerTestEnum : int32_t {
165 VALUE = 1
166 };
167 InnerTestEnumTypedef foo;
168 };
169
Steven Moreland3bcfa472017-12-13 18:12:45 -0800170 /**
171 * If d is INT, converts all values to bools which are small enough (0 or 1).
172 * If d is BOOL, should leave all values as BOOLs.
173 *
174 * @param d discriminator for all values in u
175 * @param u values to be expanded
176 * @return c must have same length as u unless there is an error in which case it will be empty.
177 */
178 convertToBoolIfSmall(Discriminator d, vec<Union> u) generates (vec<ContainsUnion> c);
179
Steven Moreland61651882016-08-11 12:52:43 -0700180 doThis(float param);
181 doThatAndReturnSomething(int64_t param) generates (int32_t result);
182 doQuiteABit(int32_t a, int64_t b, float c, double d) generates (double something);
183 doSomethingElse(int32_t[15] param) generates (int32_t[32] something);
184 doStuffAndReturnAString() generates (string something);
185 mapThisVector(vec<int32_t> param) generates (vec<int32_t> something);
Iliyan Malcheve96606a2016-08-13 23:05:56 -0700186 oneway callMe(IFooCallback cb);
Steven Moreland61651882016-08-11 12:52:43 -0700187 useAnEnum(SomeEnum zzz) generates (SomeEnum sleepy);
188
189 haveAGooberVec(vec<Goober> param);
190 haveAGoober(Goober g);
191 haveAGooberArray(Goober[20] lots);
192
193 haveATypeFromAnotherFile(Abc def);
194
195 haveSomeStrings(string[3] array) generates (string[2] result);
196 haveAStringVec(vec<string> vector) generates (vec<string> result);
Andreas Hubercf8560c2016-09-12 15:01:02 -0700197
198 transposeMe(FiveFloats[3] in) generates (ThreeFloats[5] out);
199 callingDrWho(MultiDimensional in) generates (MultiDimensional out);
Andreas Huber8e237942016-09-19 13:59:52 -0700200
201 transpose(StringMatrix5x3 in) generates (StringMatrix3x5 out);
202 transpose2(ThreeStrings[5] in) generates (FiveStrings[3] out);
Andreas Huber88476c12016-09-27 14:54:20 -0700203
204 sendVec(vec<uint8_t> data) generates (vec<uint8_t> data);
Yifan Hong223b82a2016-10-05 13:43:53 -0700205
206 sendVecVec() generates (vec<vec<uint8_t>> vecvec);
Andreas Huber847b1452016-10-19 14:10:55 -0700207
208 haveAVectorOfInterfaces(vec<ISimple> in) generates (vec<ISimple> out);
209
210 haveAVectorOfGenericInterfaces(vec<interface> in)
211 generates (vec<interface> out);
Martijn Coenenb7307d52016-10-27 11:51:46 +0200212
213 echoNullInterface(IFooCallback cb) generates (bool receivedNull, IFooCallback cb);
214
Yifan Hongebfa6332016-10-14 10:41:41 -0700215 createMyHandle() generates (MyHandle h);
216 createHandles(uint32_t size) generates (vec<handle> handles);
217 closeHandles();
Steven Moreland2b019562018-10-05 09:42:21 -0700218
219 repeatWithFmq(WithFmq withFmq) generates (WithFmq withFmq);
Steven Moreland61651882016-08-11 12:52:43 -0700220};