|
1 /* |
|
2 * Copyright (c) 2005-2008 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: Declaration of CGSAccessoryPluginModel class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef GSACCESSORYPLUGINMODEL_H |
|
20 #define GSACCESSORYPLUGINMODEL_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <AccessorySettings.h> |
|
24 #include <AccessoryServer.h> |
|
25 |
|
26 class CRepository; |
|
27 class CGSAccProfileList; |
|
28 |
|
29 /** |
|
30 * CGSAccessoryPluginModel is the model class of GS accessory plugin. |
|
31 * It provides functions to get and set setting values. |
|
32 * @since S60 3.1 |
|
33 */ |
|
34 class CGSAccessoryPluginModel : public CBase |
|
35 { |
|
36 public: // Constructor and destructor |
|
37 |
|
38 /** |
|
39 * Constructs a CGSAccessoryPluginModel object. |
|
40 * |
|
41 * @return The new object |
|
42 */ |
|
43 static CGSAccessoryPluginModel* NewL(); |
|
44 |
|
45 /** |
|
46 * Destructor. |
|
47 */ |
|
48 virtual ~CGSAccessoryPluginModel(); |
|
49 |
|
50 public: |
|
51 |
|
52 /** |
|
53 * Gets accessory support status. |
|
54 * |
|
55 * @param aAccessory Identifies accessory to check. |
|
56 * @return ETrue if accessory is supported, EFalse otherwise. |
|
57 */ |
|
58 TBool AccessorySupportedL( TInt aAccessory ) const; |
|
59 |
|
60 /** |
|
61 * Gets the accessory which has been selected as default. |
|
62 * |
|
63 * @return Default accessory identifier. |
|
64 */ |
|
65 TInt DefaultAccessory() const; |
|
66 |
|
67 /** |
|
68 * Sets the accessory which has been selected as default. |
|
69 * |
|
70 * @param aValue Value to be stored. |
|
71 */ |
|
72 void SetDefaultAccessoryL( TInt aValue ); |
|
73 |
|
74 /** |
|
75 * Read profile id from specified Cenrep key. |
|
76 * |
|
77 * @param aKey Key id. |
|
78 * @return 0: active |
|
79 * 1: general |
|
80 * 2: silent |
|
81 * 3: meeting |
|
82 * 4: outdoor |
|
83 * 5: pager |
|
84 * negative value on error. |
|
85 */ |
|
86 TInt DefaultProfileByKey( TInt aKey ) const; |
|
87 |
|
88 /** |
|
89 * Set default profile to specific Cenrep key. |
|
90 * |
|
91 * @param aKey Key id. |
|
92 * @param aProfile Default profile to save. |
|
93 */ |
|
94 void SetDefaultProfileByKeyL( TInt aKey, TInt aNewProfile ); |
|
95 |
|
96 /** |
|
97 * Read automatic answer mode from specified Cenrep key. |
|
98 * |
|
99 * @param aKey Key id. |
|
100 * @return List box index for automatic answer mode setting |
|
101 * 0: automatic answer mode on. |
|
102 * 1: automatic answer mode off. |
|
103 * Negative value on error. |
|
104 */ |
|
105 TInt AutoAnswerModeByKey( TInt aKey ) const; |
|
106 |
|
107 /** |
|
108 * Read automatic answer mode from specified Cenrep key. |
|
109 * |
|
110 * @param aKey Key id. |
|
111 * @param aMode List box index for automatic answer mode mode settings |
|
112 * 0: automatic answer mode on. |
|
113 * 1: automatic answer mode off. |
|
114 */ |
|
115 void SetAutoAnswerModeByKeyL( TInt aKey, TInt aMode ) const; |
|
116 |
|
117 /** |
|
118 * Read accessory light mode from Accessory Server. |
|
119 * |
|
120 * @param aAccMode Identifies the accessory. |
|
121 * @param aAccSetId Identifies the accessory setting to read. |
|
122 * @return List box index for light mode setting |
|
123 * 0: light mode on. |
|
124 * 1: light mode off. |
|
125 * Negative value on error. |
|
126 */ |
|
127 TInt LightMode( TAccMode aAccMode, TInt aAccSetId ) const; |
|
128 |
|
129 /** |
|
130 * Store accessory light mode to Accessory Server. |
|
131 * |
|
132 * @param aAccMode Identifies the accessory. |
|
133 * @param aAccSetId Identifies the accessory setting to read. |
|
134 * @param aLightMode List box index for light mode setting |
|
135 * 0: light mode on. |
|
136 * 1: light mode off. |
|
137 */ |
|
138 void SetLightModeL( |
|
139 TAccMode aAccMode, |
|
140 TInt aAccSetId, |
|
141 TInt aLightMode ); |
|
142 |
|
143 /** |
|
144 * Read HAC mode value from Central Repository. |
|
145 * |
|
146 * @return List box index for HAC mode settings |
|
147 * 0: HAC mode on. |
|
148 * 1: HAC mode off. |
|
149 * Negative value on error. |
|
150 */ |
|
151 TInt HacMode(); |
|
152 |
|
153 /** |
|
154 * Write HAC mode value to Central Repository. |
|
155 * |
|
156 * @param aMode List box index for HAC mode settings |
|
157 * 0: HAC mode on. |
|
158 * 1: HAC mode off. |
|
159 */ |
|
160 void SetHacModeL( TInt aMode ); |
|
161 |
|
162 /** |
|
163 * Check if PALM TV system is supported. |
|
164 * |
|
165 * @return ETrue if PALM is supported |
|
166 * EFalse if PALM is not supported |
|
167 */ |
|
168 TBool PalmSupport(); |
|
169 |
|
170 /** |
|
171 * Get handle to profile list. |
|
172 * |
|
173 * @return Handle to profile list. |
|
174 */ |
|
175 CGSAccProfileList& ProfileList() const; |
|
176 |
|
177 /** |
|
178 * Switches from 0 to 1 and vice versa. Used for changing on/off selections |
|
179 * status. |
|
180 * |
|
181 * @param aValue Value will be switched (0<->1). |
|
182 */ |
|
183 void FlipValue( TInt& aValue ); |
|
184 |
|
185 private: |
|
186 |
|
187 /** |
|
188 * First phase constructor. |
|
189 */ |
|
190 CGSAccessoryPluginModel(); |
|
191 |
|
192 /** |
|
193 * Second phase constructor. |
|
194 */ |
|
195 void ConstructL(); |
|
196 |
|
197 private: // data |
|
198 |
|
199 /** Internal accessory repository. Own. */ |
|
200 CRepository* iAccessoryRepository; |
|
201 |
|
202 /** Internal profile repository Own. */ |
|
203 CRepository* iProfileRepository; |
|
204 |
|
205 /** Hardware settings repository: for HAC feature Own. */ |
|
206 CRepository* iHwSettingsRepository; |
|
207 |
|
208 /** Profiles repository: for HAC feature Own. */ |
|
209 CRepository* iProfVariationRepository; |
|
210 |
|
211 /** Accessory server connection. */ |
|
212 RAccessoryServer iAccServer; |
|
213 |
|
214 /** Accessory settings connection. */ |
|
215 RAccessorySettings iAccessorySettings; |
|
216 |
|
217 /** PALM TV system support. */ |
|
218 TBool iPalmSupport; |
|
219 |
|
220 /** List of profiles available for different accessories. Own. */ |
|
221 CGSAccProfileList* iProfileList; |
|
222 |
|
223 }; |
|
224 |
|
225 #endif // GSACCESSORYPLUGINMODEL_H |