Loading automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +1 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ #include <aidl/android/hardware/automotive/vehicle/VehicleLightSwitch.h> #include <aidl/android/hardware/automotive/vehicle/VehicleOilLevel.h> #include <aidl/android/hardware/automotive/vehicle/VehiclePropConfig.h> #include <aidl/android/hardware/automotive/vehicle/VehiclePropConfigs.h> #include <aidl/android/hardware/automotive/vehicle/VehiclePropError.h> #include <aidl/android/hardware/automotive/vehicle/VehiclePropValue.h> #include <aidl/android/hardware/automotive/vehicle/VehicleProperty.h> Loading automotive/vehicle/aidl/impl/vhal/Android.bp 0 → 100644 +30 −0 Original line number Diff line number Diff line // Copyright (C) 2021 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. cc_binary { name: "android.hardware.automotive.vehicle-aidl-default-service", defaults: ["VehicleHalDefaults"], local_include_dirs: ["include"], vintf_fragments: ["vhal-default-service.xml"], init_rc: ["vhal-default-service.rc"], vendor: true, relative_install_path: "hw", srcs: ["src/*.cpp"], static_libs: [ "VehicleHalUtils", ], shared_libs: [ "libbinder_ndk", ], } automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h 0 → 100644 +66 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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. */ #ifndef android_hardware_automotive_vehicle_aidl_impl_vhal_include_DefaultVehicleHal_H_ #define android_hardware_automotive_vehicle_aidl_impl_vhal_include_DefaultVehicleHal_H_ #include <aidl/android/hardware/automotive/vehicle/BnVehicle.h> namespace android { namespace hardware { namespace automotive { namespace vehicle { class DefaultVehicleHal final : public ::aidl::android::hardware::automotive::vehicle::BnVehicle { ::ndk::ScopedAStatus getAllPropConfigs( ::aidl::android::hardware::automotive::vehicle::VehiclePropConfigs* returnConfigs) override; ::ndk::ScopedAStatus getValues( const std::shared_ptr<::aidl::android::hardware::automotive::vehicle::IVehicleCallback>& callback, const ::aidl::android::hardware::automotive::vehicle::GetValueRequests& requests) override; ::ndk::ScopedAStatus setValues( const std::shared_ptr<::aidl::android::hardware::automotive::vehicle::IVehicleCallback>& callback, const ::aidl::android::hardware::automotive::vehicle::SetValueRequests& requests) override; ::ndk::ScopedAStatus getPropConfigs( const std::vector<int32_t>& props, ::aidl::android::hardware::automotive::vehicle::VehiclePropConfigs* returnConfigs) override; ::ndk::ScopedAStatus subscribe( const std::shared_ptr<::aidl::android::hardware::automotive::vehicle::IVehicleCallback>& callback, const std::vector<::aidl::android::hardware::automotive::vehicle::SubscribeOptions>& options, int32_t maxSharedMemoryFileCount) override; ::ndk::ScopedAStatus unsubscribe( const std::shared_ptr<::aidl::android::hardware::automotive::vehicle::IVehicleCallback>& callback, const std::vector<int32_t>& propIds) override; ::ndk::ScopedAStatus returnSharedMemory( const std::shared_ptr<::aidl::android::hardware::automotive::vehicle::IVehicleCallback>& callback, int64_t sharedMemoryId) override; }; } // namespace vehicle } // namespace automotive } // namespace hardware } // namespace android #endif // android_hardware_automotive_vehicle_aidl_impl_vhal_include_DefaultVehicleHal_H_ automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp 0 → 100644 +78 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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. */ #define LOG_TAG "DefaultVehicleHal" #include <DefaultVehicleHal.h> #include <VehicleHalTypes.h> namespace android { namespace hardware { namespace automotive { namespace vehicle { using ::aidl::android::hardware::automotive::vehicle::GetValueRequests; using ::aidl::android::hardware::automotive::vehicle::IVehicleCallback; using ::aidl::android::hardware::automotive::vehicle::SetValueRequests; using ::aidl::android::hardware::automotive::vehicle::SubscribeOptions; using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfigs; using ::ndk::ScopedAStatus; ScopedAStatus DefaultVehicleHal::getAllPropConfigs(VehiclePropConfigs*) { // TODO(b/200737967): implement this. return ScopedAStatus::ok(); } ScopedAStatus DefaultVehicleHal::getValues(const std::shared_ptr<IVehicleCallback>&, const GetValueRequests&) { // TODO(b/200737967): implement this. return ScopedAStatus::ok(); } ScopedAStatus DefaultVehicleHal::setValues(const std::shared_ptr<IVehicleCallback>&, const SetValueRequests&) { // TODO(b/200737967): implement this. return ScopedAStatus::ok(); } ScopedAStatus DefaultVehicleHal::getPropConfigs(const std::vector<int32_t>&, VehiclePropConfigs*) { // TODO(b/200737967): implement this. return ScopedAStatus::ok(); } ScopedAStatus DefaultVehicleHal::subscribe(const std::shared_ptr<IVehicleCallback>&, const std::vector<SubscribeOptions>&, int32_t) { // TODO(b/200737967): implement this. return ScopedAStatus::ok(); } ScopedAStatus DefaultVehicleHal::unsubscribe(const std::shared_ptr<IVehicleCallback>&, const std::vector<int32_t>&) { // TODO(b/200737967): implement this. return ScopedAStatus::ok(); } ScopedAStatus DefaultVehicleHal::returnSharedMemory(const std::shared_ptr<IVehicleCallback>&, int64_t) { // TODO(b/200737967): implement this. return ScopedAStatus::ok(); } } // namespace vehicle } // namespace automotive } // namespace hardware } // namespace android automotive/vehicle/aidl/impl/vhal/src/VehicleService.cpp 0 → 100644 +51 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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. */ #define LOG_TAG "VehicleService" #include <DefaultVehicleHal.h> #include <android/binder_manager.h> #include <android/binder_process.h> #include <utils/Log.h> using ::android::hardware::automotive::vehicle::DefaultVehicleHal; int main(int /* argc */, char* /* argv */[]) { std::shared_ptr<DefaultVehicleHal> vhal = ndk::SharedRefBase::make<DefaultVehicleHal>(); ALOGI("Registering as service..."); binder_exception_t err = AServiceManager_addService(vhal->asBinder().get(), "android.hardware.automotive.vehicle"); if (err != EX_NONE) { ALOGE("failed to register android.hardware.automotive.vehicle service, exception: %d", err); return 1; } if (!ABinderProcess_setThreadPoolMaxThreadCount(4)) { ALOGE("%s", "failed to set thread pool max thread count"); return 1; } ABinderProcess_startThreadPool(); ALOGI("Vehicle Service Ready"); ABinderProcess_joinThreadPool(); ALOGI("Vehicle Service Exiting"); return 0; } Loading
automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +1 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ #include <aidl/android/hardware/automotive/vehicle/VehicleLightSwitch.h> #include <aidl/android/hardware/automotive/vehicle/VehicleOilLevel.h> #include <aidl/android/hardware/automotive/vehicle/VehiclePropConfig.h> #include <aidl/android/hardware/automotive/vehicle/VehiclePropConfigs.h> #include <aidl/android/hardware/automotive/vehicle/VehiclePropError.h> #include <aidl/android/hardware/automotive/vehicle/VehiclePropValue.h> #include <aidl/android/hardware/automotive/vehicle/VehicleProperty.h> Loading
automotive/vehicle/aidl/impl/vhal/Android.bp 0 → 100644 +30 −0 Original line number Diff line number Diff line // Copyright (C) 2021 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. cc_binary { name: "android.hardware.automotive.vehicle-aidl-default-service", defaults: ["VehicleHalDefaults"], local_include_dirs: ["include"], vintf_fragments: ["vhal-default-service.xml"], init_rc: ["vhal-default-service.rc"], vendor: true, relative_install_path: "hw", srcs: ["src/*.cpp"], static_libs: [ "VehicleHalUtils", ], shared_libs: [ "libbinder_ndk", ], }
automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h 0 → 100644 +66 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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. */ #ifndef android_hardware_automotive_vehicle_aidl_impl_vhal_include_DefaultVehicleHal_H_ #define android_hardware_automotive_vehicle_aidl_impl_vhal_include_DefaultVehicleHal_H_ #include <aidl/android/hardware/automotive/vehicle/BnVehicle.h> namespace android { namespace hardware { namespace automotive { namespace vehicle { class DefaultVehicleHal final : public ::aidl::android::hardware::automotive::vehicle::BnVehicle { ::ndk::ScopedAStatus getAllPropConfigs( ::aidl::android::hardware::automotive::vehicle::VehiclePropConfigs* returnConfigs) override; ::ndk::ScopedAStatus getValues( const std::shared_ptr<::aidl::android::hardware::automotive::vehicle::IVehicleCallback>& callback, const ::aidl::android::hardware::automotive::vehicle::GetValueRequests& requests) override; ::ndk::ScopedAStatus setValues( const std::shared_ptr<::aidl::android::hardware::automotive::vehicle::IVehicleCallback>& callback, const ::aidl::android::hardware::automotive::vehicle::SetValueRequests& requests) override; ::ndk::ScopedAStatus getPropConfigs( const std::vector<int32_t>& props, ::aidl::android::hardware::automotive::vehicle::VehiclePropConfigs* returnConfigs) override; ::ndk::ScopedAStatus subscribe( const std::shared_ptr<::aidl::android::hardware::automotive::vehicle::IVehicleCallback>& callback, const std::vector<::aidl::android::hardware::automotive::vehicle::SubscribeOptions>& options, int32_t maxSharedMemoryFileCount) override; ::ndk::ScopedAStatus unsubscribe( const std::shared_ptr<::aidl::android::hardware::automotive::vehicle::IVehicleCallback>& callback, const std::vector<int32_t>& propIds) override; ::ndk::ScopedAStatus returnSharedMemory( const std::shared_ptr<::aidl::android::hardware::automotive::vehicle::IVehicleCallback>& callback, int64_t sharedMemoryId) override; }; } // namespace vehicle } // namespace automotive } // namespace hardware } // namespace android #endif // android_hardware_automotive_vehicle_aidl_impl_vhal_include_DefaultVehicleHal_H_
automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp 0 → 100644 +78 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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. */ #define LOG_TAG "DefaultVehicleHal" #include <DefaultVehicleHal.h> #include <VehicleHalTypes.h> namespace android { namespace hardware { namespace automotive { namespace vehicle { using ::aidl::android::hardware::automotive::vehicle::GetValueRequests; using ::aidl::android::hardware::automotive::vehicle::IVehicleCallback; using ::aidl::android::hardware::automotive::vehicle::SetValueRequests; using ::aidl::android::hardware::automotive::vehicle::SubscribeOptions; using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfigs; using ::ndk::ScopedAStatus; ScopedAStatus DefaultVehicleHal::getAllPropConfigs(VehiclePropConfigs*) { // TODO(b/200737967): implement this. return ScopedAStatus::ok(); } ScopedAStatus DefaultVehicleHal::getValues(const std::shared_ptr<IVehicleCallback>&, const GetValueRequests&) { // TODO(b/200737967): implement this. return ScopedAStatus::ok(); } ScopedAStatus DefaultVehicleHal::setValues(const std::shared_ptr<IVehicleCallback>&, const SetValueRequests&) { // TODO(b/200737967): implement this. return ScopedAStatus::ok(); } ScopedAStatus DefaultVehicleHal::getPropConfigs(const std::vector<int32_t>&, VehiclePropConfigs*) { // TODO(b/200737967): implement this. return ScopedAStatus::ok(); } ScopedAStatus DefaultVehicleHal::subscribe(const std::shared_ptr<IVehicleCallback>&, const std::vector<SubscribeOptions>&, int32_t) { // TODO(b/200737967): implement this. return ScopedAStatus::ok(); } ScopedAStatus DefaultVehicleHal::unsubscribe(const std::shared_ptr<IVehicleCallback>&, const std::vector<int32_t>&) { // TODO(b/200737967): implement this. return ScopedAStatus::ok(); } ScopedAStatus DefaultVehicleHal::returnSharedMemory(const std::shared_ptr<IVehicleCallback>&, int64_t) { // TODO(b/200737967): implement this. return ScopedAStatus::ok(); } } // namespace vehicle } // namespace automotive } // namespace hardware } // namespace android
automotive/vehicle/aidl/impl/vhal/src/VehicleService.cpp 0 → 100644 +51 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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. */ #define LOG_TAG "VehicleService" #include <DefaultVehicleHal.h> #include <android/binder_manager.h> #include <android/binder_process.h> #include <utils/Log.h> using ::android::hardware::automotive::vehicle::DefaultVehicleHal; int main(int /* argc */, char* /* argv */[]) { std::shared_ptr<DefaultVehicleHal> vhal = ndk::SharedRefBase::make<DefaultVehicleHal>(); ALOGI("Registering as service..."); binder_exception_t err = AServiceManager_addService(vhal->asBinder().get(), "android.hardware.automotive.vehicle"); if (err != EX_NONE) { ALOGE("failed to register android.hardware.automotive.vehicle service, exception: %d", err); return 1; } if (!ABinderProcess_setThreadPoolMaxThreadCount(4)) { ALOGE("%s", "failed to set thread pool max thread count"); return 1; } ABinderProcess_startThreadPool(); ALOGI("Vehicle Service Ready"); ABinderProcess_joinThreadPool(); ALOGI("Vehicle Service Exiting"); return 0; }