|
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: This direct client to alf server, that does not require Alf |
|
15 * environment. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include <alf/alfdirectclient.h> |
|
21 #include <alf/alfconstants.h> |
|
22 |
|
23 // --------------------------------------------------------------------------- |
|
24 // Send synchronous command |
|
25 // --------------------------------------------------------------------------- |
|
26 // |
|
27 EXPORT_C void RAlfDirectClient::MeasureFPS( TInt32 aId, TBool aStart ) |
|
28 { |
|
29 if (!Handle()) |
|
30 { |
|
31 TRAPD(err, OpenL()); |
|
32 if (err) |
|
33 { |
|
34 return; |
|
35 } |
|
36 } |
|
37 TInt command = EAlfDirectClientFPSCounterOn; |
|
38 if ( !aStart ) |
|
39 { |
|
40 command = EAlfDirectClientFPSCounterOff; |
|
41 } |
|
42 Send( command, TIpcArgs(aId)); |
|
43 } |
|
44 |
|
45 EXPORT_C void RAlfDirectClient::EnableLowMemoryState( TBool aMode ) |
|
46 { |
|
47 if (!Handle()) |
|
48 { |
|
49 TRAPD(err, OpenL()); |
|
50 if (err) |
|
51 { |
|
52 return; |
|
53 } |
|
54 } |
|
55 SendReceive(EAlfEnableLowMemoryState, TIpcArgs(aMode)); |
|
56 } |
|
57 |
|
58 EXPORT_C TInt RAlfDirectClient::ForceSwRendering( TBool aEnabled ) |
|
59 { |
|
60 if (!Handle()) |
|
61 { |
|
62 TRAPD(err, OpenL()); |
|
63 if (err) |
|
64 { |
|
65 return err; |
|
66 } |
|
67 } |
|
68 return SendReceive(EAlfForceSwRendering, TIpcArgs(aEnabled)); |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------------------------- |
|
72 // Constructor |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 EXPORT_C RAlfDirectClient::RAlfDirectClient() |
|
76 : RAlfClientBase(KAlfServiceUid.iUid) |
|
77 { |
|
78 // elegant SW design, right |
|
79 TRAP_IGNORE(OpenL()); |
|
80 } |
|
81 |
|
82 // --------------------------------------------------------------------------- |
|
83 // "destructor" |
|
84 // --------------------------------------------------------------------------- |
|
85 // |
|
86 EXPORT_C void RAlfDirectClient::Disconnect() |
|
87 { |
|
88 if (Handle()) |
|
89 { |
|
90 Close(); |
|
91 } |
|
92 |
|
93 } |