1 /*
2  * Copyright (C) 2018 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 
17 #ifndef ANDROID_HARDWARE_TESTS_SAFEUNION_V1_0_SAFEUNION_H
18 #define ANDROID_HARDWARE_TESTS_SAFEUNION_V1_0_SAFEUNION_H
19 
20 #include <android/hardware/tests/safeunion/1.0/ISafeUnion.h>
21 #include <hidl/MQDescriptor.h>
22 #include <hidl/Status.h>
23 
24 namespace android {
25 namespace hardware {
26 namespace tests {
27 namespace safeunion {
28 namespace V1_0 {
29 namespace implementation {
30 
31 using ::android::hardware::Return;
32 using ::android::hardware::Void;
33 using ::android::hardware::tests::safeunion::V1_0::ISafeUnion;
34 
35 struct SafeUnion : public ISafeUnion {
36     // Methods from ::android::hardware::tests::safeunion::V1_0::ISafeUnion follow.
37     Return<void> newLargeSafeUnion(newLargeSafeUnion_cb _hidl_cb) override;
38     Return<void> setA(const LargeSafeUnion& myUnion, int8_t a, setA_cb _hidl_cb) override;
39     Return<void> setB(const LargeSafeUnion& myUnion, uint16_t b, setB_cb _hidl_cb) override;
40     Return<void> setC(const LargeSafeUnion& myUnion, int32_t c, setC_cb _hidl_cb) override;
41     Return<void> setD(const LargeSafeUnion& myUnion, uint64_t d, setD_cb _hidl_cb) override;
42     Return<void> setE(const LargeSafeUnion& myUnion, const hidl_array<int8_t, 13>& e, setE_cb _hidl_cb) override;
43     Return<void> setF(const LargeSafeUnion& myUnion, const hidl_array<int64_t, 5>& f, setF_cb _hidl_cb) override;
44     Return<void> setG(const LargeSafeUnion& myUnion, const hidl_string& g, setG_cb _hidl_cb) override;
45     Return<void> setH(const LargeSafeUnion& myUnion, const hidl_vec<bool>& h, setH_cb _hidl_cb) override;
46     Return<void> setI(const LargeSafeUnion& myUnion, const hidl_vec<uint64_t>& i, setI_cb _hidl_cb) override;
47     Return<void> setJ(const LargeSafeUnion& myUnion, const J& j, setJ_cb _hidl_cb) override;
48     Return<void> setK(const LargeSafeUnion& myUnion, const LargeSafeUnion::K& k, setK_cb _hidl_cb) override;
49     Return<void> setL(const LargeSafeUnion& myUnion, const SmallSafeUnion& l, setL_cb _hidl_cb) override;
50     Return<void> setM(const LargeSafeUnion& myUnion, BitField m, setL_cb _hidl_cb) override;
51     Return<void> setN(const LargeSafeUnion& myUnion, hidl_bitfield<BitField> n,
52                       setL_cb _hidl_cb) override;
53 
54     Return<void> newInterfaceTypeSafeUnion(newInterfaceTypeSafeUnion_cb _hidl_cb) override;
55     Return<void> setInterfaceA(const InterfaceTypeSafeUnion& myUnion, uint32_t a, setInterfaceA_cb _hidl_cb) override;
56     Return<void> setInterfaceB(const InterfaceTypeSafeUnion& myUnion, const hidl_array<int8_t, 7>& b, setInterfaceB_cb _hidl_cb) override;
57     Return<void> setInterfaceC(const InterfaceTypeSafeUnion& myUnion,
58                                const sp<::android::hidl::base::V1_0::IBase>& c,
59                                setInterfaceC_cb _hidl_cb) override;
60     Return<void> setInterfaceD(const InterfaceTypeSafeUnion& myUnion, const hidl_string& d, setInterfaceD_cb _hidl_cb) override;
61     Return<void> setInterfaceE(const InterfaceTypeSafeUnion& myUnion, const hidl_vec<hidl_string>& e, setInterfaceE_cb _hidl_cb) override;
62     Return<void> setInterfaceF(const InterfaceTypeSafeUnion& myUnion, const hidl_handle& f,
63                                setInterfaceF_cb _hidl_cb) override;
64     Return<void> setInterfaceG(const InterfaceTypeSafeUnion& myUnion,
65                                const hidl_vec<hidl_handle>& g, setInterfaceG_cb _hidl_cb) override;
66 
67     Return<void> newHandleTypeSafeUnion(newHandleTypeSafeUnion_cb _hidl_cb) override;
68     Return<void> setHandleA(const HandleTypeSafeUnion& myUnion, const hidl_handle& a,
69                             setHandleA_cb _hidl_cb) override;
70     Return<void> setHandleB(const HandleTypeSafeUnion& myUnion, const hidl_array<hidl_handle, 5>& b,
71                             setHandleB_cb _hidl_cb) override;
72     Return<void> setHandleC(const HandleTypeSafeUnion& myUnion, const hidl_vec<hidl_handle>& c,
73                             setHandleC_cb _hidl_cb) override;
74 };
75 
76 extern "C" ISafeUnion* HIDL_FETCH_ISafeUnion(const char* name);
77 
78 }  // namespace implementation
79 }  // namespace V1_0
80 }  // namespace safeunion
81 }  // namespace tests
82 }  // namespace hardware
83 }  // namespace android
84 
85 #endif  // ANDROID_HARDWARE_TESTS_SAFEUNION_V1_0_SAFEUNION_H
86