1 /*
2  * Copyright (C) 2017 The Android Open Source 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 #define LOG_TAG "android.hardware.vibrator@1.3-service.coral"
17 
18 #include <hidl/HidlSupport.h>
19 #include <hidl/HidlTransportSupport.h>
20 #include <utils/Errors.h>
21 #include <utils/StrongPointer.h>
22 
23 #include "Hardware.h"
24 #include "Vibrator.h"
25 
26 using android::hardware::configureRpcThreadpool;
27 using android::hardware::joinRpcThreadpool;
28 using android::hardware::vibrator::V1_3::implementation::HwApi;
29 using android::hardware::vibrator::V1_3::implementation::HwCal;
30 using android::hardware::vibrator::V1_3::implementation::Vibrator;
31 using namespace android;
32 
registerVibratorService()33 status_t registerVibratorService() {
34     sp<Vibrator> vibrator = new Vibrator(std::make_unique<HwApi>(), std::make_unique<HwCal>());
35 
36     return vibrator->registerAsService();
37 }
38 
main()39 int main() {
40     configureRpcThreadpool(1, true);
41     status_t status = registerVibratorService();
42 
43     if (status != OK) {
44         return status;
45     }
46 
47     joinRpcThreadpool();
48 }
49