From 8267511c96e3226e45a0be773ee442b66261824d Mon Sep 17 00:00:00 2001 From: vchtchetkine Date: Fri, 24 Jul 2009 11:30:41 -0700 Subject: 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. --- host/windows/usb/api/adb_api.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'host/windows/usb/api/adb_api.cpp') 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(); -- cgit v1.2.3