blob: ab59a9758d4e0eb270f15e29629a2be3ff85587a [file] [log] [blame]
Paul Keithbde3a832020-01-27 20:19:30 -06001/*
2 * Copyright (C) 2020 The LineageOS Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#define LOG_TAG "android.hardware.ir@1.0-service.samsung"
18
19#include <android-base/logging.h>
20#include <hidl/HidlTransportSupport.h>
21#include <utils/Errors.h>
22
23#include "ConsumerIr.h"
24
25using android::hardware::configureRpcThreadpool;
26using android::hardware::joinRpcThreadpool;
27
28using android::hardware::ir::V1_0::IConsumerIr;
29using android::hardware::ir::V1_0::implementation::ConsumerIr;
30
31using android::OK;
32using android::sp;
33using android::status_t;
34
35int main() {
36 sp<IConsumerIr> ir = new ConsumerIr();
37
38 configureRpcThreadpool(1, true);
39
40 status_t status = ir->registerAsService();
41
42 if (status != OK) {
43 LOG(ERROR) << "Could not register service for IR HAL";
44 goto shutdown;
45 }
46
47 LOG(INFO) << "IR HAL service is Ready.";
48 joinRpcThreadpool();
49
50shutdown:
51 // In normal operation, we don't expect the thread pool to shutdown
52 LOG(ERROR) << "IR HAL failed to join thread pool.";
53 return 1;
54}