You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
313 lines
9.3 KiB
313 lines
9.3 KiB
4 months ago
|
/*
|
||
|
* 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 <android-base/logging.h>
|
||
|
|
||
|
namespace android {
|
||
|
namespace hardware {
|
||
|
namespace tests {
|
||
|
namespace safeunion {
|
||
|
namespace V1_0 {
|
||
|
namespace implementation {
|
||
|
|
||
|
// Methods from ::android::hardware::tests::safeunion::V1_0::ISafeUnion follow.
|
||
|
Return<void> SafeUnion::newLargeSafeUnion(newLargeSafeUnion_cb _hidl_cb) {
|
||
|
LOG(INFO) << "SERVER(SafeUnion) newLargeSafeUnion()";
|
||
|
|
||
|
LargeSafeUnion ret;
|
||
|
_hidl_cb(ret);
|
||
|
return Void();
|
||
|
}
|
||
|
|
||
|
Return<void> 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<void> 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<void> 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<void> 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<void> SafeUnion::setE(const LargeSafeUnion& myUnion, const hidl_array<int8_t, 13>& 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<void> SafeUnion::setF(const LargeSafeUnion& myUnion, const hidl_array<int64_t, 5>& 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<void> 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<void> SafeUnion::setH(const LargeSafeUnion& myUnion, const hidl_vec<bool>& 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<void> SafeUnion::setI(const LargeSafeUnion& myUnion, const hidl_vec<uint64_t>& 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<void> 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<void> 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<void> 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<void> 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<void> SafeUnion::setN(const LargeSafeUnion& myUnion, hidl_bitfield<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<void> SafeUnion::newInterfaceTypeSafeUnion(newInterfaceTypeSafeUnion_cb _hidl_cb) {
|
||
|
LOG(INFO) << "SERVER(SafeUnion) newInterfaceTypeSafeUnion()";
|
||
|
|
||
|
InterfaceTypeSafeUnion ret;
|
||
|
_hidl_cb(ret);
|
||
|
return Void();
|
||
|
}
|
||
|
|
||
|
Return<void> 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<void> SafeUnion::setInterfaceB(const InterfaceTypeSafeUnion& myUnion, const hidl_array<int8_t, 7>& 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<void> 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<void> 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<void> SafeUnion::setInterfaceE(const InterfaceTypeSafeUnion& myUnion,
|
||
|
const hidl_vec<hidl_string>& 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<void> 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<void> SafeUnion::setInterfaceG(const InterfaceTypeSafeUnion& myUnion,
|
||
|
const hidl_vec<hidl_handle>& 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<void> SafeUnion::newHandleTypeSafeUnion(newHandleTypeSafeUnion_cb _hidl_cb) {
|
||
|
LOG(INFO) << "SERVER(SafeUnion) newHandleTypeSafeUnion()";
|
||
|
|
||
|
HandleTypeSafeUnion ret;
|
||
|
_hidl_cb(ret);
|
||
|
return Void();
|
||
|
}
|
||
|
|
||
|
Return<void> 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<void> SafeUnion::setHandleB(const HandleTypeSafeUnion& myUnion,
|
||
|
const hidl_array<hidl_handle, 5>& 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<void> SafeUnion::setHandleC(const HandleTypeSafeUnion& myUnion,
|
||
|
const hidl_vec<hidl_handle>& 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
|