#ifndef ANDROID_HARDWARE_WIFI_OFFLOAD_V1_0_OFFLOAD_H #define ANDROID_HARDWARE_WIFI_OFFLOAD_V1_0_OFFLOAD_H #include #include #include #include #include "offload_server.h" namespace { // Type of callback invoked by the death handler. using on_death_cb_function = std::function; // Private class used to keep track of death of callbacks template class HidlDeathHandler : public android::hardware::hidl_death_recipient { public: HidlDeathHandler(const on_death_cb_function &user_cb_function) : cb_function_(user_cb_function) { } ~HidlDeathHandler() = default; // Death notification for callbacks. void serviceDied(uint64_t cookie, const android::wp& /* who */) override { cb_.clear(); cb_function_(cookie); } void setCallback(android::wp cb) { cb_ = cb; } private: android::wp cb_; on_death_cb_function cb_function_; DISALLOW_COPY_AND_ASSIGN(HidlDeathHandler); }; } // namespace namespace android { namespace hardware { namespace wifi { namespace offload { namespace V1_0 { namespace implementation { /** * Interface object to communicate with Offload HAL */ class Offload : public IOffload { public: Offload(); // Methods from ::android::hardware::wifi::offload::V1_0::IOffload follow. Return configureScans(const ScanParam ¶m, const ScanFilter &filter, configureScans_cb _hidl_cb) override; Return getScanStats(getScanStats_cb _hidl_cb) override; Return subscribeScanResults(uint32_t delayMs, subscribeScanResults_cb _hidl_cb) override; Return unsubscribeScanResults() override; Return setEventCallback(const sp& cb) override; // Methods from ::android::hidl::base::V1_0::IBase follow. private: OffloadStatus configureScansInternal(const ScanParam ¶m, const ScanFilter &filter); std::pair getScanStatsInternal(); OffloadStatus subscribeScanResultsInternal(uint32_t delayMs); void onObjectDeath(uint64_t cookie); std::unique_ptr mOffloadServer; uint64_t cookie_; sp> death_handler_; DISALLOW_COPY_AND_ASSIGN(Offload); }; } // namespace implementation } // namespace V1_0 } // namespace offload } // namespace wifi } // namespace hardware } // namespace android #endif // ANDROID_HARDWARE_WIFI_OFFLOAD_V1_0_OFFLOAD_H