|
1 /* |
|
2 * Copyright (c) 2003 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32std.h> |
|
20 #include "Utility.h" |
|
21 #include <lbsipc.h> |
|
22 #include <lbserrors.h> |
|
23 |
|
24 void Utility::PanicClient(TInt aPanic, const RMessage2& aMessage) |
|
25 { |
|
26 _LIT(KTxtServer, "Pos-Server"); |
|
27 aMessage.Panic(KTxtServer, aPanic); |
|
28 } |
|
29 |
|
30 TInt Utility::Write(const RMessage2& aMessage, TInt aArg, const TDesC8& aDes, TInt aOffset) |
|
31 // |
|
32 // Write and kill the client if it leaves. |
|
33 // |
|
34 { |
|
35 TRAPD(ret, aMessage.WriteL(aArg, aDes, aOffset)) |
|
36 if (ret != KErrNone) |
|
37 PanicClient(EPositionBadDescriptor, aMessage); |
|
38 return ret; |
|
39 } |
|
40 |
|
41 TInt Utility::Read(const RMessage2& aMessage, TInt aArg, TDes8& aDes, TInt aOffset) |
|
42 // |
|
43 // Write and kill the client if it leaves. |
|
44 // |
|
45 { |
|
46 TRAPD(ret, aMessage.ReadL(aArg, aDes, aOffset)) |
|
47 if (ret != KErrNone) |
|
48 PanicClient(EPositionBadDescriptor, aMessage); |
|
49 return ret; |
|
50 } |
|
51 |
|
52 TInt Utility::Write(const RMessage2& aMessage, TInt aArg, const TDesC16& aDes, TInt aOffset) |
|
53 // |
|
54 // Write and kill the client if it leaves. |
|
55 // |
|
56 { |
|
57 TRAPD(ret, aMessage.WriteL(aArg, aDes, aOffset)) |
|
58 if (ret != KErrNone) |
|
59 PanicClient(EPositionBadDescriptor, aMessage); |
|
60 return ret; |
|
61 } |
|
62 |
|
63 TInt Utility::Read(const RMessage2& aMessage, TInt aArg, TDes16& aDes, TInt aOffset) |
|
64 // |
|
65 // Write and kill the client if it leaves. |
|
66 // |
|
67 { |
|
68 TRAPD(ret, aMessage.ReadL(aArg, aDes, aOffset)) |
|
69 if (ret != KErrNone) |
|
70 PanicClient(EPositionBadDescriptor, aMessage); |
|
71 return ret; |
|
72 } |