summaryrefslogtreecommitdiffstats
path: root/libwifi_hal/include
diff options
context:
space:
mode:
authorChristopher Wiley <wiley@google.com>2016-06-24 14:25:38 -0700
committerChristopher Wiley <wiley@google.com>2016-06-27 08:50:44 -0700
commit00aa56eb2fb48a1097abbf35b2a58234477672e5 (patch)
tree5c7a8112936d9ea0d301196e3a83e5b9ef797380 /libwifi_hal/include
parentddf9ccd8144d8d381d1f5b5a625d17113229febf (diff)
downloadandroid_frameworks_opt_net_wifi-00aa56eb2fb48a1097abbf35b2a58234477672e5.tar.gz
android_frameworks_opt_net_wifi-00aa56eb2fb48a1097abbf35b2a58234477672e5.tar.bz2
android_frameworks_opt_net_wifi-00aa56eb2fb48a1097abbf35b2a58234477672e5.zip
Allow some HAL interactions to be mocked
Wrap them in a very thin class to simple mocking. While here, simplify the interface for consumers by exposing simple knobs to change the firmware mode. Bug: 29634806 Change-Id: I49f567f04f0d5b2bcbda3c308ceb4fdd37b3a8b2 Test: Compiles, wificond can consume this code in tests.
Diffstat (limited to 'libwifi_hal/include')
-rw-r--r--libwifi_hal/include/wifi_hal/driver_tool.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/libwifi_hal/include/wifi_hal/driver_tool.h b/libwifi_hal/include/wifi_hal/driver_tool.h
new file mode 100644
index 000000000..f1a43cc0c
--- /dev/null
+++ b/libwifi_hal/include/wifi_hal/driver_tool.h
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+#ifndef ANDROID_WIFI_SYSTEM_DRIVER_TOOL_H
+#define ANDROID_WIFI_SYSTEM_DRIVER_TOOL_H
+
+namespace android {
+namespace wifi_hal {
+
+// Utilities for interacting with the driver.
+class DriverTool {
+ public:
+ static const int kFirmwareModeSta;
+ static const int kFirmwareModeAp;
+ static const int kFirmwareModeP2p;
+
+ DriverTool() = default;
+ virtual ~DriverTool() = default;
+
+ // These methods allow manipulation of the WiFi driver.
+ // They all return true on success, and false otherwise.
+ virtual bool LoadDriver();
+ virtual bool UnloadDriver();
+ virtual bool IsDriverLoaded();
+
+ // Change the firmware mode.
+ // |mode| is one of the kFirmwareMode* constants defined above.
+ // Returns true on success, and false otherwise.
+ virtual bool ChangeFirmwareMode(int mode);
+
+}; // class DriverTool
+
+} // namespace wifi_hal
+} // namespace android
+
+#endif // ANDROID_WIFI_SYSTEM_DRIVER_TOOL_H
+