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.baz@1.0; 18 19interface IBase { 20 enum SomeBaseEnum : int32_t { 21 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 40 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 50 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 61 typedef uint8_t[6] MacAddress; 62 63 struct VectorOfArray { 64 vec<MacAddress> addresses; 65 }; 66 67 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 80 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); 87 someMethodWithFooArrays(Foo[2] fooInput) generates (Foo[2] fooOutput); 88 someMethodWithFooVectors(vec<Foo> fooInput) generates (vec<Foo> fooOutput); 89 90 someMethodWithVectorOfArray(VectorOfArray in) generates (VectorOfArray out); 91 92 someMethodTakingAVectorOfArray(vec<MacAddress> in) 93 generates (vec<MacAddress> out); 94 95 transpose(StringMatrix5x3 in) generates (StringMatrix3x5 out); 96 transpose2(ThreeStrings[5] in) generates (FiveStrings[3] out); 97 98 takeAMask(BitField bf, bitfield<BitField> first, MyMask second, Mask third) 99 generates (BitField out, uint8_t f, uint8_t s, uint8_t t); 100}; 101