Loading nfc/1.0/default/Android.mk +23 −0 Original line number Diff line number Diff line Loading @@ -6,3 +6,26 @@ LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_SRC_FILES := Nfc.cpp LOCAL_SHARED_LIBRARIES := liblog libcutils libhardware libhwbinder libbase libcutils libutils libhidl android.hardware.nfc@1.0 include $(BUILD_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_MODULE := android.hardware.nfc@1.0-service LOCAL_INIT_RC := android.hardware.nfc@1.0-service.rc LOCAL_SRC_FILES := \ service.cpp \ LOCAL_SHARED_LIBRARIES := \ liblog \ libcutils \ libdl \ libbase \ libutils \ libhardware_legacy \ libhardware \ LOCAL_SHARED_LIBRARIES += \ libhwbinder \ libhidl \ android.hardware.nfc@1.0 \ include $(BUILD_EXECUTABLE) nfc/1.0/default/Nfc.cpp +3 −0 Original line number Diff line number Diff line #define LOG_TAG "android.hardware.nfc@1.0-impl" #include <utils/Log.h> #include <hardware/hardware.h> #include <hardware/nfc.h> #include "Nfc.h" Loading nfc/1.0/default/android.hardware.nfc@1.0-service.rc 0 → 100644 +4 −0 Original line number Diff line number Diff line service nfc_hal_service /system/bin/hw/android.hardware.nfc@1.0-service class hal user nfc group nfc readproc nfc/1.0/default/service.cpp 0 → 100644 +44 −0 Original line number Diff line number Diff line #define LOG_TAG "android.hardware.nfc@1.0-service" #include <utils/Log.h> #include <iostream> #include <unistd.h> #include <android/hardware/nfc/1.0/INfc.h> #include <hidl/IServiceManager.h> #include <hwbinder/IPCThreadState.h> #include <hwbinder/ProcessState.h> #include <utils/Errors.h> #include <utils/StrongPointer.h> using android::sp; // libhwbinder: using android::hardware::IPCThreadState; using android::hardware::ProcessState; // Generated HIDL files using android::hardware::nfc::V1_0::INfc; int main() { ALOGI("Service is starting."); const char instance[] = "nfc_nci"; ALOGI("Retrieving default implementation of instance %s.", instance); android::sp<INfc> service = INfc::getService(instance, true); if (service.get() == nullptr) { ALOGE("INfc::getService returned NULL, exiting"); return -1; } ALOGI("Default implementation using %s is %s", instance, (service->isRemote() ? "REMOTE" : "LOCAL")); LOG_FATAL_IF(service->isRemote(), "Implementation is REMOTE!"); ALOGI("Registering instance %s.", instance); service->registerAsService("nfc_nci"); ALOGI("Ready."); ProcessState::self()->setThreadPoolMaxThreadCount(0); ProcessState::self()->startThreadPool(); IPCThreadState::self()->joinThreadPool(); } Loading
nfc/1.0/default/Android.mk +23 −0 Original line number Diff line number Diff line Loading @@ -6,3 +6,26 @@ LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_SRC_FILES := Nfc.cpp LOCAL_SHARED_LIBRARIES := liblog libcutils libhardware libhwbinder libbase libcutils libutils libhidl android.hardware.nfc@1.0 include $(BUILD_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_MODULE := android.hardware.nfc@1.0-service LOCAL_INIT_RC := android.hardware.nfc@1.0-service.rc LOCAL_SRC_FILES := \ service.cpp \ LOCAL_SHARED_LIBRARIES := \ liblog \ libcutils \ libdl \ libbase \ libutils \ libhardware_legacy \ libhardware \ LOCAL_SHARED_LIBRARIES += \ libhwbinder \ libhidl \ android.hardware.nfc@1.0 \ include $(BUILD_EXECUTABLE)
nfc/1.0/default/Nfc.cpp +3 −0 Original line number Diff line number Diff line #define LOG_TAG "android.hardware.nfc@1.0-impl" #include <utils/Log.h> #include <hardware/hardware.h> #include <hardware/nfc.h> #include "Nfc.h" Loading
nfc/1.0/default/android.hardware.nfc@1.0-service.rc 0 → 100644 +4 −0 Original line number Diff line number Diff line service nfc_hal_service /system/bin/hw/android.hardware.nfc@1.0-service class hal user nfc group nfc readproc
nfc/1.0/default/service.cpp 0 → 100644 +44 −0 Original line number Diff line number Diff line #define LOG_TAG "android.hardware.nfc@1.0-service" #include <utils/Log.h> #include <iostream> #include <unistd.h> #include <android/hardware/nfc/1.0/INfc.h> #include <hidl/IServiceManager.h> #include <hwbinder/IPCThreadState.h> #include <hwbinder/ProcessState.h> #include <utils/Errors.h> #include <utils/StrongPointer.h> using android::sp; // libhwbinder: using android::hardware::IPCThreadState; using android::hardware::ProcessState; // Generated HIDL files using android::hardware::nfc::V1_0::INfc; int main() { ALOGI("Service is starting."); const char instance[] = "nfc_nci"; ALOGI("Retrieving default implementation of instance %s.", instance); android::sp<INfc> service = INfc::getService(instance, true); if (service.get() == nullptr) { ALOGE("INfc::getService returned NULL, exiting"); return -1; } ALOGI("Default implementation using %s is %s", instance, (service->isRemote() ? "REMOTE" : "LOCAL")); LOG_FATAL_IF(service->isRemote(), "Implementation is REMOTE!"); ALOGI("Registering instance %s.", instance); service->registerAsService("nfc_nci"); ALOGI("Ready."); ProcessState::self()->setThreadPoolMaxThreadCount(0); ProcessState::self()->startThreadPool(); IPCThreadState::self()->joinThreadPool(); }