|
1 /* |
|
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __LINKSTATENOTIFIER_H__ |
|
19 #define __LINKSTATENOTIFIER_H__ |
|
20 |
|
21 #include <e32base.h> |
|
22 |
|
23 class RDevUsbcClient; |
|
24 |
|
25 |
|
26 const TInt KMaxPacketTypeBulkFS = 64; |
|
27 const TInt KMaxPacketTypeBulkHS = 512; |
|
28 |
|
29 const TInt KDefaultMaxPacketTypeBulk = KMaxPacketTypeBulkFS; |
|
30 |
|
31 |
|
32 class MLinkStateObserver |
|
33 /** |
|
34 * Interface for notifications of link state events. |
|
35 */ |
|
36 { |
|
37 public: |
|
38 virtual void MLSOStateChange(TInt aPacketSize) = 0; |
|
39 }; |
|
40 |
|
41 NONSHARABLE_CLASS(CLinkStateNotifier) : public CActive |
|
42 /** |
|
43 * Active object to request link state notifications. |
|
44 */ |
|
45 { |
|
46 public: |
|
47 static CLinkStateNotifier* NewL(MLinkStateObserver& aParent, |
|
48 RDevUsbcClient& aUsb); |
|
49 ~CLinkStateNotifier(); |
|
50 |
|
51 void Start(); |
|
52 |
|
53 private: // from CActive |
|
54 virtual void DoCancel(); |
|
55 virtual void RunL(); |
|
56 virtual TInt RunError(TInt aError); |
|
57 |
|
58 private: |
|
59 CLinkStateNotifier(MLinkStateObserver& aParent, RDevUsbcClient& aUsb); |
|
60 |
|
61 private: |
|
62 void LinkUp(); |
|
63 void LinkDown(); |
|
64 |
|
65 private: // unowned |
|
66 MLinkStateObserver& iParent; ///< Observer |
|
67 RDevUsbcClient& iUsb; ///< The Ldd to use |
|
68 |
|
69 private: // owned |
|
70 TUint iUsbState; ///< Bitmask representing the endpoints |
|
71 TInt iPacketSize; |
|
72 }; |
|
73 |
|
74 #endif // __LINKSTATENOTIFIER_H__ |