|
1 /* |
|
2 * Copyright (c) 2002-2004 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: Pure virtual main service base class for ASY |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "ASYProxyCommsService.h" |
|
21 #include "ASYProxyMainService.h" |
|
22 #include "acc_debug.h" |
|
23 #include <AsyMainServiceBase.h> |
|
24 #include <e32svr.h> |
|
25 |
|
26 // EXTERNAL DATA STRUCTURES |
|
27 |
|
28 // EXTERNAL FUNCTION PROTOTYPES |
|
29 |
|
30 // CONSTANTS |
|
31 |
|
32 // MACROS |
|
33 |
|
34 // LOCAL CONSTANTS AND MACROS |
|
35 |
|
36 // MODULE DATA STRUCTURES |
|
37 |
|
38 // LOCAL FUNCTION PROTOTYPES |
|
39 |
|
40 // FORWARD DECLARATIONS |
|
41 |
|
42 // ============================= LOCAL FUNCTIONS =============================== |
|
43 |
|
44 // ============================ MEMBER FUNCTIONS =============================== |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CASYMainServiceBase::CASYMainServiceBase |
|
48 // C++ default constructor can NOT contain any code, that |
|
49 // might leave. |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 EXPORT_C CASYMainServiceBase::CASYMainServiceBase() |
|
53 { |
|
54 API_TRACE_( "[AccFW:AsyProxy] CASYMainServiceBase::CASYMainServiceBase()" ); |
|
55 |
|
56 iGlobalParams.iStartlFlag = EFalse; |
|
57 iGlobalParams.iSignalFlag = EFalse; |
|
58 |
|
59 API_TRACE_( "[AccFW:AsyProxy] CASYMainServiceBase::CASYMainServiceBase" ); |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CASYMainServiceBase::ConstructL |
|
64 // Symbian 2nd phase constructor can leave. |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 void CASYMainServiceBase::ConstructL( CASYProxyCommsService* aCommsService ) |
|
68 { |
|
69 COM_TRACE_1( "[AccFW:AsyProxy] CASYMainServiceBase::ConstructL(0x%x)", aCommsService ); |
|
70 |
|
71 iCommsService = aCommsService; |
|
72 |
|
73 COM_TRACE_( "[AccFW:AsyProxy] CASYMainServiceBase::ConstructL - return void" ); |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CASYMainServiceBase::NewL |
|
78 // Two-phased constructor. |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 CASYMainServiceBase* CASYMainServiceBase::NewL( |
|
82 CASYProxyCommsService* aCommsService, |
|
83 TUid aImplementationUidAsyService ) |
|
84 { |
|
85 COM_TRACE_1( "[AccFW:AsyProxy] CASYMainServiceBase::NewL(0x%x)", aCommsService ); |
|
86 |
|
87 TAny* tmpEcom = NULL; |
|
88 TInt err(0); |
|
89 COM_TRACE_1( "[AccFW:AsyProxy] CASYMainServiceBase::NewL - Before REComSession::CreateImplementationL - 0x%x", aImplementationUidAsyService.iUid ); |
|
90 |
|
91 TRAP( err, tmpEcom = REComSession::CreateImplementationL( |
|
92 aImplementationUidAsyService, |
|
93 _FOFF( CASYMainServiceBase, iDtor_ID_Key ) ) ); |
|
94 |
|
95 COM_TRACE_1( "[AccFW:AsyProxy] CASYMainServiceBase::NewL - After REComSession::CreateImplementationL - err == %d", err ); |
|
96 |
|
97 CASYMainServiceBase* theChosenOne = REINTERPRET_CAST( |
|
98 CASYMainServiceBase*, |
|
99 tmpEcom ); |
|
100 |
|
101 COM_TRACE_1( "[AccFW:AsyProxy] CASYMainServiceBase::::NewL - theChosenOne == 0x%x", theChosenOne ); |
|
102 |
|
103 theChosenOne->ConstructL( aCommsService ); |
|
104 |
|
105 COM_TRACE_1( "[AccFW:AsyProxy] CASYMainServiceBase::NewL - return 0x%x", theChosenOne ); |
|
106 |
|
107 return theChosenOne; |
|
108 } |
|
109 |
|
110 // Destructor |
|
111 EXPORT_C CASYMainServiceBase::~CASYMainServiceBase() |
|
112 { |
|
113 API_TRACE_( "[AccFW:AsyProxy] CASYMainServiceBase::~CASYMainServiceBase()" ); |
|
114 |
|
115 if ( iCommsService ) |
|
116 { |
|
117 delete iCommsService; |
|
118 iCommsService = NULL; |
|
119 } |
|
120 |
|
121 REComSession::DestroyedImplementation(iDtor_ID_Key); |
|
122 |
|
123 API_TRACE_( "[AccFW:AsyProxy] CASYMainServiceBase::~CASYMainServiceBase" ); |
|
124 } |
|
125 |
|
126 |
|
127 // ----------------------------------------------------------------------------- |
|
128 // CASYMainServiceBase::Session |
|
129 // Returns session for server |
|
130 // (other items were commented in a header). |
|
131 // ----------------------------------------------------------------------------- |
|
132 // |
|
133 EXPORT_C RAccessoryServer& CASYMainServiceBase::Session() |
|
134 { |
|
135 API_TRACE_( "[AccFW:AsyProxy] CASYMainServiceBase::Session()" ); |
|
136 |
|
137 return iCommsService->GetServerSession(); |
|
138 } |
|
139 |
|
140 // ----------------------------------------------------------------------------- |
|
141 // CASYMainServiceBase::Signal |
|
142 // Changes ASY's status flag state and informs Accessory Server thread |
|
143 // (other items were commented in a header). |
|
144 // ----------------------------------------------------------------------------- |
|
145 // |
|
146 EXPORT_C void CASYMainServiceBase::Signal() |
|
147 { |
|
148 API_TRACE_( "[AccFW:AsyProxy] CASYMainServiceBase::Signal()" ); |
|
149 |
|
150 if ( iGlobalParams.iStartlFlag != EFalse ) // Asynchronous ASY |
|
151 { |
|
152 iGlobalParams.iThreadStatus = EASYThreadSyncLoadOkSignalOk; |
|
153 RThread::Rendezvous( iGlobalParams.iThreadStatus ); |
|
154 } |
|
155 else // Synchronous ASY |
|
156 { |
|
157 iGlobalParams.iSignalFlag = ETrue; |
|
158 } |
|
159 |
|
160 API_TRACE_( "[AccFW:AsyProxy] CASYMainServiceBase::Signal - return void" ); |
|
161 } |
|
162 |
|
163 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
164 |
|
165 // End of File |