src/hbcore/devicedialogbase/hbindicatorsymbian.cpp
changeset 28 b7da29130b0e
parent 23 e6ad4ef83b23
child 30 80e4d18b72f5
--- a/src/hbcore/devicedialogbase/hbindicatorsymbian.cpp	Thu Sep 02 20:44:51 2010 +0300
+++ b/src/hbcore/devicedialogbase/hbindicatorsymbian.cpp	Fri Sep 17 08:32:10 2010 +0300
@@ -31,36 +31,49 @@
 /*!
     \fn void MHbIndicatorSymbianObserver::IndicatorUserActivated(const TDesC& aType, CHbSymbianVariantMap& aData)
 
-    This callback is called when user has interacted with an indicator on the indicator
-    menu.
-    
-    \a aType - Type of the indicator that user interacted with.
+    Callback indicates data from indicator plugin implentation. Indicator plugin may originate the callback
+    for example when user interacts with the indicator from indicator menu.
+
+    \a aType - Indicator type (identification).
     \a aData - Data sent by the indicator.
 */
 
 /*!
     \class CHbIndicatorSymbian
-    \brief CHbIndicatorSymbian can be used to activate and deactivate indicators. It is a client 
-    interface for Symbian applications to Hb indicators.
+    \brief CHbIndicatorSymbian is a Symbian implementation of HbIndicator. 
+
+    <b>This class is Symbian only. Not available on other platforms.</b>
+
+    See HbIndicator documentation to find out more about indicators.
 
-    CHbIndicatorSymbian sends a request for indicator activation and deactivation to
-    server side. Indicators are identified by their type-string and there must be a
-    server side indicator implementation for that type.
+    CHbIndicatorSymbian is intended for use by Symbian servers that don't run Qt event loop
+    and cannot use HbIndicator.
+
+    The class is accompanied by  a class CHbSymbianVariant which
+    is used to encapsulate indicator parameter. Indicator framework takes care of
+    translating Symbian data types to/from format understood by indicator plugins.
+
+    Events from an indicator are indicated by MHbIndicatorSymbianObserver callback interface. 
 
-    Active indicators may appear in the status indicator area as an icon,
-    and/or inside universal indicator menu showing icon and text.
-    Depending on the indicator implementation, activated indicator may also show up with
-    a notification dialog and some indicators can be interacted by the user in universal indicator menu.
+    The code below activates and deactivates an indicator.
+    \code
+    CHbIndicatorSymbian* indicator = CHbIndicatorSymbian::NewL();
+    CleanupStack::PushL(indicator);
+
+    _LIT(KOptionKey, "option");
+    const TInt optionValue = 0;
+    CHbSymbianVariant* option = CHbSymbianVariant::NewL(&optionValue, CHbSymbianVariant::EInt);
+    CleanupStack::PushL(option);
 
-    User can interact with an indicator from the indicator menu. Client is notified about
-    the user interaction via MHbIndicatorSymbianObserver observer interface. Interaction 
-    notification and data sent by the indicator is a contract between HbIndicator class 
-    and indicator.
-    
-    When deactivated, icons are removed from the status
-    indicator area and in universal indicator menu.
+    _LIT(KIndicatorType, "com.nokia.hb.unittestfirstindicator0/1.0");
+    indicator->Activate(KIndicatorType, option);
+    User::LeaveIfError(indicator->Error());
+    indicator->Deactivate(KIndicatorType);
+    User::LeaveIfError(indicator->Error());
+    CleanupStack::PopAndDestroy(2); // indicator, option
+    \endcode
 
-    \sa HbIndicator
+    \sa HbIndicator, CHbSymbianVariant
 
     \stable
     \hbcore
@@ -68,12 +81,11 @@
 
 /*!
     \enum CHbIndicatorSymbian::TIndicatorError
-    Defines the indicator errors.
+    Defines the indicator error ranges.
 */
 /*!
     \var CHbIndicatorSymbian::TIndicatorError CHbIndicatorSymbian::EFrameworkErrors
-    Start of an error range for errors originating from device dialog framework.
-    Error codes are defined in hbdevicedialogerrors.h
+    Start of an error range for errors originating from indicator framework.
 */
 /*!
     \var CHbIndicatorSymbian::TIndicatorError CHbIndicatorSymbian::EPluginErrors
@@ -94,7 +106,7 @@
 #include "hbdevicedialogerrors_p.h"
 #include "hbdevicedialogserverdefs_p.h"
 
-class CHbIndicatorSymbianPrivate : public CActive {
+NONSHARABLE_CLASS(CHbIndicatorSymbianPrivate) : public CActive {
 public:
     CHbIndicatorSymbianPrivate() : CActive(EPriorityStandard), iInitialized(EFalse), iLastError(HbDeviceDialogNoError),   iMsgTypePtr(NULL,0,0),
               iBuffer(NULL),
@@ -280,11 +292,15 @@
 }
 
 /*!
-    Activates an indicator of type \a aIndicatorType.
-    An extra parameter can be passed along to the indicator plugin.
-    Returns true, if the indicator is activated, false, if an error occurred.  
+    Activates an indicator. If indicator was already active, updates it.
 
-    \sa Deactivate
+    \param aIndicatorType Indicator to activate.
+    \param aParameter Optional parameter to pass into indicator plugin implementation. Ownership
+    doesn't transfer.
+
+    \return Returns true if the indicator was activated, false if an error occurred.
+
+    \sa Deactivate()
  */
 EXPORT_C TBool CHbIndicatorSymbian::Activate(const TDesC& aIndicatorType, const CHbSymbianVariant* aParameter)
 {
@@ -292,12 +308,16 @@
 }
 
 /*!
-    Deactivates an indicator of type \a indicatorType.
-    An extra parameter can be passed along to the indicator plugin.
-    If indicator is not currently active, does nothing and returns true.
-    Returns false, if error occurred.
+    Deactivates an indicator.
 
-    \sa Activate
+    \param aIndicatorType Indicator to deactivate.
+    \param aParameter Optional parameter to pass into indicator plugin implementation. Ownership
+    doesn't transfer.
+
+    \return Returns true if the indicator was deactivated or wasn't active,
+    false if an error occurred.
+
+    \sa Activate()
  */
 EXPORT_C TBool CHbIndicatorSymbian::Deactivate(const TDesC& aIndicatorType, const CHbSymbianVariant* aParameter)
 {