40
|
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: CSconSyncSession implementation
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include "sconsyncsession.h"
|
|
20 |
|
|
21 |
#include "sconsyncserver.h"
|
|
22 |
#include "sconsyncclientserver.h"
|
|
23 |
#include "sconasynchandler.h"
|
|
24 |
#include "debug.h"
|
|
25 |
|
|
26 |
|
|
27 |
CSconSyncSession::CSconSyncSession()
|
|
28 |
{
|
|
29 |
TRACE_FUNC;
|
|
30 |
}
|
|
31 |
|
|
32 |
CSconSyncSession* CSconSyncSession::NewL()
|
|
33 |
{
|
|
34 |
TRACE_FUNC;
|
|
35 |
CSconSyncSession* self = new(ELeave) CSconSyncSession();
|
|
36 |
CleanupStack::PushL( self );
|
|
37 |
self->ConstructL();
|
|
38 |
CleanupStack::Pop( self );
|
|
39 |
return self;
|
|
40 |
}
|
|
41 |
|
|
42 |
void CSconSyncSession::ConstructL()
|
|
43 |
{
|
|
44 |
TRACE_FUNC_ENTRY;
|
|
45 |
iAsyncHandler = CSconAsyncHandler::NewL();
|
|
46 |
TRACE_FUNC_EXIT;
|
|
47 |
}
|
|
48 |
|
|
49 |
void CSconSyncSession::CreateL()
|
|
50 |
{
|
|
51 |
TRACE_FUNC;
|
|
52 |
Server().AddSession();
|
|
53 |
}
|
|
54 |
|
|
55 |
CSconSyncSession::~CSconSyncSession()
|
|
56 |
{
|
|
57 |
TRACE_FUNC_ENTRY;
|
|
58 |
delete iAsyncHandler;
|
|
59 |
|
|
60 |
Server().RemoveSession();
|
|
61 |
|
|
62 |
TRACE_FUNC_EXIT;
|
|
63 |
}
|
|
64 |
|
|
65 |
CSconSyncServer& CSconSyncSession::Server()
|
|
66 |
{
|
|
67 |
return *static_cast<CSconSyncServer*>(const_cast<CServer2*>(CSession2::Server()));
|
|
68 |
}
|
|
69 |
|
|
70 |
|
|
71 |
// -----------------------------------------------------------------------------
|
|
72 |
// CSconSyncSession::ServiceL()
|
|
73 |
// Handles the client request
|
|
74 |
// -----------------------------------------------------------------------------
|
|
75 |
//
|
|
76 |
void CSconSyncSession::ServiceL(const RMessage2& aMessage)
|
|
77 |
{
|
|
78 |
TRACE_FUNC_ENTRY;
|
|
79 |
|
|
80 |
TRAPD( err, iAsyncHandler->HandleServiceL( aMessage ));
|
|
81 |
if ( err )
|
|
82 |
{
|
|
83 |
LOGGER_WRITE_1("iAsyncHandler->HandleServiceL leaved: %d", err);
|
|
84 |
if ( iAsyncHandler->IsActive() )
|
|
85 |
{
|
|
86 |
LOGGER_WRITE(" and it was active -> Cancel it");
|
|
87 |
iAsyncHandler->Cancel();
|
|
88 |
}
|
|
89 |
// do server error processing
|
|
90 |
User::Leave( err );
|
|
91 |
}
|
|
92 |
|
|
93 |
TRACE_FUNC_EXIT;
|
|
94 |
}
|
|
95 |
|
|
96 |
|