|
1 /* |
|
2 * Copyright (c) 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 #include "USBObexApiTestActiveObject.h" |
|
19 |
|
20 // ----------------------------------------------------------------------------- |
|
21 // CUSBObexApiTestActiveObject::CUSBObexApiTestActiveObject |
|
22 // C++ default constructor can NOT contain any code, that |
|
23 // might leave. |
|
24 // ----------------------------------------------------------------------------- |
|
25 // |
|
26 CUSBObexApiTestActiveObject::CUSBObexApiTestActiveObject( CStifLogger* aLog, |
|
27 CUsbClassControllerPlugIn* aUsbClassControllerPlugIn ) : |
|
28 CActive( EPriorityStandard ) |
|
29 { |
|
30 iUsbClassControllerPlugIn = aUsbClassControllerPlugIn; |
|
31 iLog = aLog; |
|
32 } |
|
33 |
|
34 // Destructor |
|
35 CUSBObexApiTestActiveObject::~CUSBObexApiTestActiveObject() |
|
36 { |
|
37 Cancel(); |
|
38 } |
|
39 |
|
40 // --------------------------------------------------------------------------- |
|
41 // CUSBObexApiTestActiveObject::RunL |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 void CUSBObexApiTestActiveObject::RunL() |
|
45 { |
|
46 iLog->Log( _L("ActiveTestObject::RunL")); |
|
47 CActiveScheduler::Stop(); |
|
48 iLog->Log( _L("ActiveScheduler Stopped")); |
|
49 iUsbServiceState = iUsbClassControllerPlugIn -> State(); |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // CUSBObexApiTestActiveObject::NewL |
|
54 // Two-phased constructor. |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 CUSBObexApiTestActiveObject* CUSBObexApiTestActiveObject::NewL( |
|
58 CStifLogger* aLog, CUsbClassControllerPlugIn* aUsbClassControllerPlugIn ) |
|
59 { |
|
60 CUSBObexApiTestActiveObject* self = new ( ELeave )CUSBObexApiTestActiveObject( aLog, aUsbClassControllerPlugIn ); |
|
61 CleanupStack::PushL( self ); |
|
62 self->ConstructL(); |
|
63 CleanupStack::Pop( self ); |
|
64 return self; |
|
65 } |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // CUSBObexApiTestActiveObject::ConstructL |
|
69 // Symbian 2nd phase constructor can leave. |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 void CUSBObexApiTestActiveObject::ConstructL() |
|
73 { |
|
74 CActiveScheduler::Add( this ); |
|
75 } |
|
76 |
|
77 // --------------------------------------------------------------------------- |
|
78 // CUSBObexApiTestActiveObject::DoCancel |
|
79 // --------------------------------------------------------------------------- |
|
80 // |
|
81 void CUSBObexApiTestActiveObject::DoCancel() |
|
82 { |
|
83 iLog->Log( _L("ActiveTestObject::DoCancel")); |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------------------------- |
|
87 // CUSBObexApiTestActiveObject::Start |
|
88 // --------------------------------------------------------------------------- |
|
89 // |
|
90 void CUSBObexApiTestActiveObject::Start() |
|
91 { |
|
92 iUsbClassControllerPlugIn -> Start( iStatus ); |
|
93 SetActive(); |
|
94 iLog->Log( _L("Obex Controller Started")); |
|
95 } |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // CUSBObexApiTestActiveObject::Stop |
|
99 // --------------------------------------------------------------------------- |
|
100 // |
|
101 void CUSBObexApiTestActiveObject::Stop() |
|
102 { |
|
103 iUsbClassControllerPlugIn -> Stop( iStatus ); |
|
104 SetActive(); |
|
105 iLog->Log( _L("Obex Controller Stopped")); |
|
106 } |
|
107 |