1 #ifndef __VTS_DRIVER__android_hardware_nfc_V1_0_INfc__
2 #define __VTS_DRIVER__android_hardware_nfc_V1_0_INfc__
3 
4 #undef LOG_TAG
5 #define LOG_TAG "FuzzerExtended_android_hardware_nfc_V1_0_INfc"
6 
7 #include <log/log.h>
8 #include <stdarg.h>
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <string.h>
12 
13 #include <driver_base/DriverBase.h>
14 #include <driver_base/DriverCallbackBase.h>
15 
16 #include <VtsDriverCommUtil.h>
17 
18 #include <android/hardware/nfc/1.0/INfc.h>
19 #include <hidl/HidlSupport.h>
20 #include <android/hardware/nfc/1.0/INfcClientCallback.h>
21 #include <android/hardware/nfc/1.0/NfcClientCallback.vts.h>
22 #include <android/hardware/nfc/1.0/types.h>
23 #include <android/hardware/nfc/1.0/types.vts.h>
24 #include <android/hidl/base/1.0/types.h>
25 
26 
27 using namespace android::hardware::nfc::V1_0;
28 namespace android {
29 namespace vts {
30 
31 class Vts_android_hardware_nfc_V1_0_INfc : public ::android::hardware::nfc::V1_0::INfc, public DriverCallbackBase {
32  public:
Vts_android_hardware_nfc_V1_0_INfc(const string & callback_socket_name)33     Vts_android_hardware_nfc_V1_0_INfc(const string& callback_socket_name)
34         : callback_socket_name_(callback_socket_name) {};
35 
36     virtual ~Vts_android_hardware_nfc_V1_0_INfc() = default;
37 
38     ::android::hardware::Return<::android::hardware::nfc::V1_0::NfcStatus> open(
39         const sp<::android::hardware::nfc::V1_0::INfcClientCallback>& arg0) override;
40 
41     ::android::hardware::Return<uint32_t> write(
42         const ::android::hardware::hidl_vec<uint8_t>& arg0) override;
43 
44     ::android::hardware::Return<::android::hardware::nfc::V1_0::NfcStatus> coreInitialized(
45         const ::android::hardware::hidl_vec<uint8_t>& arg0) override;
46 
47     ::android::hardware::Return<::android::hardware::nfc::V1_0::NfcStatus> prediscover(
48         ) override;
49 
50     ::android::hardware::Return<::android::hardware::nfc::V1_0::NfcStatus> close(
51         ) override;
52 
53     ::android::hardware::Return<::android::hardware::nfc::V1_0::NfcStatus> controlGranted(
54         ) override;
55 
56     ::android::hardware::Return<::android::hardware::nfc::V1_0::NfcStatus> powerCycle(
57         ) override;
58 
59 
60  private:
61     string callback_socket_name_;
62 };
63 
64 sp<::android::hardware::nfc::V1_0::INfc> VtsFuzzerCreateVts_android_hardware_nfc_V1_0_INfc(const string& callback_socket_name);
65 
66 class FuzzerExtended_android_hardware_nfc_V1_0_INfc : public DriverBase {
67  public:
FuzzerExtended_android_hardware_nfc_V1_0_INfc()68     FuzzerExtended_android_hardware_nfc_V1_0_INfc() : DriverBase(HAL_HIDL), hw_binder_proxy_() {}
69 
FuzzerExtended_android_hardware_nfc_V1_0_INfc(::android::hardware::nfc::V1_0::INfc * hw_binder_proxy)70     explicit FuzzerExtended_android_hardware_nfc_V1_0_INfc(::android::hardware::nfc::V1_0::INfc* hw_binder_proxy) : DriverBase(HAL_HIDL), hw_binder_proxy_(hw_binder_proxy) {}
GetHidlInterfaceProxy()71     uint64_t GetHidlInterfaceProxy() const {
72         return reinterpret_cast<uintptr_t>(hw_binder_proxy_.get());
73     }
74  protected:
75     bool Fuzz(FunctionSpecificationMessage* func_msg, void** result, const string& callback_socket_name);
76     bool CallFunction(const FunctionSpecificationMessage& func_msg, const string& callback_socket_name, FunctionSpecificationMessage* result_msg);
77     bool VerifyResults(const FunctionSpecificationMessage& expected_result, const FunctionSpecificationMessage& actual_result);
78     bool GetAttribute(FunctionSpecificationMessage* func_msg, void** result);
79     bool GetService(bool get_stub, const char* service_name);
80 
81  private:
82     sp<::android::hardware::nfc::V1_0::INfc> hw_binder_proxy_;
83 };
84 
85 
86 extern "C" {
87 extern android::vts::DriverBase* vts_func_4_android_hardware_nfc_V1_0_INfc_();
88 extern android::vts::DriverBase* vts_func_4_android_hardware_nfc_V1_0_INfc_with_arg(uint64_t hw_binder_proxy);
89 }
90 }  // namespace vts
91 }  // namespace android
92 #endif
93