| /* |
| * Copyright 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 "CanController.h" |
| |
| #include <android-base/logging.h> |
| #include <android/binder_manager.h> |
| #include <android/binder_process.h> |
| |
| namespace android::hardware::automotive::can { |
| |
| using namespace std::string_literals; |
| using ::aidl::android::hardware::automotive::can::CanController; |
| |
| extern "C" int main() { |
| base::SetDefaultTag("CanController"); |
| base::SetMinimumLogSeverity(base::VERBOSE); |
| |
| LOG(VERBOSE) << "Starting up..."; |
| auto service = ndk::SharedRefBase::make<CanController>(); |
| const auto instance = CanController::descriptor + "/default"s; |
| const auto status = AServiceManager_addService(service->asBinder().get(), instance.c_str()); |
| CHECK_EQ(status, STATUS_OK) << "Failed to add service " << instance; |
| LOG(VERBOSE) << "Started successfully!"; |
| |
| ABinderProcess_joinThreadPool(); |
| LOG(FATAL) << "CanController exited unexpectedly!"; |
| return EXIT_FAILURE; |
| } |
| } // namespace android::hardware::automotive::can |