summaryrefslogtreecommitdiffstats
path: root/host/windows/usb/api/adb_api.cpp
diff options
context:
space:
mode:
authorvchtchetkine <vchtchetkine@google.com>2009-07-24 11:30:41 -0700
committervchtchetkine <vchtchetkine@google.com>2009-07-25 11:14:04 -0700
commit8267511c96e3226e45a0be773ee442b66261824d (patch)
tree809016f2b528a45e55112bcf2987c253b54f6c7d /host/windows/usb/api/adb_api.cpp
parentf74c1d2fb76ed6f3a08c76f3c4dc7c783c39383c (diff)
downloadandroid_development-8267511c96e3226e45a0be773ee442b66261824d.tar.gz
android_development-8267511c96e3226e45a0be773ee442b66261824d.tar.bz2
android_development-8267511c96e3226e45a0be773ee442b66261824d.zip
Refactor API classes to support both, WinUsb and Legacy API
To support both, WinUsb and Legacy driver APIs we need to abstract classes that depend on driver API details and then implement two sets of the actual classes: one for WinUsb, and another for the Legacy drivers, so we can choose in runtime which objects should be instantiated, depending on what type of driver we have underneath this API.
Diffstat (limited to 'host/windows/usb/api/adb_api.cpp')
-rw-r--r--host/windows/usb/api/adb_api.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/host/windows/usb/api/adb_api.cpp b/host/windows/usb/api/adb_api.cpp
index eadf07abc..f9bd94e6c 100644
--- a/host/windows/usb/api/adb_api.cpp
+++ b/host/windows/usb/api/adb_api.cpp
@@ -24,6 +24,8 @@
#include "adb_object_handle.h"
#include "adb_interface_enum.h"
#include "adb_interface.h"
+#include "adb_winusb_interface.h"
+#include "adb_legacy_interface.h"
#include "adb_endpoint_object.h"
#include "adb_io_completion.h"
#include "adb_helper_routines.h"
@@ -100,7 +102,11 @@ ADBAPIHANDLE __cdecl AdbCreateInterfaceByName(
try {
// Instantiate object
- obj = new AdbInterfaceObject(interface_name);
+ if (IsLegacyInterface(interface_name)) {
+ obj = new AdbLegacyInterfaceObject(interface_name);
+ } else {
+ obj = new AdbWinUsbInterfaceObject(interface_name);
+ }
// Create handle for it
ret = obj->CreateHandle();