blob: e2426164ce3c5aed82c92ded09dd1d2271de3663 [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
Steven Moreland312bf0e2020-11-19 21:36:10 +000024@SensitiveData // for test
Steven Moreland61651882016-08-11 12:52:43 -070025interface IFoo {
26
27 enum SomeBaseEnum : uint8_t {
28 bar = 66
29 };
30
31 enum SomeEnum : SomeBaseEnum {
32 quux = 33,
33 goober = 192,
34 blah = goober
35 };
36
Yifan Honge7ce8222016-12-05 12:34:42 -080037 enum BitField : uint8_t {
38 V0 = 1 << 0,
39 V1 = 1 << 1,
40 V2 = 1 << 2,
41 V3 = 1 << 3,
Yifan Hong4093a442017-02-22 16:07:33 -080042 VALL = V0 | V1 | V2 | V3,
Yifan Honge7ce8222016-12-05 12:34:42 -080043 };
44
Steven Moreland61651882016-08-11 12:52:43 -070045 struct Fumble {
Yifan Hong61db8542016-10-03 10:30:55 -070046 Outer.Inner data;
Steven Moreland61651882016-08-11 12:52:43 -070047 };
48
49 typedef Fumble Gumble;
50
51 struct Goober {
52 int32_t q;
53 string name;
54 string address;
55 double[10] numbers;
56 Fumble fumble;
57 Gumble gumble;
58 // vec<double> lotsOfFumbles;
59 // handle loveHandle;
60 };
61
Andreas Hubercf8560c2016-09-12 15:01:02 -070062 typedef float[3] ThreeFloats;
63 typedef float[5] FiveFloats;
64
65 struct Quux {
66 string first;
67 string last;
68 };
69
70 typedef Quux[3] ThreeQuuxes;
71
72 struct MultiDimensional {
73 ThreeQuuxes[5] quuxMatrix;
74 };
75
Andreas Huber8e237942016-09-19 13:59:52 -070076 typedef string[3] ThreeStrings;
77 typedef string[5] FiveStrings;
78
79 struct StringMatrix3x5 {
80 FiveStrings[3] s;
81 };
82
83 struct StringMatrix5x3 {
84 ThreeStrings[5] s;
85 };
86
Yifan Hong799ebcb2016-10-05 12:15:51 -070087 struct MyStruct {
88 SomeStruct innerStruct;
89 FloatArray myFloatArray;
90 };
91
Yifan Hongebfa6332016-10-14 10:41:41 -070092 struct MyHandle {
93 handle h;
94 int32_t guard;
95 };
96
Yifan Honge7ce8222016-12-05 12:34:42 -080097 struct MyMask {
98 bitfield<BitField> value;
99 };
100
101 typedef bitfield<BitField> Mask;
102
Yifan Hong04e53a12017-01-06 09:10:11 -0800103 struct Everything {
104 union U {
105 int8_t number;
106 int8_t[1][2] multidimArray;
Yifan Hong04e53a12017-01-06 09:10:11 -0800107 Fumble anotherStruct;
108 bitfield<BitField> bf;
109 } u;
110
111 int8_t number;
112 handle h;
113 fmq_sync<uint8_t> descSync;
114 fmq_unsync<uint8_t> descUnsync;
115 memory mem;
116 pointer p;
117 string s;
118 vec<string> vs;
119 string[2][2] multidimArray;
120 string[3] sArray;
121 Quux anotherStruct;
122 bitfield<BitField> bf;
123 };
124
Steven Moreland2b019562018-10-05 09:42:21 -0700125 struct WithFmq {
Steven Morelandbd5b4dc2018-10-09 15:10:48 -0700126 struct ScatterGather {
127 fmq_sync<uint8_t> descSync;
128 } scatterGathered;
129
130 struct ContainsPointer {
131 fmq_sync<uint8_t> descSync;
132 interface foo;
133 } containsPointer;
Steven Moreland2b019562018-10-05 09:42:21 -0700134 };
135
Steven Moreland3bcfa472017-12-13 18:12:45 -0800136 enum Discriminator : uint8_t {
137 BOOL,
138 INT,
139 };
140 union Union {
141 bool boolValue;
142 int64_t intValue;
143 };
144 struct ContainsUnion {
145 Discriminator discriminator;
146 Union value;
147 };
148
Timur Iskhakova3b0f1f2017-08-31 15:18:45 -0700149 typedef int32_t[5][6][7] multidimArrayOne;
150 typedef multidimArrayOne[8][9][10] multidimArrayTwo;
151 typedef multidimArrayTwo[2][3][4] multidimArrayThree;
152
Timur Iskhakovd8299ff2017-09-13 17:35:10 -0700153 struct InnerTestStruct {};
154 typedef InnerTestStruct InnerTestStructTypedef;
155 struct S1 {
156 struct InnerTestStruct {};
157 InnerTestStructTypedef foo;
158 };
159
160 enum InnerTestEnum : int32_t {
161 VALUE = 0
162 };
163 typedef InnerTestEnum InnerTestEnumTypedef;
164 struct S2 {
165 enum InnerTestEnum : int32_t {
166 VALUE = 1
167 };
168 InnerTestEnumTypedef foo;
169 };
170
Steven Moreland3bcfa472017-12-13 18:12:45 -0800171 /**
172 * If d is INT, converts all values to bools which are small enough (0 or 1).
173 * If d is BOOL, should leave all values as BOOLs.
174 *
175 * @param d discriminator for all values in u
176 * @param u values to be expanded
177 * @return c must have same length as u unless there is an error in which case it will be empty.
178 */
179 convertToBoolIfSmall(Discriminator d, vec<Union> u) generates (vec<ContainsUnion> c);
180
Steven Moreland61651882016-08-11 12:52:43 -0700181 doThis(float param);
182 doThatAndReturnSomething(int64_t param) generates (int32_t result);
183 doQuiteABit(int32_t a, int64_t b, float c, double d) generates (double something);
184 doSomethingElse(int32_t[15] param) generates (int32_t[32] something);
185 doStuffAndReturnAString() generates (string something);
186 mapThisVector(vec<int32_t> param) generates (vec<int32_t> something);
Iliyan Malcheve96606a2016-08-13 23:05:56 -0700187 oneway callMe(IFooCallback cb);
Steven Moreland61651882016-08-11 12:52:43 -0700188 useAnEnum(SomeEnum zzz) generates (SomeEnum sleepy);
189
190 haveAGooberVec(vec<Goober> param);
191 haveAGoober(Goober g);
192 haveAGooberArray(Goober[20] lots);
193
194 haveATypeFromAnotherFile(Abc def);
195
196 haveSomeStrings(string[3] array) generates (string[2] result);
197 haveAStringVec(vec<string> vector) generates (vec<string> result);
Andreas Hubercf8560c2016-09-12 15:01:02 -0700198
199 transposeMe(FiveFloats[3] in) generates (ThreeFloats[5] out);
200 callingDrWho(MultiDimensional in) generates (MultiDimensional out);
Andreas Huber8e237942016-09-19 13:59:52 -0700201
202 transpose(StringMatrix5x3 in) generates (StringMatrix3x5 out);
203 transpose2(ThreeStrings[5] in) generates (FiveStrings[3] out);
Andreas Huber88476c12016-09-27 14:54:20 -0700204
205 sendVec(vec<uint8_t> data) generates (vec<uint8_t> data);
Yifan Hong223b82a2016-10-05 13:43:53 -0700206
207 sendVecVec() generates (vec<vec<uint8_t>> vecvec);
Andreas Huber847b1452016-10-19 14:10:55 -0700208
209 haveAVectorOfInterfaces(vec<ISimple> in) generates (vec<ISimple> out);
210
211 haveAVectorOfGenericInterfaces(vec<interface> in)
212 generates (vec<interface> out);
Martijn Coenenb7307d52016-10-27 11:51:46 +0200213
214 echoNullInterface(IFooCallback cb) generates (bool receivedNull, IFooCallback cb);
215
Yifan Hongebfa6332016-10-14 10:41:41 -0700216 createMyHandle() generates (MyHandle h);
217 createHandles(uint32_t size) generates (vec<handle> handles);
218 closeHandles();
Steven Moreland2b019562018-10-05 09:42:21 -0700219
220 repeatWithFmq(WithFmq withFmq) generates (WithFmq withFmq);
Steven Moreland61651882016-08-11 12:52:43 -0700221};