blob: d5e35651efabeb55781a07a91c620f5a46590e0c [file] [log] [blame]
Andreas Huberfc0b6c42016-09-22 09:47:48 -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
Andreas Huber669bf7a2016-08-29 10:23:17 -070017package android.hardware.tests.baz@1.0;
18
19interface IBase {
Steven Moreland73600f72016-11-29 14:07:27 -080020 enum SomeBaseEnum : int32_t {
Andreas Huber669bf7a2016-08-29 10:23:17 -070021 grrr = 1,
22 };
23
24 struct Foo {
25 struct Bar {
26 float z;
27 string s;
28 };
29
30 enum FooEnum : int8_t {
31 first = 1,
32 second = 2,
33 };
34
35 int32_t x;
36 vec<Bar> aaa;
37 Bar y;
38 };
39
Andreas Huberfc0b6c42016-09-22 09:47:48 -070040 struct MoreThanOneArrayField {
41 /*
42 * Generated (Java) code used to redeclare the same variable name
43 * multiple times in the same scope, this test ensures that that's no
44 * longer the case.
45 */
46 string[3] one;
47 string[5] two;
48 };
49
Andreas Huber9c43f012016-09-14 15:27:21 -070050 typedef string[3] ThreeStrings;
51 typedef string[5] FiveStrings;
52
53 struct StringMatrix3x5 {
54 FiveStrings[3] s;
55 };
56
57 struct StringMatrix5x3 {
58 ThreeStrings[5] s;
59 };
60
Andreas Huberfd77f502016-09-23 12:16:36 -070061 typedef uint8_t[6] MacAddress;
62
63 struct VectorOfArray {
64 vec<MacAddress> addresses;
65 };
66
Yifan Honge7ce8222016-12-05 12:34:42 -080067 enum BitField : uint8_t {
68 V0 = 1 << 0,
69 V1 = 1 << 1,
70 V2 = 1 << 2,
71 V3 = 1 << 3,
72 };
73
74 struct MyMask {
75 bitfield<BitField> value;
76 };
77
78 typedef bitfield<BitField> Mask;
79
Andreas Huber669bf7a2016-08-29 10:23:17 -070080 someBaseMethod();
81
82 someBoolMethod(bool x) generates (bool y);
83 someBoolArrayMethod(bool[3] x) generates (bool[4] y);
84 someBoolVectorMethod(vec<bool> x) generates (vec<bool> y);
85
86 someOtherBaseMethod(Foo foo) generates (Foo result);
Andreas Huberf399e502016-09-09 14:56:15 -070087 someMethodWithFooArrays(Foo[2] fooInput) generates (Foo[2] fooOutput);
88 someMethodWithFooVectors(vec<Foo> fooInput) generates (vec<Foo> fooOutput);
Andreas Huber9c43f012016-09-14 15:27:21 -070089
Andreas Huberfd77f502016-09-23 12:16:36 -070090 someMethodWithVectorOfArray(VectorOfArray in) generates (VectorOfArray out);
91
Andreas Huber28c85b72016-10-18 13:52:38 -070092 someMethodTakingAVectorOfArray(vec<MacAddress> in)
93 generates (vec<MacAddress> out);
94
Andreas Huber9c43f012016-09-14 15:27:21 -070095 transpose(StringMatrix5x3 in) generates (StringMatrix3x5 out);
Andreas Huber8e237942016-09-19 13:59:52 -070096 transpose2(ThreeStrings[5] in) generates (FiveStrings[3] out);
Yifan Honge7ce8222016-12-05 12:34:42 -080097
98 takeAMask(BitField bf, bitfield<BitField> first, MyMask second, Mask third)
99 generates (BitField out, uint8_t f, uint8_t s, uint8_t t);
Andreas Huber669bf7a2016-08-29 10:23:17 -0700100};