1 /* |
1 /* |
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
21 #include "sconpcd.h" |
21 #include "sconpcd.h" |
22 #include "sconpcdconsts.h" |
22 #include "sconpcdconsts.h" |
23 #include "sconinstqueue.h" |
23 #include "sconinstqueue.h" |
24 #include "sconbrqueue.h" |
24 #include "sconbrqueue.h" |
25 #include "sconmetadata.h" |
25 #include "sconmetadata.h" |
|
26 #include "sconsynchandler.h" |
26 #include "debug.h" |
27 #include "debug.h" |
|
28 |
|
29 const TInt KMaxObjectSize(65536); // informed to PC |
27 |
30 |
28 // ============================= MEMBER FUNCTIONS =============================== |
31 // ============================= MEMBER FUNCTIONS =============================== |
29 |
32 |
30 |
33 |
31 // ----------------------------------------------------------------------------- |
34 // ----------------------------------------------------------------------------- |
58 // ----------------------------------------------------------------------------- |
61 // ----------------------------------------------------------------------------- |
59 // CSConPCD::CSConPCD() |
62 // CSConPCD::CSConPCD() |
60 // Constructor |
63 // Constructor |
61 // ----------------------------------------------------------------------------- |
64 // ----------------------------------------------------------------------------- |
62 // |
65 // |
63 CSConPCD::CSConPCD() : iInstallerQueue( NULL ), iBackupRestoreQueue( NULL ), |
66 CSConPCD::CSConPCD() |
64 iLatestReply(NULL), iTaskNumber( 0 ), iMaxObjectSize( 65536 ), |
67 { |
65 iLastOperation( ENoTask ) |
|
66 { |
|
67 TRACE_FUNC; |
|
68 } |
68 } |
69 |
69 |
70 // ----------------------------------------------------------------------------- |
70 // ----------------------------------------------------------------------------- |
71 // CSConPCD::ConstructL() |
71 // CSConPCD::ConstructL() |
72 // Initializes member data |
72 // Initializes member data |
74 // |
74 // |
75 void CSConPCD::ConstructL() |
75 void CSConPCD::ConstructL() |
76 { |
76 { |
77 TRACE_FUNC_ENTRY; |
77 TRACE_FUNC_ENTRY; |
78 User::LeaveIfError( iFs.Connect() ); |
78 User::LeaveIfError( iFs.Connect() ); |
|
79 if ( !CActiveScheduler::Current() ) |
|
80 { |
|
81 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler(); |
|
82 CActiveScheduler::Install( scheduler ); |
|
83 } |
|
84 |
79 iInstallerQueue = CSConInstallerQueue::NewL( iFs ); |
85 iInstallerQueue = CSConInstallerQueue::NewL( iFs ); |
80 iBackupRestoreQueue = CSConBackupRestoreQueue::NewL( iMaxObjectSize, iFs ); |
86 iBackupRestoreQueue = CSConBackupRestoreQueue::NewL( iFs ); |
81 iInstallerQueue->QueueAddress( iBackupRestoreQueue ); |
87 iInstallerQueue->QueueAddress( iBackupRestoreQueue ); |
82 iBackupRestoreQueue->QueueAddress( iInstallerQueue ); |
88 iBackupRestoreQueue->QueueAddress( iInstallerQueue ); |
83 |
89 |
84 if ( !CActiveScheduler::Current() ) |
90 iSyncHandler = CSconSyncHandler::NewL( iFs ); |
85 { |
|
86 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler(); |
|
87 CActiveScheduler::Install( scheduler ); |
|
88 } |
|
89 CActiveScheduler::Add( iInstallerQueue ); |
|
90 CActiveScheduler::Add( iBackupRestoreQueue ); |
|
91 TRACE_FUNC_EXIT; |
91 TRACE_FUNC_EXIT; |
92 } |
92 } |
93 |
93 |
94 // ----------------------------------------------------------------------------- |
94 // ----------------------------------------------------------------------------- |
95 // CSConPCD::~CSConPCD() |
95 // CSConPCD::~CSConPCD() |
97 // ----------------------------------------------------------------------------- |
97 // ----------------------------------------------------------------------------- |
98 // |
98 // |
99 CSConPCD::~CSConPCD() |
99 CSConPCD::~CSConPCD() |
100 { |
100 { |
101 TRACE_FUNC_ENTRY; |
101 TRACE_FUNC_ENTRY; |
102 if ( iInstallerQueue ) |
102 delete iInstallerQueue; |
103 { |
103 delete iBackupRestoreQueue; |
104 iInstallerQueue->Cancel(); |
104 delete iLatestReply; |
105 delete iInstallerQueue; |
105 delete iSyncHandler; |
106 iInstallerQueue = NULL; |
|
107 } |
|
108 |
|
109 if ( iBackupRestoreQueue ) |
|
110 { |
|
111 iBackupRestoreQueue->Cancel(); |
|
112 delete iBackupRestoreQueue; |
|
113 iBackupRestoreQueue = NULL; |
|
114 } |
|
115 |
|
116 if ( iLatestReply ) |
|
117 { |
|
118 delete iLatestReply; |
|
119 iLatestReply = NULL; |
|
120 } |
|
121 |
|
122 iFs.Close(); |
106 iFs.Close(); |
123 TRACE_FUNC_EXIT; |
107 TRACE_FUNC_EXIT; |
124 } |
108 } |
125 |
109 |
126 // ----------------------------------------------------------------------------- |
110 // ----------------------------------------------------------------------------- |
253 if ( iBackupRestoreQueue ) |
237 if ( iBackupRestoreQueue ) |
254 { |
238 { |
255 LOGGER_WRITE( "CSConPCD::ResetPCD() : Reseting backup queue" ); |
239 LOGGER_WRITE( "CSConPCD::ResetPCD() : Reseting backup queue" ); |
256 iBackupRestoreQueue->Reset(); |
240 iBackupRestoreQueue->Reset(); |
257 } |
241 } |
|
242 |
|
243 TRACE_FUNC_EXIT; |
|
244 } |
|
245 |
|
246 // ----------------------------------------------------------------------------- |
|
247 // CSConPCD::HandleGetSyncRequestL() |
|
248 // |
|
249 // ----------------------------------------------------------------------------- |
|
250 // |
|
251 void CSConPCD::HandleGetSyncRequestL( const TDesC8& aRequest, RWriteStream& aResult, TInt aMaxObjectSize ) |
|
252 { |
|
253 TRACE_FUNC_ENTRY; |
|
254 iSyncHandler->HandleGetSyncRequestL( aRequest, aResult, aMaxObjectSize ); |
|
255 |
|
256 TRACE_FUNC_EXIT; |
|
257 } |
|
258 |
|
259 // ----------------------------------------------------------------------------- |
|
260 // CSConPCD::HandlePutSyncRequestL() |
|
261 // |
|
262 // ----------------------------------------------------------------------------- |
|
263 // |
|
264 void CSConPCD::HandlePutSyncRequestL( const TDesC8& aRequest, RReadStream& aResult ) |
|
265 { |
|
266 TRACE_FUNC_ENTRY; |
|
267 iSyncHandler->HandlePutSyncRequestL( aRequest, aResult ); |
258 |
268 |
259 TRACE_FUNC_EXIT; |
269 TRACE_FUNC_EXIT; |
260 } |
270 } |
261 |
271 |
262 // ----------------------------------------------------------------------------- |
272 // ----------------------------------------------------------------------------- |
575 CleanupStack::Pop( taskReply ); |
584 CleanupStack::Pop( taskReply ); |
576 CleanupStack::Pop( reply ); |
585 CleanupStack::Pop( reply ); |
577 LOGGER_WRITE_1( "CSConPCD::UpdateDeviceInfo() : returned %d", ret ); |
586 LOGGER_WRITE_1( "CSConPCD::UpdateDeviceInfo() : returned %d", ret ); |
578 return ret; |
587 return ret; |
579 } |
588 } |
580 |
|
581 // ----------------------------------------------------------------------------- |
|
582 // CSConPCD::GetMaxObjectSize( TInt /*aClientObjectSize*/ ) const |
|
583 // Gets the current max object size |
|
584 // ----------------------------------------------------------------------------- |
|
585 // |
|
586 TInt CSConPCD::GetMaxObjectSize( TInt /*aClientObjectSize*/ ) const |
|
587 { |
|
588 LOGGER_WRITE_1( "CSConPCD::GetMaxObjectSize() : returned %d", iMaxObjectSize ); |
|
589 return iMaxObjectSize; |
|
590 } |
|
591 |
589 |
592 // End of file |
590 // End of file |