First public contribution.
1 #ifndef __USB_CLIENT_STATE_WATCHER_H
2 #define __USB_CLIENT_STATE_WATCHER_H
5 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
7 * This component and the accompanying materials are made available
8 * under the terms of the License "Eclipse Public License v1.0"
9 * which accompanies this distribution, and is available
10 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
12 * Initial Contributors:
13 * Nokia Corporation - initial contribution.
18 * @file UsbClientStateWatcher.h
28 #include "testdebug.h"
30 namespace NUnitTesting_USBDI
34 This class describes an interface class that observers state changes in the client
36 class MUsbClientStateObserver
40 Called when the host has changed the state of the client device (e.g. to suspended)
41 @param aNewState the new state of the device configured by the host
42 @param aChangeCompletionCode the request completion code
44 virtual void StateChangeL(TUsbcDeviceState aNewState,TInt aChangeCompletionCode) = 0;
48 This class describes an observer that gets notified when the host selects an alternate setting
50 class MAlternateSettingObserver
54 Called when the host selects an alternate interface setting
55 @param aAlternateInterfaceSetting the alternate interface setting number
57 virtual void AlternateInterfaceSelectedL(TInt aAlternateInterfaceSetting) = 0;
61 This class represents a watcher of USB client device states
64 class CUsbClientStateWatcher : public CActive
68 Factory two-phase construction
69 @param aUsbClientDriver a referrence to a USB client driver interface object
71 static CUsbClientStateWatcher* NewL(RDevUsbcClient& aClientDriver,MUsbClientStateObserver& aStateObserver);
76 ~CUsbClientStateWatcher();
81 Constructor, builds a USB client state change watcher
82 @param aUsbClientDriver the referrence to the USB client driver
84 CUsbClientStateWatcher(RDevUsbcClient& aClientDriver,MUsbClientStateObserver& aStateObserver);
87 2nd phase construction
91 private: // from CActive
94 Cancels the notification of device state changes
99 Handles any Leave errors from this AO as it receives notification
101 @param aError the leave code error from RunL
102 @return KErrNone (currently)
104 TInt RunError(TInt aError);
107 Code that is scheduled when this AO completes
113 The referrence to the USB client driver
115 RDevUsbcClient& iClientDriver;
118 The current state of the USB device (integer value)
123 The observers for the state of the USB client
125 MUsbClientStateObserver& iStateObserver;
130 This class represents a watcher of Alternate interface selections
133 class CAlternateInterfaceSelectionWatcher : public CActive
137 Symbian construction of a watcher of alternate interface setting selections
138 @param aClientDriver the channel to the client driver
139 @param aObserver the observer of alternate interface setting selections
141 static CAlternateInterfaceSelectionWatcher* NewL(RDevUsbcClient& aClientDriver,MAlternateSettingObserver& aObserver);
146 ~CAlternateInterfaceSelectionWatcher();
151 Constructor, builds an object that watchers for selections of alternate interface settings
152 @param aClientDriver the channel to the client driver
153 @param aObserver the observer of alternate interface setting selections
155 CAlternateInterfaceSelectionWatcher(RDevUsbcClient& aClientDriver,MAlternateSettingObserver& aObserver);
158 2nd phase construction
162 private: // From CActive
174 TInt RunError(TInt aError);
178 The referrence to the USB client driver
180 RDevUsbcClient& iClientDriver;
183 The current state of the USB device (integer value)
188 The observer that will be notified when a host selects any alternate interface setting
189 that this watcher knows about
191 MAlternateSettingObserver& iObserver;