1 /* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #include <memory> 17 #include <vector> 18 19 #include <android-base/logging.h> 20 21 #include "wificond/scanning/offload/offload_callback.h" 22 #include "wificond/scanning/offload/offload_scan_manager.h" 23 #include "wificond/scanning/scan_result.h" 24 25 using ::android::hardware::wifi::offload::V1_0::ScanResult; 26 using ::android::hardware::wifi::offload::V1_0::OffloadStatus; 27 using ::android::hardware::hidl_vec; 28 using ::android::hardware::Return; 29 using ::android::hardware::Void; 30 31 namespace android { 32 namespace wificond { 33 OffloadCallback(OffloadCallbackHandlers * handlers)34OffloadCallback::OffloadCallback(OffloadCallbackHandlers* handlers) 35 : handlers_(handlers) {} 36 37 // Methods from ::android::hardware::wifi::offload::V1_0::IOffloadCallback 38 // follow. onScanResult(const hidl_vec<ScanResult> & scan_result)39Return<void> OffloadCallback::onScanResult( 40 const hidl_vec<ScanResult>& scan_result) { 41 if (handlers_ != nullptr) { 42 handlers_->OnScanResultHandler(std::vector<ScanResult>(scan_result)); 43 } else { 44 LOG(WARNING) << "No handler available for Offload scan results"; 45 } 46 return Void(); 47 } 48 onError(const OffloadStatus & status)49Return<void> OffloadCallback::onError(const OffloadStatus& status) { 50 if (handlers_ != nullptr) { 51 handlers_->OnErrorHandler(status); 52 } else { 53 LOG(WARNING) << "No error handler for Offload"; 54 } 55 return Void(); 56 } 57 ~OffloadCallback()58OffloadCallback::~OffloadCallback() {} 59 60 } // namespace wificond 61 } // namespace android 62