LOCAL_SRC_FILES := \
ipc_constants.cpp \
aidl/android/net/wifi/IApInterface.aidl \
+ aidl/android/net/wifi/IANQPDoneCallback.aidl \
aidl/android/net/wifi/IClientInterface.aidl \
aidl/android/net/wifi/IInterfaceEventCallback.aidl \
aidl/android/net/wifi/IWificond.aidl
--- /dev/null
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.net.wifi;
+
+// A callback for receiving ANQP reply events.
+interface IANQPDoneCallback {
+ // |anqp_result| is null if we timed out waiting for response from the AP
+ // with bssid |bssid|.
+ oneway void OnANQPDone(in byte[] bssid, in byte[] anqp_result);
+}
package android.net.wifi;
+import android.net.wifi.IANQPDoneCallback;
+
// IClientInterface represents a network interface that can be used to connect
// to access points and obtain internet connectivity.
interface IClientInterface {
@utf8InCpp
String getInterfaceName();
+ // Query specified ANQP elements from an AP (specified by BSSID)
+ // and provide a callback for ANQP response.
+ // Returns true if request is sent successfully, false otherwise.
+ boolean requestANQP(in byte[] bssid, IANQPDoneCallback callback);
}
#include "wificond/client_interface_impl.h"
using android::binder::Status;
+using android::net::wifi::IANQPDoneCallback;
using std::vector;
namespace android {
return Status::ok();
}
+Status ClientInterfaceBinder::requestANQP(
+ const vector<uint8_t>& bssid,
+ const sp<IANQPDoneCallback>& callback,
+ bool* out_success) {
+ if (impl_ == nullptr) {
+ *out_success = false;
+ return Status::ok();
+ }
+ *out_success = impl_->requestANQP(bssid, callback);
+ return Status::ok();
+}
+
} // namespace wificond
} // namespace android
::android::binder::Status getMacAddress(
std::vector<uint8_t>* out_mac_address) override;
::android::binder::Status getInterfaceName(std::string* out_name) override;
+ ::android::binder::Status requestANQP(
+ const ::std::vector<uint8_t>& bssid,
+ const ::android::sp<::android::net::wifi::IANQPDoneCallback>& callback,
+ bool* out_success) override;
private:
ClientInterfaceImpl* impl_;
// TODO(nywang): Send these scan results back to java framework.
}
+bool ClientInterfaceImpl::requestANQP(
+ const ::std::vector<uint8_t>& bssid,
+ const ::android::sp<::android::net::wifi::IANQPDoneCallback>& callback) {
+ // TODO(nywang): query ANQP information from wpa_supplicant.
+ return true;
+}
+
} // namespace wificond
} // namespace android
bool GetPacketCounters(std::vector<int32_t>* out_packet_counters);
bool SignalPoll(std::vector<int32_t>* out_signal_poll_results);
const std::vector<uint8_t>& GetMacAddress();
- std::string GetInterfaceName() { return interface_name_; }
+ const std::string& GetInterfaceName() const { return interface_name_; }
+ bool requestANQP(
+ const ::std::vector<uint8_t>& bssid,
+ const ::android::sp<::android::net::wifi::IANQPDoneCallback>& callback);
private:
void OnScanResultsReady(uint32_t interface_index,