1 /* |
|
2 * Copyright (c) 2010 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 #include <e32base.h> |
|
19 #include <NormalHardcodedAssert.h> |
|
20 |
|
21 #include "stifassertmacros.h" |
|
22 |
|
23 #include "mockcusbhosteventnotificationobserver.h" |
|
24 |
|
25 #include "debug.h" |
|
26 #include "panic.h" |
|
27 |
|
28 // --------------------------------------------------------------------------- |
|
29 // ?description_if_needed |
|
30 // --------------------------------------------------------------------------- |
|
31 // |
|
32 CUsbHostEventNotificationObserver::CUsbHostEventNotificationObserver( |
|
33 RUsb* aUsb) : |
|
34 iUsb(aUsb) |
|
35 { |
|
36 } |
|
37 |
|
38 // --------------------------------------------------------------------------- |
|
39 // ?description_if_needed |
|
40 // --------------------------------------------------------------------------- |
|
41 // |
|
42 void CUsbHostEventNotificationObserver::ConstructL() |
|
43 { |
|
44 } |
|
45 |
|
46 CUsbHostEventNotificationObserver* CUsbHostEventNotificationObserver::NewL( |
|
47 RUsb* aUsb) |
|
48 { |
|
49 LOG(( "[USBOTGWATCHER]\tMockCUsbHostEventNotificationObserver::NewL" ) ); |
|
50 |
|
51 CUsbHostEventNotificationObserver* self = new( ELeave ) CUsbHostEventNotificationObserver(aUsb); |
|
52 CleanupStack::PushL(self); |
|
53 self->ConstructL(); |
|
54 CleanupStack::Pop(self); |
|
55 return self; |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // ?description_if_needed |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 CUsbHostEventNotificationObserver::~CUsbHostEventNotificationObserver() |
|
63 { |
|
64 LOG(( "[USBOTGWATCHER]\tMockCUsbHostEventNotificationObserver::~CUsbHostEventNotificationObserver" ) ); |
|
65 } |
|
66 |
|
67 void CUsbHostEventNotificationObserver::SubscribeL( |
|
68 MUsbHostEventNotificationObserver& aObserver) |
|
69 { |
|
70 LOG(("[USBOTGWATCHER]\tMockCUsbHostEventNotificationObserver::SubscribeL")); |
|
71 STIF_ASSERT_NOT_NULL(&aObserver); |
|
72 |
|
73 iObserver = &aObserver; |
|
74 } |
|
75 |
|
76 void CUsbHostEventNotificationObserver::UnsubscribeL( |
|
77 MUsbHostEventNotificationObserver& aObserver) |
|
78 { |
|
79 LOG(("[USBOTGWATCHER]\tMockCUsbHostEventNotificationObserver::UnsubscribeL")); |
|
80 STIF_ASSERT_NOT_NULL(&aObserver); |
|
81 |
|
82 iObserver = NULL; |
|
83 } |
|
84 |
|
85 void CUsbHostEventNotificationObserver::TriggerDeviceAttachedL(TDeviceEventInformation eventInfo) |
|
86 { |
|
87 STIF_ASSERT_NOT_NULL(iObserver); |
|
88 |
|
89 //.iEventType = EDeviceAttachment |
|
90 iObserver->DeviceAttachedL(eventInfo); |
|
91 |
|
92 } |
|
93 |
|
94 void CUsbHostEventNotificationObserver::TriggerDeviceDetachedL(TDeviceEventInformation eventInfo) |
|
95 { |
|
96 STIF_ASSERT_NOT_NULL(iObserver); |
|
97 |
|
98 //.iEventType = EDeviceDetachment |
|
99 iObserver->DeviceDetachedL(eventInfo); |
|
100 } |
|
101 |
|
102 void CUsbHostEventNotificationObserver::TriggerDriverLoadSuccessL(TDeviceEventInformation eventInfo) |
|
103 { |
|
104 STIF_ASSERT_NOT_NULL(iObserver); |
|
105 |
|
106 //.iEventType = EDriverLoad, .iDriverLoadStatus = EDriverLoadSuccess |
|
107 iObserver->DriverLoadSuccessL(eventInfo); |
|
108 } |
|
109 |
|
110 void CUsbHostEventNotificationObserver::TriggerDriverLoadPartialSuccessL(TDeviceEventInformation eventInfo) |
|
111 { |
|
112 STIF_ASSERT_NOT_NULL(iObserver); |
|
113 |
|
114 //.iEventType = EDriverLoad, .iDriverLoadStatus = EDriverLoadPartialSuccess |
|
115 iObserver->DriverLoadPartialSuccessL(eventInfo); |
|
116 } |
|
117 |
|
118 void CUsbHostEventNotificationObserver::TriggerDriverLoadFailureL(TDeviceEventInformation eventInfo) |
|
119 { |
|
120 STIF_ASSERT_NOT_NULL(iObserver); |
|
121 |
|
122 //.iEventType = EDriverLoad, .iDriverLoadStatus = EDriverLoadFailure |
|
123 iObserver->DriverLoadFailureL(eventInfo); |
|
124 } |
|
125 |
|