|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Symbian Foundation License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // rsecureasbase.cpp |
|
15 // |
|
16 // |
|
17 |
|
18 #include <e32debug.h> |
|
19 #include "cserverlaunch.h" |
|
20 #include "rsecuresessionbase.h" |
|
21 #include "csecureasbase.h" |
|
22 #include "lbsmessageenums.h" |
|
23 #include "lbsdevloggermacros.h" |
|
24 |
|
25 /** Client side session object connects to the server by starting server with specified parameter |
|
26 keep trying to kick off the server! |
|
27 |
|
28 @param aParams A reference to TProcessStartParams object |
|
29 @return Symbian error code |
|
30 @see TProcessStartParams |
|
31 @internalTechnology |
|
32 @released |
|
33 */ |
|
34 TInt RSecureSessionBase::Connect(TServerStartParams& aParams) |
|
35 { |
|
36 // be very cunning :) This has to slot into the existing RPositionServer::Connect |
|
37 // The parameter will have to morph into a local variable but that should be the only change |
|
38 TInt ret; |
|
39 |
|
40 TInt retry = 2; |
|
41 FOREVER |
|
42 { |
|
43 TVersion version = Version(); |
|
44 |
|
45 ret = CreateSession(aParams.GetServerName(), version, aParams.GetNumberOfServerSlots()); |
|
46 |
|
47 if (ret != KErrNotFound && ret != KErrServerTerminated) |
|
48 { |
|
49 break; |
|
50 } |
|
51 |
|
52 if (--retry == 0) |
|
53 { |
|
54 break; |
|
55 } |
|
56 |
|
57 ret = StartServer(aParams); |
|
58 |
|
59 if (ret != KErrAlreadyExists && ret != KErrNone) |
|
60 { |
|
61 break; |
|
62 } |
|
63 } |
|
64 return ret; |
|
65 } |
|
66 |
|
67 /** Client side session object close the session handler |
|
68 |
|
69 @internalTechnology |
|
70 @released |
|
71 */ |
|
72 void RSecureSessionBase::Close() |
|
73 { |
|
74 LBSLOG(ELogP1, "RSecureSessionBase::Close"); |
|
75 RHandleBase::Close(); |
|
76 } |
|
77 |
|
78 /** |
|
79 */ |
|
80 TInt RSecureSessionBase::StartServer(TServerStartParams& aParams) |
|
81 { |
|
82 return (CServerLaunch::ServerLaunch(aParams)); |
|
83 } |
|
84 |
|
85 |
|
86 //------------------------------------------------------------------------------ |
|
87 |
|
88 /** Client side subsession object issue the subsession close request. |
|
89 |
|
90 @internalTechnology |
|
91 @released |
|
92 */ |
|
93 void RSecureSubSessionBase::Close() |
|
94 { |
|
95 CloseSubSession(ESecureSubSessionBaseClose); |
|
96 } |