|
1 /* |
|
2 * Copyright (c) 2002-2005 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: Global functions for the landmarks server |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include "EPos_LmServerGlobal.h" |
|
21 #include "EPos_LandmarksServerPanics.h" |
|
22 |
|
23 // ================= MEMBER FUNCTIONS ======================= |
|
24 |
|
25 // --------------------------------------------------------- |
|
26 // --------------------------------------------------------- |
|
27 // |
|
28 TInt LmServerGlobal::Read( |
|
29 const RMessagePtr2& aMessagePtr, |
|
30 TInt aParam, |
|
31 TDes8& aDes, |
|
32 TInt aOffset) |
|
33 { |
|
34 TInt ret = aMessagePtr.Read(aParam, aDes, aOffset); |
|
35 if (ret != KErrNone) |
|
36 { |
|
37 PanicClient(aMessagePtr, EPosUnableToReadOrWriteDataToClient); |
|
38 } |
|
39 return ret; |
|
40 } |
|
41 |
|
42 // --------------------------------------------------------- |
|
43 // --------------------------------------------------------- |
|
44 // |
|
45 TInt LmServerGlobal::Read( |
|
46 const RMessagePtr2& aMessagePtr, |
|
47 TInt aParam, |
|
48 TDes16& aDes, |
|
49 TInt aOffset) |
|
50 { |
|
51 TInt ret = aMessagePtr.Read(aParam, aDes, aOffset); |
|
52 if (ret != KErrNone) |
|
53 { |
|
54 PanicClient(aMessagePtr, EPosUnableToReadOrWriteDataToClient); |
|
55 } |
|
56 return ret; |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------- |
|
60 // --------------------------------------------------------- |
|
61 // |
|
62 TInt LmServerGlobal::Write( |
|
63 const RMessagePtr2& aMessagePtr, |
|
64 TInt aParam, |
|
65 const TDesC8& aDes, |
|
66 TInt aOffset) |
|
67 { |
|
68 TInt ret = aMessagePtr.Write(aParam, aDes, aOffset); |
|
69 if (ret != KErrNone) |
|
70 { |
|
71 PanicClient(aMessagePtr, EPosUnableToReadOrWriteDataToClient); |
|
72 } |
|
73 return ret; |
|
74 } |
|
75 |
|
76 // --------------------------------------------------------- |
|
77 // --------------------------------------------------------- |
|
78 // |
|
79 TInt LmServerGlobal::Write( |
|
80 const RMessagePtr2& aMessagePtr, |
|
81 TInt aParam, |
|
82 const TDesC16& aDes, |
|
83 TInt aOffset) |
|
84 { |
|
85 TInt ret = aMessagePtr.Write(aParam, aDes, aOffset); |
|
86 if (ret != KErrNone) |
|
87 { |
|
88 PanicClient(aMessagePtr, EPosUnableToReadOrWriteDataToClient); |
|
89 } |
|
90 return ret; |
|
91 } |
|
92 |
|
93 // --------------------------------------------------------- |
|
94 // --------------------------------------------------------- |
|
95 // |
|
96 void LmServerGlobal::Complete( |
|
97 const RMessagePtr2& aMessagePtr, |
|
98 TInt aReason) |
|
99 { |
|
100 if (!aMessagePtr.IsNull()) |
|
101 { |
|
102 aMessagePtr.Complete(aReason); |
|
103 } |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------- |
|
107 // --------------------------------------------------------- |
|
108 // |
|
109 HBufC8* LmServerGlobal::CopyClientBuffer8LC( |
|
110 const RMessage2& aMessage, |
|
111 const TInt aClientBufferParam ) |
|
112 { |
|
113 // Create an empty server side buffer that will contain client data |
|
114 TInt dataSize = aMessage.GetDesLengthL( aClientBufferParam ); |
|
115 HBufC8* buffer = HBufC8::NewLC( dataSize ); |
|
116 |
|
117 // Populate server side buffer with client data |
|
118 TPtr8 ptrToBuf = buffer->Des(); |
|
119 aMessage.ReadL( aClientBufferParam, ptrToBuf ); |
|
120 return buffer; |
|
121 } |
|
122 |
|
123 // --------------------------------------------------------- |
|
124 // --------------------------------------------------------- |
|
125 // |
|
126 HBufC* LmServerGlobal::CopyClientBufferLC( |
|
127 const RMessage2& aMessage, |
|
128 const TInt aClientBufferParam) |
|
129 { |
|
130 // Create an empty server side buffer that will contain client data |
|
131 TInt dataSize = aMessage.GetDesLengthL( aClientBufferParam ); |
|
132 HBufC* buffer = HBufC::NewLC( dataSize ); |
|
133 |
|
134 // Populate server side buffer with client data |
|
135 TPtr ptrToBuf = buffer->Des(); |
|
136 aMessage.ReadL( aClientBufferParam, ptrToBuf ); |
|
137 return buffer; |
|
138 } |
|
139 |
|
140 // End of File |