upnpframework/upnpcommand/src/upnprunsetuptask.cpp
changeset 0 7f85d04be362
equal deleted inserted replaced
-1:000000000000 0:7f85d04be362
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Source file for CUpnpRunSetupTask class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // FORWARD DECLARATIONS
       
    20 class CUpnpIcon;
       
    21 
       
    22 // INCLUDE FILES
       
    23 // upnpframework / setup wizard
       
    24 #include "cupnpappwizard.h"             // CUPnPAppWizard
       
    25 #include "upnpfilesharingengine.h"      // CUPnPFileSharingEngine
       
    26 // command internal
       
    27 #include "upnpnotehandler.h"
       
    28 #include "upnprunsetuptask.h"
       
    29 #include "upnpcommand.h"
       
    30 
       
    31 
       
    32 _LIT( KComponentLogfile, "upnpcommand.log");
       
    33 #include "upnplog.h"
       
    34 
       
    35 
       
    36 // --------------------------------------------------------------------------
       
    37 // CUpnpRunSetupTask::NewL
       
    38 // Creates an instance of the implementation.
       
    39 // --------------------------------------------------------------------------
       
    40 //
       
    41 CUpnpTask* CUpnpRunSetupTask::NewL()
       
    42     {
       
    43     __LOG( "[UpnpCommand]\t CUpnpRunSetupTask::NewL" );
       
    44 
       
    45     // Create instance
       
    46     CUpnpRunSetupTask* self = NULL;
       
    47     self = new (ELeave) CUpnpRunSetupTask();
       
    48     CleanupStack::PushL( self );
       
    49     self->ConstructL();
       
    50     CleanupStack::Pop( self );
       
    51 
       
    52     // Cast the object and return
       
    53     return (CUpnpTask*)self;
       
    54     }
       
    55 
       
    56 // --------------------------------------------------------------------------
       
    57 // CUpnpRunSetupTask::CUpnpRunSetupTask
       
    58 // First phase construction.
       
    59 // --------------------------------------------------------------------------
       
    60 //
       
    61 CUpnpRunSetupTask::CUpnpRunSetupTask()
       
    62     {
       
    63     __LOG( "[UpnpCommand]\t CUpnpRunSetupTask::Constructor" );
       
    64     }
       
    65 
       
    66 // --------------------------------------------------------------------------
       
    67 // Destructor.
       
    68 // --------------------------------------------------------------------------
       
    69 //
       
    70 CUpnpRunSetupTask::~CUpnpRunSetupTask()
       
    71     {
       
    72     __LOG( "[UpnpCommand]\t CUpnpRunSetupTask::Destructor" );
       
    73     }
       
    74 
       
    75 // --------------------------------------------------------------------------
       
    76 // CUpnpRunSetupTask::ConstructL
       
    77 // Perform the second phase of two phase construction. Reserves the Upnp Fw
       
    78 // resources (they are released when the task is destroyed).
       
    79 // --------------------------------------------------------------------------
       
    80 //
       
    81 void CUpnpRunSetupTask::ConstructL()
       
    82     {
       
    83     __LOG( "[UpnpCommand]\t CUpnpRunSetupTask::ConstructL" );
       
    84     }
       
    85 
       
    86 // --------------------------------------------------------------------------
       
    87 // CUpnpRunSetupTask::AllocateResourcesL
       
    88 // Allocates the Upnp Fw resources.
       
    89 // --------------------------------------------------------------------------
       
    90 //
       
    91 void CUpnpRunSetupTask::AllocateResourcesL()
       
    92     {
       
    93     __LOG( "[UpnpCommand]\t CUpnpRunSetupTask::AllocateResourcesL" );
       
    94 
       
    95     // Upnp Fw resources are allocated when the command is executed.
       
    96     }
       
    97 
       
    98 // --------------------------------------------------------------------------
       
    99 // CUpnpRunSetupTask::ExecuteL
       
   100 // Executes the task.
       
   101 // --------------------------------------------------------------------------
       
   102 //
       
   103 void CUpnpRunSetupTask::ExecuteL()
       
   104     {
       
   105     __LOG( "[UpnpCommand]\t CUpnpRunSetupTask::ExecuteL" );
       
   106 
       
   107     // Create file sharing engine, it is needed to run the wizard.
       
   108     CUPnPFileSharingEngine* sharingEngine = CUPnPFileSharingEngine::NewL();
       
   109     CleanupStack::PushL( sharingEngine );
       
   110 
       
   111     // Create app wizard (use default text for the first step)
       
   112     CUPnPAppWizard* wizard = CUPnPAppWizard::NewL( KNullDesC,
       
   113                                                    sharingEngine );
       
   114     CleanupStack::PushL( wizard );
       
   115 
       
   116     // Run the wizard
       
   117     wizard->StartL();
       
   118 
       
   119     // Clean up
       
   120     CleanupStack::PopAndDestroy( wizard );
       
   121     wizard = NULL;
       
   122     CleanupStack::PopAndDestroy( sharingEngine );
       
   123     sharingEngine = NULL;
       
   124     }
       
   125 
       
   126 // End of File