1 /******************************************************************************
2  *
3  *  Copyright 2018 NXP
4  *  Copyright 2018 ST Microelectronics S.A.
5  *
6  *  Licensed under the Apache License, Version 2.0 (the "License");
7  *  you may not use this file except in compliance with the License.
8  *  You may obtain a copy of the License at
9  *
10  *  http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *  Unless required by applicable law or agreed to in writing, software
13  *  distributed under the License is distributed on an "AS IS" BASIS,
14  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *  See the License for the specific language governing permissions and
16  *  limitations under the License.
17  *
18  ******************************************************************************/
19 
20 #define LOG_TAG "stnfc@1.1-service.st"
21 #include <android/hardware/nfc/1.1/INfc.h>
22 
23 #include <hidl/LegacySupport.h>
24 #include "Nfc.h"
25 
26 // Generated HIDL files
27 using android::OK;
28 using android::sp;
29 using android::status_t;
30 using android::hardware::configureRpcThreadpool;
31 using android::hardware::joinRpcThreadpool;
32 using android::hardware::nfc::V1_1::INfc;
33 using android::hardware::nfc::V1_1::implementation::Nfc;
34 
main()35 int main() {
36   ALOGD(" ST NFC HAL Service 1.1 is starting.");
37   sp<INfc> nfc_service = new Nfc();
38 
39   configureRpcThreadpool(1, true /*callerWillJoin*/);
40   status_t status = nfc_service->registerAsService();
41   if (status != OK) {
42     LOG_ALWAYS_FATAL("Could not register service for NFC HAL Iface (%d).",
43                      status);
44     return -1;
45   }
46   ALOGD(" ST NFC service is ready");
47   joinRpcThreadpool();
48   return 1;
49 }
50