/* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "SafeUnion.h" #include namespace android { namespace hardware { namespace tests { namespace safeunion { namespace V1_0 { namespace implementation { // Methods from ::android::hardware::tests::safeunion::V1_0::ISafeUnion follow. Return SafeUnion::newLargeSafeUnion(newLargeSafeUnion_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) newLargeSafeUnion()"; LargeSafeUnion ret; _hidl_cb(ret); return Void(); } Return SafeUnion::setA(const LargeSafeUnion& myUnion, int8_t a, setA_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setA(myUnion, " << a << ")"; LargeSafeUnion myNewUnion = myUnion; myNewUnion.a(a); _hidl_cb(myNewUnion); return Void(); } Return SafeUnion::setB(const LargeSafeUnion& myUnion, uint16_t b, setB_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setB(myUnion, " << b << ")"; LargeSafeUnion myNewUnion = myUnion; myNewUnion.b(b); _hidl_cb(myNewUnion); return Void(); } Return SafeUnion::setC(const LargeSafeUnion& myUnion, int32_t c, setC_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setC(myUnion, " << c << ")"; LargeSafeUnion myNewUnion = myUnion; myNewUnion.c(c); _hidl_cb(myNewUnion); return Void(); } Return SafeUnion::setD(const LargeSafeUnion& myUnion, uint64_t d, setD_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setD(myUnion, " << d << ")"; LargeSafeUnion myNewUnion = myUnion; myNewUnion.d(d); _hidl_cb(myNewUnion); return Void(); } Return SafeUnion::setE(const LargeSafeUnion& myUnion, const hidl_array& e, setE_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setE(myUnion, " << toString(e) << ")"; LargeSafeUnion myNewUnion = myUnion; myNewUnion.e(e); _hidl_cb(myNewUnion); return Void(); } Return SafeUnion::setF(const LargeSafeUnion& myUnion, const hidl_array& f, setF_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setF(myUnion, " << toString(f) << ")"; LargeSafeUnion myNewUnion = myUnion; myNewUnion.f(f); _hidl_cb(myNewUnion); return Void(); } Return SafeUnion::setG(const LargeSafeUnion& myUnion, const hidl_string& g, setG_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setG(myUnion, " << toString(g) << ")"; LargeSafeUnion myNewUnion = myUnion; myNewUnion.g(g); _hidl_cb(myNewUnion); return Void(); } Return SafeUnion::setH(const LargeSafeUnion& myUnion, const hidl_vec& h, setH_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setH(myUnion, " << toString(h) << ")"; LargeSafeUnion myNewUnion = myUnion; myNewUnion.h(h); _hidl_cb(myNewUnion); return Void(); } Return SafeUnion::setI(const LargeSafeUnion& myUnion, const hidl_vec& i, setI_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setI(myUnion, " << toString(i) << ")"; LargeSafeUnion myNewUnion = myUnion; myNewUnion.i(i); _hidl_cb(myNewUnion); return Void(); } Return SafeUnion::setJ(const LargeSafeUnion& myUnion, const J& j, setJ_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setJ(myUnion, " << toString(j) << ")"; LargeSafeUnion myNewUnion = myUnion; myNewUnion.j(j); _hidl_cb(myNewUnion); return Void(); } Return SafeUnion::setK(const LargeSafeUnion& myUnion, const LargeSafeUnion::K& k, setK_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setK(myUnion, " << toString(k) << ")"; LargeSafeUnion myNewUnion = myUnion; myNewUnion.k(k); _hidl_cb(myNewUnion); return Void(); } Return SafeUnion::setL(const LargeSafeUnion& myUnion, const SmallSafeUnion& l, setL_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setL(myUnion, " << toString(l) << ")"; LargeSafeUnion myNewUnion = myUnion; myNewUnion.l(l); _hidl_cb(myNewUnion); return Void(); } Return SafeUnion::setM(const LargeSafeUnion& myUnion, BitField m, setL_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setM(myUnion, " << toString(m) << ")"; LargeSafeUnion myNewUnion = myUnion; myNewUnion.m(m); _hidl_cb(myNewUnion); return Void(); } Return SafeUnion::setN(const LargeSafeUnion& myUnion, hidl_bitfield n, setL_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setN(myUnion, " << n << ")"; LargeSafeUnion myNewUnion = myUnion; myNewUnion.n(n); _hidl_cb(myNewUnion); return Void(); } Return SafeUnion::newInterfaceTypeSafeUnion(newInterfaceTypeSafeUnion_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) newInterfaceTypeSafeUnion()"; InterfaceTypeSafeUnion ret; _hidl_cb(ret); return Void(); } Return SafeUnion::setInterfaceA(const InterfaceTypeSafeUnion& myUnion, uint32_t a, setInterfaceA_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setInterfaceA(myUnion, " << a << ")"; InterfaceTypeSafeUnion myNewUnion = myUnion; myNewUnion.a(a); _hidl_cb(myNewUnion); return Void(); } Return SafeUnion::setInterfaceB(const InterfaceTypeSafeUnion& myUnion, const hidl_array& b, setInterfaceB_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setInterfaceB(myUnion, " << toString(b) << ")"; InterfaceTypeSafeUnion myNewUnion = myUnion; myNewUnion.b(b); _hidl_cb(myNewUnion); return Void(); } Return SafeUnion::setInterfaceC(const InterfaceTypeSafeUnion& myUnion, const sp<::android::hidl::base::V1_0::IBase>& c, setInterfaceC_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setInterfaceC(myUnion, " << toString(c) << ")"; InterfaceTypeSafeUnion myNewUnion = myUnion; myNewUnion.c(c); _hidl_cb(myNewUnion); return Void(); } Return SafeUnion::setInterfaceD(const InterfaceTypeSafeUnion& myUnion, const hidl_string& d, setInterfaceD_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setInterfaceD(myUnion, " << toString(d) << ")"; InterfaceTypeSafeUnion myNewUnion = myUnion; myNewUnion.d(d); _hidl_cb(myNewUnion); return Void(); } Return SafeUnion::setInterfaceE(const InterfaceTypeSafeUnion& myUnion, const hidl_vec& e, setInterfaceE_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setInterfaceE(myUnion, " << toString(e) << ")"; InterfaceTypeSafeUnion myNewUnion = myUnion; myNewUnion.e(e); _hidl_cb(myNewUnion); return Void(); } Return SafeUnion::setInterfaceF(const InterfaceTypeSafeUnion& myUnion, const hidl_handle& f, setInterfaceF_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setInterfaceF(myUnion, " << toString(f) << ")"; InterfaceTypeSafeUnion myNewUnion = myUnion; myNewUnion.f(f); _hidl_cb(myNewUnion); return Void(); } Return SafeUnion::setInterfaceG(const InterfaceTypeSafeUnion& myUnion, const hidl_vec& g, setInterfaceG_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setInterfaceG(myUnion, " << toString(g) << ")"; InterfaceTypeSafeUnion myNewUnion = myUnion; myNewUnion.g(g); _hidl_cb(myNewUnion); return Void(); } Return SafeUnion::newHandleTypeSafeUnion(newHandleTypeSafeUnion_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) newHandleTypeSafeUnion()"; HandleTypeSafeUnion ret; _hidl_cb(ret); return Void(); } Return SafeUnion::setHandleA( const ::android::hardware::tests::safeunion::V1_0::ISafeUnion::HandleTypeSafeUnion& myUnion, const hidl_handle& a, setHandleA_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setHandleA(myUnion, " << toString(a) << ")"; HandleTypeSafeUnion myNewUnion = myUnion; myNewUnion.a(a); _hidl_cb(myNewUnion); return Void(); } Return SafeUnion::setHandleB(const HandleTypeSafeUnion& myUnion, const hidl_array& b, setHandleB_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setHandleB(myUnion, " << toString(b) << ")"; HandleTypeSafeUnion myNewUnion = myUnion; myNewUnion.b(b); _hidl_cb(myNewUnion); return Void(); } Return SafeUnion::setHandleC(const HandleTypeSafeUnion& myUnion, const hidl_vec& c, setHandleC_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setHandleC(myUnion, " << toString(c) << ")"; HandleTypeSafeUnion myNewUnion = myUnion; myNewUnion.c(c); _hidl_cb(myNewUnion); return Void(); } ISafeUnion* HIDL_FETCH_ISafeUnion(const char* /* name */) { return new SafeUnion(); } } // namespace implementation } // namespace V1_0 } // namespace safeunion } // namespace tests } // namespace hardware } // namespace android