summaryrefslogtreecommitdiffstats
path: root/server.cpp
diff options
context:
space:
mode:
authorChristopher Wiley <wiley@google.com>2016-07-18 15:30:58 -0700
committerChristopher Wiley <wiley@google.com>2016-07-22 12:09:58 -0700
commit1f8dd4511dc210fb0e49e8619ceaa039bd82aa52 (patch)
tree9a3e8ed7b37cd72aab74854ba45a14ff86c13e0a /server.cpp
parentc5f37c05c57b56fc0a5709075e2b32ab6115b5ac (diff)
downloadplatform_system_connectivity_wificond-1f8dd4511dc210fb0e49e8619ceaa039bd82aa52.tar.gz
platform_system_connectivity_wificond-1f8dd4511dc210fb0e49e8619ceaa039bd82aa52.tar.bz2
platform_system_connectivity_wificond-1f8dd4511dc210fb0e49e8619ceaa039bd82aa52.zip
Control hostapd from IApInterface
Add AIDL interfaces, implementation, and tests to wificond. Bug: 30040724 Test: unitests pass Test: integration tests pass Change-Id: I75339d64bf92941de26c7552b6b711cbea00eb80
Diffstat (limited to 'server.cpp')
-rw-r--r--server.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/server.cpp b/server.cpp
index d281613..dff3d44 100644
--- a/server.cpp
+++ b/server.cpp
@@ -21,15 +21,22 @@
using android::binder::Status;
using android::sp;
using android::IBinder;
+using std::string;
using std::vector;
using std::unique_ptr;
using android::net::wifi::IApInterface;
using android::wifi_hal::DriverTool;
using android::wifi_system::HalTool;
+using android::wifi_system::HostapdManager;
using android::wifi_system::InterfaceTool;
namespace android {
namespace wificond {
+namespace {
+
+const char kNetworkInterfaceName[] = "wlan0";
+
+} // namespace
Server::Server(unique_ptr<HalTool> hal_tool,
unique_ptr<InterfaceTool> if_tool,
@@ -48,11 +55,14 @@ Status Server::createApInterface(sp<IApInterface>* created_interface) {
return Status::ok();
}
- if (!SetupInterfaceForMode(DriverTool::kFirmwareModeAp)) {
+ string interface_name;
+ if (!SetupInterfaceForMode(DriverTool::kFirmwareModeAp, &interface_name)) {
return Status::ok(); // Logging was done internally
}
- unique_ptr<ApInterfaceImpl> ap_interface(new ApInterfaceImpl);
+ unique_ptr<ApInterfaceImpl> ap_interface(new ApInterfaceImpl(
+ interface_name,
+ unique_ptr<HostapdManager>(new HostapdManager)));
*created_interface = ap_interface->GetBinder();
ap_interfaces_.push_back(std::move(ap_interface));
return Status::ok();
@@ -69,7 +79,8 @@ Status Server::tearDownInterfaces() {
return Status::ok();
}
-bool Server::SetupInterfaceForMode(int mode) {
+bool Server::SetupInterfaceForMode(int mode, string* interface_name) {
+ string result;
if (!driver_tool_->LoadDriver()) {
LOG(ERROR) << "Failed to load WiFi driver!";
return false;
@@ -81,6 +92,7 @@ bool Server::SetupInterfaceForMode(int mode) {
// TODO: Confirm the ap interface is ready for use by checking its
// nl80211 published capabilities.
+ *interface_name = kNetworkInterfaceName;
return true;
}