• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
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
17package android.hardware.tests.foo@1.0;
18
19import IFooCallback;
20import IMyTypes.SomeStruct;
21import ISimple;
22import ITheirTypes.FloatArray;
23
24@SensitiveData // for test
25interface 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
37    enum BitField : uint8_t {
38        V0 = 1 << 0,
39        V1 = 1 << 1,
40        V2 = 1 << 2,
41        V3 = 1 << 3,
42        VALL = V0 | V1 | V2 | V3,
43    };
44
45    struct Fumble {
46        Outer.Inner data;
47    };
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
62    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
76    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
87    struct MyStruct {
88        SomeStruct innerStruct;
89        FloatArray myFloatArray;
90    };
91
92    struct MyHandle {
93        handle h;
94        int32_t guard;
95    };
96
97    struct MyMask {
98        bitfield<BitField> value;
99    };
100
101    typedef bitfield<BitField> Mask;
102
103    struct Everything {
104        union U {
105            int8_t number;
106            int8_t[1][2] multidimArray;
107            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
125    struct WithFmq {
126        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;
134    };
135
136    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
149    typedef int32_t[5][6][7] multidimArrayOne;
150    typedef multidimArrayOne[8][9][10] multidimArrayTwo;
151    typedef multidimArrayTwo[2][3][4] multidimArrayThree;
152
153    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
171    /**
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
181    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);
187    oneway callMe(IFooCallback cb);
188    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);
198
199    transposeMe(FiveFloats[3] in) generates (ThreeFloats[5] out);
200    callingDrWho(MultiDimensional in) generates (MultiDimensional out);
201
202    transpose(StringMatrix5x3 in) generates (StringMatrix3x5 out);
203    transpose2(ThreeStrings[5] in) generates (FiveStrings[3] out);
204
205    sendVec(vec<uint8_t> data) generates (vec<uint8_t> data);
206
207    sendVecVec() generates (vec<vec<uint8_t>> vecvec);
208
209    haveAVectorOfInterfaces(vec<ISimple> in) generates (vec<ISimple> out);
210
211    haveAVectorOfGenericInterfaces(vec<interface> in)
212        generates (vec<interface> out);
213
214    echoNullInterface(IFooCallback cb) generates (bool receivedNull, IFooCallback cb);
215
216    createMyHandle() generates (MyHandle h);
217    createHandles(uint32_t size) generates (vec<handle> handles);
218    closeHandles();
219
220    repeatWithFmq(WithFmq withFmq) generates (WithFmq withFmq);
221};
222