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