|
1 /* |
|
2 * Copyright (c) 2002-2006 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: A base class for active handlers |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "AccSrvHandlerBase.h" |
|
22 #include "acc_debug.h" |
|
23 |
|
24 // EXTERNAL DATA STRUCTURES |
|
25 |
|
26 // EXTERNAL FUNCTION PROTOTYPES |
|
27 |
|
28 // CONSTANTS |
|
29 |
|
30 // MACROS |
|
31 |
|
32 // LOCAL CONSTANTS AND MACROS |
|
33 |
|
34 // MODULE DATA STRUCTURES |
|
35 |
|
36 // LOCAL FUNCTION PROTOTYPES |
|
37 |
|
38 // FORWARD DECLARATIONS |
|
39 |
|
40 // ============================= LOCAL FUNCTIONS =============================== |
|
41 |
|
42 // ============================ MEMBER FUNCTIONS =============================== |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CAccSrvHandlerBase::CAccSrvHandlerBase |
|
46 // C++ default constructor can NOT contain any code, that |
|
47 // might leave. |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 CAccSrvHandlerBase::CAccSrvHandlerBase() : |
|
51 CActive( EPriorityStandard ) //This will exceed accessory server thread priority "EPriorityNormal" |
|
52 { |
|
53 //Never called since only NewL(MAccSrvConnectionControllerObserver* aCallback) is defined |
|
54 TRACE_ASSERT_ALWAYS; |
|
55 } |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // CAccSrvHandlerBase::CAccSrvHandlerBase |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 CAccSrvHandlerBase::CAccSrvHandlerBase( |
|
62 MAccSrvConnectionControllerObserver* aCallback) : |
|
63 CActive( EPriorityStandard ),//This will exceed accessory server thread priority "EPriorityNormal" |
|
64 iCallback( aCallback ) |
|
65 { |
|
66 COM_TRACE_( "[AccFW:AccServer] CAccSrvHandlerBase::CAccSrvHandlerBase()" ); |
|
67 |
|
68 CActiveScheduler::Add( this );//Add the active object to the active scheduler |
|
69 |
|
70 COM_TRACE_( "[AccFW:AccServer] CAccSrvHandlerBase::CAccSrvHandlerBase - return" ); |
|
71 } |
|
72 |
|
73 // Destructor |
|
74 CAccSrvHandlerBase::~CAccSrvHandlerBase() |
|
75 { |
|
76 COM_TRACE_( "[AccFW:AccServer] CAccSrvHandlerBase::~CAccSrvHandlerBase()" ); |
|
77 |
|
78 Cancel(); |
|
79 |
|
80 COM_TRACE_( "[AccFW:AccServer] CAccSrvHandlerBase::~CAccSrvHandlerBase - return" ); |
|
81 } |
|
82 |
|
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // CAccSrvHandlerBase::IssueRequest |
|
86 // Starts asynchronous handling. |
|
87 // (other items were commented in a header). |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 void CAccSrvHandlerBase::IssueRequest() |
|
91 { |
|
92 COM_TRACE_( "[AccFW:AccServer] CAccSrvHandlerBase::IssueRequest()" ); |
|
93 |
|
94 Cancel();// Latest request will be served because it contains real time |
|
95 // information e.g. in connection status update |
|
96 |
|
97 iStatus = KRequestPending; |
|
98 SetActive(); |
|
99 |
|
100 TRequestStatus* status = &iStatus; |
|
101 |
|
102 User::RequestComplete(status, KErrNone);//RunL() function will get called |
|
103 |
|
104 COM_TRACE_( "[AccFW:AccServer] CAccSrvHandlerBase::IssueRequest - return void" ); |
|
105 } |
|
106 |
|
107 // ----------------------------------------------------------------------------- |
|
108 // CAccSrvHandlerBase::DoCancel |
|
109 // (other items were commented in a header). |
|
110 // ----------------------------------------------------------------------------- |
|
111 // |
|
112 void CAccSrvHandlerBase::DoCancel() |
|
113 { |
|
114 COM_TRACE_( "[AccFW:AccServer] CAccSrvHandlerBase::DoCancel()" ); |
|
115 |
|
116 COM_TRACE_( "[AccFW:AccServer] CAccSrvHandlerBase::DoCancel - return void" ); |
|
117 } |
|
118 |
|
119 // ----------------------------------------------------------------------------- |
|
120 // CAccSrvHandlerBase::RunError |
|
121 // |
|
122 // Called if RunL Leaves and this is not overwritten in inherited class. |
|
123 // (other items were commented in a header). |
|
124 // ----------------------------------------------------------------------------- |
|
125 // |
|
126 TInt CAccSrvHandlerBase::RunError(TInt /*aError*/) |
|
127 { |
|
128 COM_TRACE_( "[AccFW:AccServer] CAccSrvHandlerBase::RunError()" ); |
|
129 |
|
130 COM_TRACE_( "[AccFW:AccServer] CAccSrvHandlerBase::RunError - return KErrNone" ); |
|
131 return KErrNone; |
|
132 } |
|
133 |
|
134 // End of File |