wlanutilities/wlansniffer/aiplugin/inc/wsfaiplugin.h
changeset 0 56b72877c1cb
child 8 c2bc3f8c7777
child 9 cb0d84368d6e
equal deleted inserted replaced
-1:000000000000 0:56b72877c1cb
       
     1 /*
       
     2 * Copyright (c) 2007-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:  Class header for CWsfAiPlugin
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_WSFAIPLUGIN_H
       
    20 #define C_WSFAIPLUGIN_H
       
    21 
       
    22 //  EXTERNAL INCLUDES
       
    23 #include <aicontentpublisher.h>
       
    24 #include <aicontentobserver.h>
       
    25 #include <aipropertyextension.h>
       
    26 #include <aieventhandlerextension.h>
       
    27 #include <e32cmn.h>
       
    28 
       
    29 //  INTERNAL INCLUDES
       
    30 #include "wsfaicontroller.h"
       
    31 #include "wsfaipublishobserver.h"
       
    32 #include "wsfaiplugincontentmodel.h"
       
    33 
       
    34 //  CONSTANTS
       
    35 LOCAL_D const TInt  KDeferredWaitTime = 1000 * 1000; 
       
    36                             // one second in milliseconds
       
    37 
       
    38 //  FORWARD DECLARATIONS
       
    39 class MAiPluginSettings;
       
    40 class MAiContentObserver;
       
    41 class MAiContentItemIterator;
       
    42 
       
    43 class CWsfModel;
       
    44 class CWsfAiModel;
       
    45 class CWsfAiView;
       
    46 class CAknIconArray;
       
    47 class CGulIcon;
       
    48 class CWsfDbObserver;
       
    49 
       
    50 
       
    51 // CLASS DECLARATION
       
    52 
       
    53 /**
       
    54  * The main class, containing the plugin behavior. 
       
    55  *
       
    56  * @lib wsfaiplugin.lib
       
    57  * @since S60 v5.0
       
    58  */
       
    59 NONSHARABLE_CLASS( CWsfAiPlugin ): public CAiContentPublisher,
       
    60                                    public MAiPropertyExtension,
       
    61                                    public MAiEventHandlerExtension,
       
    62                                    public MWsfAiPublishObserver
       
    63     {
       
    64     public: // Constructors and destructor
       
    65         
       
    66         /**
       
    67         * Two-phased constructor
       
    68         * @since S60 5.0 
       
    69         * @return instance of CWsfAiPlugin class
       
    70         */
       
    71         static CWsfAiPlugin* NewL();
       
    72         
       
    73         /**
       
    74         * Destructor of CWsfAiPlugin class
       
    75         * @since S60 5.0     
       
    76         */
       
    77         virtual ~CWsfAiPlugin();
       
    78     
       
    79     private:// Constructors
       
    80         
       
    81         /**
       
    82         * Default C++ constructor 
       
    83         * @since S60 5.0 
       
    84         */
       
    85         CWsfAiPlugin();
       
    86         
       
    87         /**
       
    88         * 2nd phase constructor
       
    89         * @since S60 5.0 
       
    90         */
       
    91         void ConstructL();
       
    92         
       
    93         /**
       
    94         * Steps 
       
    95         * @param ptr Pointer to an instance of this class
       
    96         */
       
    97         static TInt CWsfAiPlugin::DoRefreshingStepL( TAny* ptr );
       
    98         
       
    99         /**
       
   100         * Steps the refresh animation
       
   101         */                
       
   102         void CWsfAiPlugin::DoRefreshingStepL();
       
   103         
       
   104         /**
       
   105         * Steps 
       
   106         * @param ptr Pointer to an instance of this class
       
   107         */
       
   108         static TInt CWsfAiPlugin::DoConnectingStepL( TAny* ptr );
       
   109         
       
   110         /**
       
   111         * Steps the refresh animation
       
   112         */                
       
   113         void CWsfAiPlugin::DoConnectingStepL();
       
   114     
       
   115     public:     // from CAiContentPublisher
       
   116         
       
   117         /**
       
   118         * This method transit the plugin to "Alive" state.
       
   119         * The method is called by the framework to instruct plug-in that it is
       
   120         * allowed to actively publish its data to its observers. This means the plugin
       
   121         * is allowed to consume memory and CPU resources, e.g plug-in is able load 
       
   122         * engines, run timers, perform asynchronous operations, etc. The method 
       
   123         * transits the plug-in to "Alive" state. There can be many concurrent
       
   124         * calls to resume, with different or the same reason code, this allows
       
   125         * the plugin to properly respond to enviroment change that raise the
       
   126         * need to re-publish content (changes like date/time change etc).
       
   127         *
       
   128         * @param aReason reason for state change, see TAiTransitionChange.
       
   129         */
       
   130         void Resume( TAiTransitionReason aReason );
       
   131         
       
   132         /**
       
   133         * This method transits the plug-in to "Suspendend" state.
       
   134         * The method is called by the framework to instruct plug-in that it is
       
   135         * not allowed to consume CPU resources, e.g plug-in MUST stop each
       
   136         * timer, cancel outstanding asynchronous operations, etc. 
       
   137         *
       
   138         * @param aReason reason for state change, see TAiTransitionChange.
       
   139         */
       
   140         void Suspend( TAiTransitionReason aReason );
       
   141         
       
   142         /**
       
   143         * This method transits the plug-in to "Idle" state.
       
   144         * The method is called by the framework to request the plug-in free all
       
   145         * memory and CPU resources and close all its open files, the plug-in 
       
   146         * should unload its engines during backup operation.
       
   147         *
       
   148         * @param aReason reason for state change, see TAiTransitionChange.
       
   149         */
       
   150         void Stop( TAiTransitionReason aReason );
       
   151         
       
   152         /**
       
   153         * Adds the content observer / subscriber to plug-in. The plug-in MUST
       
   154         * maintain a registry of subscribers and send notification to all them
       
   155         * whenever the plug-in changes state or new content available.
       
   156         *
       
   157         * @param aObserver content observer to register.
       
   158         */
       
   159         void SubscribeL( MAiContentObserver& aObserver );
       
   160     
       
   161         /**
       
   162         * Configures the plug-in.
       
   163         *
       
   164         * @param aSettings setting items defined in the UI definition.
       
   165         *                  This plugin takes ownership of the
       
   166         *                  MAiPluginSettings objects in the array.
       
   167         *                  If this method leaves the caller will handle the cleanup.
       
   168         */
       
   169         void ConfigureL( RAiSettingsItemArray& aSettings );
       
   170         
       
   171         /**
       
   172         * Returns interface extension. In S60 3.2 only event & property
       
   173         * extensions are supported. See MAiEventHandlerExtension & MAiPropertyExtension
       
   174         * interfaces.
       
   175         *
       
   176         * @param  aUid - UID of the extension interface to access.
       
   177         * @return the extension interface. Actual type depends on the passed aUid 
       
   178         *         argument.
       
   179         */
       
   180         TAny* Extension( TUid aUid );
       
   181 
       
   182     
       
   183     public:     // from MAiPropertyExtension
       
   184     
       
   185         /**
       
   186         * Read property of publisher plug-in.
       
   187         *
       
   188         * @param aProperty - identification of property.
       
   189         * @return Pointer to property value.
       
   190         */
       
   191         TAny* GetPropertyL( TInt aProperty );
       
   192     
       
   193         /**
       
   194         * Write property value.
       
   195         *
       
   196         * @param aProperty - identification of property.
       
   197         * @param aValue - contains pointer to property value.
       
   198         */
       
   199         void SetPropertyL( TInt aProperty, TAny* aValue );
       
   200     
       
   201     
       
   202     public:     // from MAiEventHandlerExtension
       
   203     
       
   204         /**
       
   205         * See aieventhandlerextension.h for detailed description.
       
   206         * @since S60 5.0
       
   207         */
       
   208         void HandleEvent( TInt aEvent, const TDesC& aParam );
       
   209 
       
   210     
       
   211     public: // From MWsfAiPublishObserver
       
   212     
       
   213         /**
       
   214         * Publishes images from array and text
       
   215         * @since S60 5.0
       
   216         * @param aPublishIconArray the published icons
       
   217         * @param aText1 title text label
       
   218         */
       
   219         void PublishContentL( CArrayFix<TInt>* aPublishIconArray,
       
   220                               CEikLabel* aText1 );
       
   221         
       
   222         /**
       
   223         * Sets signal strenght and the security string
       
   224         * @since S60 5.0  
       
   225         * @param aStrength siganl strength string
       
   226         * @param aSecure security string
       
   227         */
       
   228         void SetStrengthAndSecure( TDesC* aStrength, TDesC* aSecure );
       
   229         
       
   230         /**
       
   231         * Sets Scanning status on/off.
       
   232         * @since S60 5.0
       
   233         * @param aScanState Scanning satus flag
       
   234         */
       
   235         void SetScanningState( TBool aScanState );
       
   236         
       
   237         /**
       
   238         * Sets refreshing status on/off.
       
   239         * @since S60 5.0
       
   240         * @param aScanState Refreshing status flag
       
   241         */
       
   242         void SetRefreshingL( TBool aRefreshing );
       
   243         
       
   244         /**
       
   245         * Set connecting status on.
       
   246         * @since S60 5.0
       
   247         */
       
   248         void StartConnectingL();
       
   249         
       
   250         /**
       
   251         * Publishes just status image from array 
       
   252         * @since S60 5.0
       
   253         * @param aPublishIconArray the published icons
       
   254         * @param aText1 title text label
       
   255         */
       
   256         void PublishStatusIconL( CArrayFix<TInt>* aPublishIconArray, 
       
   257                                             CEikLabel* aText1 );
       
   258         
       
   259     private:
       
   260     
       
   261         /**
       
   262         * Allocates Engine, Model and functional UI for plugin
       
   263         */
       
   264         void AllocateResourcesL();
       
   265     
       
   266         /**
       
   267         * Unpublishes (clears) all plugin content from AI2 view
       
   268         */
       
   269         void ClearL();
       
   270     
       
   271         /**
       
   272         * Launch WLAN Wizard application
       
   273         */
       
   274         void LaunchApplicationL();
       
   275     
       
   276         /**
       
   277         * Set the value of Middle Soft Key based on the
       
   278         * Scanning status of the WLAN Wizard
       
   279         */
       
   280         void SetMskL();
       
   281         
       
   282         /**
       
   283         * Publish the given text
       
   284         * @param aObserver - pointer to the observer
       
   285         * @param aContentId - content ID
       
   286         * @param aText1 - title text label
       
   287         * @return ETrue - if it can be published
       
   288         *         EFalse - if it can not be published
       
   289         */
       
   290         TBool PublishText( MAiContentObserver* aObserver,
       
   291                            TWsfAiWizardContentIds aContentId,
       
   292                            const TDesC16& aText );
       
   293         
       
   294         /**
       
   295         * Publish the given icon
       
   296         * @param aObserver - pointer to the observer
       
   297         * @param aContentId - content ID
       
   298         * @param aIconId - icon ID
       
   299         * @return ETrue - if it can be published
       
   300         *         EFalse - if it can not be published
       
   301         */
       
   302         TBool PublishIconL( MAiContentObserver* aObserver,
       
   303                             TWsfAiWizardContentIds aContentId,
       
   304                             TInt aIconId );
       
   305     
       
   306         /**
       
   307         * Cleanup function to to cancel publish transaction
       
   308         * @since S60 5.0
       
   309         * @param aPtr Pointer for the observer class
       
   310         */
       
   311         static void PublishCleanup( TAny* aPtr );
       
   312        
       
   313         /**
       
   314         * Callback function for carrying out refresh at startup
       
   315         * @since S60 5.0
       
   316         * @param aPtr Pointer to this class
       
   317         * @return Error code        
       
   318         */
       
   319         static TInt StartupRefresh( TAny* aPtr );
       
   320 
       
   321         /**
       
   322         * Callback function for carrying out refresh at startup
       
   323         * @since S60 5.0
       
   324         * @return Error code        
       
   325         */
       
   326         TInt StartupRefreshL();
       
   327 
       
   328         
       
   329     private: // Data
       
   330     
       
   331         /**
       
   332         * Array of content observers
       
   333         */
       
   334         RPointerArray<MAiContentObserver> iObservers;
       
   335     
       
   336         /**
       
   337         * Iterator for plugin content
       
   338         * Own.
       
   339         */
       
   340         MAiContentItemIterator* iContent;
       
   341     
       
   342         /**
       
   343         * Iterator for plugin resources
       
   344         * Own.
       
   345         */
       
   346         MAiContentItemIterator* iResources;
       
   347     
       
   348         /**
       
   349         * Iterator for plugin events
       
   350         * Own.
       
   351         */
       
   352         MAiContentItemIterator* iEvents;
       
   353     
       
   354         /**
       
   355         * Information about the content publisher (this plug-in)
       
   356         */
       
   357         TAiPublisherInfo iInfo;
       
   358     
       
   359         /**
       
   360         * Pointer to CWsfModel
       
   361         * Own.
       
   362         */
       
   363         CWsfModel* iModel;
       
   364         
       
   365         /**
       
   366         * Pointer to AI Model
       
   367         * Own.
       
   368         */
       
   369         CWsfAiModel* iAiModel;
       
   370     
       
   371         /**
       
   372         * AI Controller
       
   373         * Own.
       
   374         */
       
   375         TWsfAiController iController;
       
   376         
       
   377         /**
       
   378         * Pointer to CWsfAiView
       
   379         * Own.
       
   380         */
       
   381         CWsfAiView* iUi;
       
   382    
       
   383         /**
       
   384         * The database observer obseving changes in
       
   385         * show WLAN availablity
       
   386         */
       
   387         CWsfDbObserver* iDbObserver;
       
   388         
       
   389         /**
       
   390         * The resource file offset
       
   391         */
       
   392         TInt iResourceFileOffset;
       
   393     
       
   394         /**
       
   395         * Constants for Signal Strength text
       
   396         * Own.
       
   397         */
       
   398         HBufC* iCurrentSignalStrength;
       
   399     
       
   400         /**
       
   401         * Constants for Secure Information text
       
   402         * Own.
       
   403         */
       
   404         HBufC* iCurrentSecureInfo;
       
   405     
       
   406         /**
       
   407         * Constants for Title text
       
   408         * Own.
       
   409         */
       
   410         HBufC* iWlanTitle;
       
   411     
       
   412         /**
       
   413         * Constants for MSK activate text
       
   414         * Own.
       
   415         */
       
   416         HBufC* iMskActivate;
       
   417     
       
   418         /**
       
   419         * Scanning status flag
       
   420         */
       
   421         TBool iScanState;
       
   422     
       
   423         /**
       
   424         * Flag for focus of information area 
       
   425         */
       
   426         TBool iInfoAreaFocus;
       
   427         
       
   428         /**
       
   429         * The current observer item index 
       
   430         */
       
   431         TInt iCurrentObserverIndex;
       
   432         
       
   433         /**
       
   434          * The current refreshing state
       
   435          */
       
   436         TBool iRefreshing;
       
   437         
       
   438         /**
       
   439         * Active Object callback for displaying data at startup
       
   440         */
       
   441         CAsyncCallBack* iStartupRefresh;
       
   442         
       
   443         /*
       
   444 	     * The periodic that steps the refreshing animation
       
   445 	     */
       
   446 	    CPeriodic* iAnimationPeriodic;
       
   447 	    
       
   448 	    /**
       
   449 	     * Constants for 'Connected to:' text
       
   450 	     * Own.
       
   451 	     */
       
   452         HBufC* iConnectedTo;
       
   453         
       
   454         /**
       
   455          * Constants for 'Known network found:' text
       
   456          * Own.
       
   457          */
       
   458         HBufC* iKnownNetworkFound;
       
   459 	    	    
       
   460     };
       
   461 
       
   462 
       
   463 #endif // C_WSFAIPLUGIN_H
       
   464 
       
   465 // End of File.