upnp/upnpstack/serviceframework/src/upnpsilentdeviceimplementation.cpp
changeset 0 f5a58ecadc66
child 9 5c72fd91570d
equal deleted inserted replaced
-1:000000000000 0:f5a58ecadc66
       
     1 /** @file
       
     2 * Copyright (c) 2005-2006 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:  Defines the CUpnpSilentDeviceImplementation class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 
       
    21 #include <e32math.h>
       
    22 #include <xmlengdom.h> 
       
    23 
       
    24 #include <upnpdevicedescriptionstore.h>
       
    25 #include "upnpfileutils.h"
       
    26 #include "upnpcustomlog.h"
       
    27 #include "upnpsilentdeviceimplementation.h"
       
    28 #include "upnpsilentdeviceimplcontenthandler.h"
       
    29 #include "upnpcontenthandlerscontroller.h"
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // CUpnpSilentDeviceImplementation::NewL
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 EXPORT_C CUpnpSilentDeviceImplementation* CUpnpSilentDeviceImplementation::NewL(
       
    36                             const TDesC8& aUri, 
       
    37                             CUpnpDeviceDescriptionStore& aDescriptionStore,
       
    38                             MUpnpDeviceDescriptionProvider& aProvider )
       
    39     {
       
    40     LOGS("CUpnpSilentDeviceImplementation::NewL( const TDesC& aFilename )" );
       
    41 
       
    42     HBufC8* descr = UpnpFileUtil::ReadFileL( aDescriptionStore.DescriptionFile() );
       
    43     CleanupStack::PushL( descr );
       
    44 
       
    45     CUpnpContentHandlersController* controller =  CUpnpContentHandlersController::NewLC( );
       
    46 
       
    47     CUpnpSilentDeviceImplementation* deviceImpl = controller->ParseSilentDeviceImplL( *descr );
       
    48 
       
    49     CleanupStack::PushL( deviceImpl );
       
    50     deviceImpl->ConstructL( aUri, aDescriptionStore, aProvider );
       
    51     CleanupStack::Pop( deviceImpl );
       
    52 
       
    53     CleanupStack::PopAndDestroy( controller );
       
    54     CleanupStack::PopAndDestroy( descr );
       
    55 
       
    56     return deviceImpl;
       
    57     }
       
    58     
       
    59 CUpnpSilentDeviceImplementation::CUpnpSilentDeviceImplementation()
       
    60     {
       
    61     }
       
    62 
       
    63 EXPORT_C CUpnpSilentDeviceImplementation::~CUpnpSilentDeviceImplementation()
       
    64     {
       
    65     }
       
    66 
       
    67 // -----------------------------------------------------------------------------
       
    68 // CUpnpDeviceImplementation::ConstructL
       
    69 // -----------------------------------------------------------------------------
       
    70 //
       
    71 void CUpnpSilentDeviceImplementation::ConstructL(         
       
    72         const TDesC8& aUri, 
       
    73         CUpnpDeviceDescriptionStore& aDescriptionStore,
       
    74         MUpnpDeviceDescriptionProvider& aProvider )
       
    75     {
       
    76     BaseConstructL( aUri, aDescriptionStore, aProvider );
       
    77     }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CUpnpDeviceImplementationBase::StartL
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 EXPORT_C void CUpnpSilentDeviceImplementation::StartL( const TInt aPort )
       
    84     {   
       
    85     StartHttpServerL( aPort );
       
    86     GenerateUdnsL( this );
       
    87     SaveDescriptionStoreL();
       
    88     }
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // CUpnpSilentDeviceImplementation ::StopL
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 EXPORT_C void CUpnpSilentDeviceImplementation::StopL()
       
    95     {
       
    96     StopDeviceL();
       
    97     }
       
    98         
       
    99 // -----------------------------------------------------------------------------
       
   100 // CUpnpSilentDeviceImplementation::StopDeviceL
       
   101 // -----------------------------------------------------------------------------
       
   102 //
       
   103 void CUpnpSilentDeviceImplementation::StopDeviceL()
       
   104     {
       
   105     SaveDescriptionStoreL();
       
   106     StopHttpServer();
       
   107     }   
       
   108 
       
   109 // End of File