/* * Copyright (C) 2022 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 "EnumeratorProxy.h" #include #include #include namespace { using ::android::sp; using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; using CameraDesc_1_0 = ::android::hardware::automotive::evs::V1_0::CameraDesc; using CameraDesc_1_1 = ::android::hardware::automotive::evs::V1_1::CameraDesc; } // namespace namespace android::automotive::evs::V1_1::implementation { // TODO(b/206829268): As EnumeratorProxy is introduced piece meal the proxied // methods will be added here (this is being done in order to introduce tests). #ifdef TEMPORARILY_DISABLE_SEE_B_206829268 hardware::Return EnumeratorProxy::getCameraList(getCameraList_cb hidlCallback) { hidlCallback(stlToHidlVec(mEnumeratorManager->getCameraList())); return Void(); } hardware::Return> EnumeratorProxy::openCamera( const hardware::hidl_string& cameraId) { return sp( mEnumeratorManager->openCamera(hidlToStlString(cameraId)).release()); } hardware::Return EnumeratorProxy::closeCamera( const sp& camera) { mEnumeratorManager->closeCamera(*camera); return Void(); } hardware::Return> EnumeratorProxy::openDisplay() { return sp( mEnumeratorManager->openDisplay().release()); } hardware::Return EnumeratorProxy::closeDisplay( const sp& display) { mEnumeratorManager->closeDisplay(display.get()); return Void(); } hardware::Return EnumeratorProxy::getDisplayState() { return mEnumeratorManager->getDisplayState(); } hardware::Return EnumeratorProxy::getCameraList_1_1( ::android::hardware::automotive::evs::V1_1::IEvsEnumerator::getCameraList_1_1_cb hidlCallback) { hidlCallback(stlToHidlVec(mEnumeratorManager->getCameraList_1_1())); return Void(); } hardware::Return> EnumeratorProxy::openCamera_1_1( const hardware::hidl_string& cameraId, const hardware::camera::device::V3_2::Stream& streamCfg) { return sp{ mEnumeratorManager->openCamera_1_1(hidlToStlString(cameraId), streamCfg).release()}; } hardware::Return EnumeratorProxy::isHardware() { return mEnumeratorManager->isHardware(); } hardware::Return EnumeratorProxy::getDisplayIdList( hardware::automotive::evs::V1_1::IEvsEnumerator::getDisplayIdList_cb list_callback) { list_callback(stlToHidlVec(mEnumeratorManager->getDisplayIdList())); return Void(); } hardware::Return> EnumeratorProxy::openDisplay_1_1( uint8_t id) { return sp{ mEnumeratorManager->openDisplay_1_1(id).release()}; } hardware::Return EnumeratorProxy::getUltrasonicsArrayList( ::android::hardware::automotive::evs::V1_1::IEvsEnumerator::getUltrasonicsArrayList_cb list_callback) { list_callback(stlToHidlVec(mEnumeratorManager->getUltrasonicsArrayList())); return Void(); } hardware::Return> EnumeratorProxy::openUltrasonicsArray(const hardware::hidl_string& ultrasonicsArrayId) { return sp<::android::hardware::automotive::evs::V1_1::IEvsUltrasonicsArray>( mEnumeratorManager->openUltrasonicsArray(hidlToStlString(ultrasonicsArrayId)) .release()); } hardware::Return EnumeratorProxy::closeUltrasonicsArray( const sp<::android::hardware::automotive::evs::V1_1::IEvsUltrasonicsArray>& evsUltrasonicsArray) { mEnumeratorManager->closeUltrasonicsArray(*evsUltrasonicsArray); return Void(); } hardware::Return EnumeratorProxy::debug( const ::android::hardware::hidl_handle& fileDescriptor, const hidl_vec& options) { mEnumeratorManager->debug(fileDescriptor, hidlToStlVecOfStrings(options)); return Void(); } #endif // TEMPORARILY_DISABLE_SEE_B_206829268 } // namespace android::automotive::evs::V1_1::implementation