29 */ |
29 */ |
30 |
30 |
31 /*! |
31 /*! |
32 \fn void MHbIndicatorSymbianObserver::IndicatorUserActivated(const TDesC& aType, CHbSymbianVariantMap& aData) |
32 \fn void MHbIndicatorSymbianObserver::IndicatorUserActivated(const TDesC& aType, CHbSymbianVariantMap& aData) |
33 |
33 |
34 This callback is called when user has interacted with an indicator on the indicator |
34 Callback indicates data from indicator plugin implentation. Indicator plugin may originate the callback |
35 menu. |
35 for example when user interacts with the indicator from indicator menu. |
36 |
36 |
37 \a aType - Type of the indicator that user interacted with. |
37 \a aType - Indicator type (identification). |
38 \a aData - Data sent by the indicator. |
38 \a aData - Data sent by the indicator. |
39 */ |
39 */ |
40 |
40 |
41 /*! |
41 /*! |
42 \class CHbIndicatorSymbian |
42 \class CHbIndicatorSymbian |
43 \brief CHbIndicatorSymbian can be used to activate and deactivate indicators. It is a client |
43 \brief CHbIndicatorSymbian is a Symbian implementation of HbIndicator. |
44 interface for Symbian applications to Hb indicators. |
44 |
45 |
45 <b>This class is Symbian only. Not available on other platforms.</b> |
46 CHbIndicatorSymbian sends a request for indicator activation and deactivation to |
46 |
47 server side. Indicators are identified by their type-string and there must be a |
47 See HbIndicator documentation to find out more about indicators. |
48 server side indicator implementation for that type. |
48 |
49 |
49 CHbIndicatorSymbian is intended for use by Symbian servers that don't run Qt event loop |
50 Active indicators may appear in the status indicator area as an icon, |
50 and cannot use HbIndicator. |
51 and/or inside universal indicator menu showing icon and text. |
51 |
52 Depending on the indicator implementation, activated indicator may also show up with |
52 The class is accompanied by a class CHbSymbianVariant which |
53 a notification dialog and some indicators can be interacted by the user in universal indicator menu. |
53 is used to encapsulate indicator parameter. Indicator framework takes care of |
54 |
54 translating Symbian data types to/from format understood by indicator plugins. |
55 User can interact with an indicator from the indicator menu. Client is notified about |
55 |
56 the user interaction via MHbIndicatorSymbianObserver observer interface. Interaction |
56 Events from an indicator are indicated by MHbIndicatorSymbianObserver callback interface. |
57 notification and data sent by the indicator is a contract between HbIndicator class |
57 |
58 and indicator. |
58 The code below activates and deactivates an indicator. |
59 |
59 \code |
60 When deactivated, icons are removed from the status |
60 CHbIndicatorSymbian* indicator = CHbIndicatorSymbian::NewL(); |
61 indicator area and in universal indicator menu. |
61 CleanupStack::PushL(indicator); |
62 |
62 |
63 \sa HbIndicator |
63 _LIT(KOptionKey, "option"); |
|
64 const TInt optionValue = 0; |
|
65 CHbSymbianVariant* option = CHbSymbianVariant::NewL(&optionValue, CHbSymbianVariant::EInt); |
|
66 CleanupStack::PushL(option); |
|
67 |
|
68 _LIT(KIndicatorType, "com.nokia.hb.unittestfirstindicator0/1.0"); |
|
69 indicator->Activate(KIndicatorType, option); |
|
70 User::LeaveIfError(indicator->Error()); |
|
71 indicator->Deactivate(KIndicatorType); |
|
72 User::LeaveIfError(indicator->Error()); |
|
73 CleanupStack::PopAndDestroy(2); // indicator, option |
|
74 \endcode |
|
75 |
|
76 \sa HbIndicator, CHbSymbianVariant |
64 |
77 |
65 \stable |
78 \stable |
66 \hbcore |
79 \hbcore |
67 */ |
80 */ |
68 |
81 |
69 /*! |
82 /*! |
70 \enum CHbIndicatorSymbian::TIndicatorError |
83 \enum CHbIndicatorSymbian::TIndicatorError |
71 Defines the indicator errors. |
84 Defines the indicator error ranges. |
72 */ |
85 */ |
73 /*! |
86 /*! |
74 \var CHbIndicatorSymbian::TIndicatorError CHbIndicatorSymbian::EFrameworkErrors |
87 \var CHbIndicatorSymbian::TIndicatorError CHbIndicatorSymbian::EFrameworkErrors |
75 Start of an error range for errors originating from device dialog framework. |
88 Start of an error range for errors originating from indicator framework. |
76 Error codes are defined in hbdevicedialogerrors.h |
|
77 */ |
89 */ |
78 /*! |
90 /*! |
79 \var CHbIndicatorSymbian::TIndicatorError CHbIndicatorSymbian::EPluginErrors |
91 \var CHbIndicatorSymbian::TIndicatorError CHbIndicatorSymbian::EPluginErrors |
80 Start of an error range for errors originating from indicator plugins. |
92 Start of an error range for errors originating from indicator plugins. |
81 */ |
93 */ |
92 #include "hbsymbianvariantconverter_p.h" |
104 #include "hbsymbianvariantconverter_p.h" |
93 #include "hbdevicedialogclientsession_p.h" |
105 #include "hbdevicedialogclientsession_p.h" |
94 #include "hbdevicedialogerrors_p.h" |
106 #include "hbdevicedialogerrors_p.h" |
95 #include "hbdevicedialogserverdefs_p.h" |
107 #include "hbdevicedialogserverdefs_p.h" |
96 |
108 |
97 class CHbIndicatorSymbianPrivate : public CActive { |
109 NONSHARABLE_CLASS(CHbIndicatorSymbianPrivate) : public CActive { |
98 public: |
110 public: |
99 CHbIndicatorSymbianPrivate() : CActive(EPriorityStandard), iInitialized(EFalse), iLastError(HbDeviceDialogNoError), iMsgTypePtr(NULL,0,0), |
111 CHbIndicatorSymbianPrivate() : CActive(EPriorityStandard), iInitialized(EFalse), iLastError(HbDeviceDialogNoError), iMsgTypePtr(NULL,0,0), |
100 iBuffer(NULL), |
112 iBuffer(NULL), |
101 iDataPtr(NULL,0,0) { CActiveScheduler::Add(this); } |
113 iDataPtr(NULL,0,0) { CActiveScheduler::Add(this); } |
102 ~CHbIndicatorSymbianPrivate() { |
114 ~CHbIndicatorSymbianPrivate() { |
278 { |
290 { |
279 delete d; |
291 delete d; |
280 } |
292 } |
281 |
293 |
282 /*! |
294 /*! |
283 Activates an indicator of type \a aIndicatorType. |
295 Activates an indicator. If indicator was already active, updates it. |
284 An extra parameter can be passed along to the indicator plugin. |
296 |
285 Returns true, if the indicator is activated, false, if an error occurred. |
297 \param aIndicatorType Indicator to activate. |
286 |
298 \param aParameter Optional parameter to pass into indicator plugin implementation. Ownership |
287 \sa Deactivate |
299 doesn't transfer. |
|
300 |
|
301 \return Returns true if the indicator was activated, false if an error occurred. |
|
302 |
|
303 \sa Deactivate() |
288 */ |
304 */ |
289 EXPORT_C TBool CHbIndicatorSymbian::Activate(const TDesC& aIndicatorType, const CHbSymbianVariant* aParameter) |
305 EXPORT_C TBool CHbIndicatorSymbian::Activate(const TDesC& aIndicatorType, const CHbSymbianVariant* aParameter) |
290 { |
306 { |
291 return d->sendActivateMessage(aIndicatorType, ETrue, aParameter); |
307 return d->sendActivateMessage(aIndicatorType, ETrue, aParameter); |
292 } |
308 } |
293 |
309 |
294 /*! |
310 /*! |
295 Deactivates an indicator of type \a indicatorType. |
311 Deactivates an indicator. |
296 An extra parameter can be passed along to the indicator plugin. |
312 |
297 If indicator is not currently active, does nothing and returns true. |
313 \param aIndicatorType Indicator to deactivate. |
298 Returns false, if error occurred. |
314 \param aParameter Optional parameter to pass into indicator plugin implementation. Ownership |
299 |
315 doesn't transfer. |
300 \sa Activate |
316 |
|
317 \return Returns true if the indicator was deactivated or wasn't active, |
|
318 false if an error occurred. |
|
319 |
|
320 \sa Activate() |
301 */ |
321 */ |
302 EXPORT_C TBool CHbIndicatorSymbian::Deactivate(const TDesC& aIndicatorType, const CHbSymbianVariant* aParameter) |
322 EXPORT_C TBool CHbIndicatorSymbian::Deactivate(const TDesC& aIndicatorType, const CHbSymbianVariant* aParameter) |
303 { |
323 { |
304 return d->sendActivateMessage(aIndicatorType, EFalse, aParameter); |
324 return d->sendActivateMessage(aIndicatorType, EFalse, aParameter); |
305 } |
325 } |