|
1 /* |
|
2 * Copyright (c) 2002-2007 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: This class is a subsession handle with operations related to |
|
15 * local access. |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <epos_poslmservercommon.h> |
|
23 #include <epos_rposlandmarkserver.h> |
|
24 |
|
25 #include "epos_rposlmlocalnameindex.h" |
|
26 #include "EPos_RPosLmLocalAccessSubsession.h" |
|
27 |
|
28 // ================= MEMBER FUNCTIONS ======================= |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 RPosLmLocalAccessSubsession::RPosLmLocalAccessSubsession() |
|
34 : RSubSessionBase(), |
|
35 iEventPtr(NULL, 0) |
|
36 { |
|
37 } |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // ----------------------------------------------------------------------------- |
|
41 // |
|
42 TInt RPosLmLocalAccessSubsession::Open( RPosLandmarkServer& aServer ) |
|
43 { |
|
44 return CreateSubSession(aServer, |
|
45 EPosLmServerRegisterLocalAccessSubsession); |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 void RPosLmLocalAccessSubsession::Close() |
|
52 { |
|
53 CloseSubSession( EPosLmServerUnregisterSubsession ); |
|
54 } |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 void RPosLmLocalAccessSubsession::RegisterSessionL( const TDesC& aUri ) |
|
60 { |
|
61 User::LeaveIfError( |
|
62 SendReceive(EPosLmServerRegisterSession, TIpcArgs(&aUri))); |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 void RPosLmLocalAccessSubsession::NotifyDatabaseEvent( |
|
69 TPosLmEvent &aEvent, |
|
70 TRequestStatus& aStatus) |
|
71 { |
|
72 iEventPtr.Set(reinterpret_cast<TUint8*>(&aEvent), sizeof(TPosLmEvent), |
|
73 sizeof(TPosLmEvent)); |
|
74 |
|
75 SendReceive(EPosLmServerListenForLmEvent, TIpcArgs(&iEventPtr), aStatus); |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 TInt RPosLmLocalAccessSubsession::CancelNotifyDatabaseEvent() |
|
82 { |
|
83 return SendReceive(EPosLmServerCancelListenForLmEvent, |
|
84 TIpcArgs(TIpcArgs::ENothing)); |
|
85 } |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 TInt RPosLmLocalAccessSubsession::ReportEvent( |
|
91 TPosLmEventType aEventType, |
|
92 TPosLmItemId aId) |
|
93 { |
|
94 TPosLmEvent event; |
|
95 event.iEventType = aEventType; |
|
96 event.iLandmarkItemId = aId; |
|
97 TPckgBuf<TPosLmEvent> eventPckg(event); |
|
98 |
|
99 return SendReceive(EPosLmServerReportLmEvent, TIpcArgs(&eventPckg)); |
|
100 } |
|
101 |
|
102 // ----------------------------------------------------------------------------- |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 TInt RPosLmLocalAccessSubsession::SetDatabaseLock( |
|
106 CPosLmLocalDatabase::TLockType aLockType ) |
|
107 { |
|
108 return SendReceive( EPosLmServerDbLock, TIpcArgs( |
|
109 ETrue, // Set lock |
|
110 aLockType == CPosLmLocalDatabase::EWriteLock ? ETrue : EFalse ) ); |
|
111 } |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // ----------------------------------------------------------------------------- |
|
115 // |
|
116 TInt RPosLmLocalAccessSubsession::ReleaseDatabaseLock( |
|
117 CPosLmLocalDatabase::TLockType aLockType ) |
|
118 { |
|
119 return SendReceive( EPosLmServerDbLock, TIpcArgs( |
|
120 EFalse, // Release lock |
|
121 aLockType == CPosLmLocalDatabase::EWriteLock ? ETrue : EFalse ) ); |
|
122 } |
|
123 |
|
124 // ----------------------------------------------------------------------------- |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 void RPosLmLocalAccessSubsession::CreateDefaultDbL( |
|
128 const TDesC& aUri, |
|
129 TBool aReplaceDb) |
|
130 { |
|
131 TPckgC<TBool> pkg(aReplaceDb); |
|
132 User::LeaveIfError(SendReceive(EPosLmServerCreateDefaultDb, |
|
133 TIpcArgs(&aUri, &pkg))); |
|
134 } |
|
135 |
|
136 // ----------------------------------------------------------------------------- |
|
137 // ----------------------------------------------------------------------------- |
|
138 // |
|
139 TInt RPosLmLocalAccessSubsession::InitializeDbSync( CPosLmLocalInitializeOp::TInitializeType /*aInitType*/ ) |
|
140 { |
|
141 return SendReceive( EPosLmServerInitializeSync, TIpcArgs( TIpcArgs::ENothing ) ); |
|
142 } |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // ----------------------------------------------------------------------------- |
|
146 // |
|
147 void RPosLmLocalAccessSubsession::InitializeDbAsync( |
|
148 CPosLmLocalInitializeOp::TInitializeType /*aInitType*/, |
|
149 TPckgBuf<TInt>* aStatusPckg, |
|
150 TPckg<TReal32>* aProgressPckg, |
|
151 TPckg<TUint>* aInitFlagPckg, |
|
152 TRequestStatus& aStatus) |
|
153 { |
|
154 TIpcArgs args( aStatusPckg, aProgressPckg, aInitFlagPckg ); |
|
155 SendReceive( EPosLmServerInitializeAsync, args, aStatus ); |
|
156 } |
|
157 |
|
158 // ----------------------------------------------------------------------------- |
|
159 // ----------------------------------------------------------------------------- |
|
160 // |
|
161 TInt RPosLmLocalAccessSubsession::CancelInitializeDbAsync( CPosLmLocalInitializeOp::TInitializeType /*aInitType*/ ) |
|
162 { |
|
163 return SendReceive( EPosLmServerInitializeCancel, TIpcArgs( TIpcArgs::ENothing ) ); |
|
164 } |
|
165 |