services/terminalmodeservice/inc/upnptmserverimpl.h
branchRCL_3
changeset 10 594d15129e2c
parent 9 5c72fd91570d
equal deleted inserted replaced
9:5c72fd91570d 10:594d15129e2c
     1 /**
       
     2 * Copyright (c) 2010 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: CUpnpTmServerImpl class declaration
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __UPNPTMSERVERIMPL_H__
       
    19 #define __UPNPTMSERVERIMPL_H__
       
    20 
       
    21 // System Includes
       
    22 #include <upnpsettings.h>
       
    23 #include <upnphttpserversession.h>
       
    24 #include <utf.h>
       
    25 
       
    26 // User Includes
       
    27 #include "upnptmserver.h"
       
    28 #include "upnptminfoelement.h"
       
    29 #include "upnptmserverdevice.h"
       
    30 #include "upnpremotableappstore.h"
       
    31 #include "upnptmfilteredapplist.h"
       
    32 #include "upnptmiconmapping.h"
       
    33 #include "upnpsvgimageconverter.h"
       
    34 
       
    35 //Literals
       
    36 _LIT8(KStartApp,                 "&lt;app&gt;");
       
    37 _LIT8(KEndApp,                   "&lt;/app&gt;");
       
    38 _LIT8(KStartIconList,            "&lt;iconList&gt;");
       
    39 _LIT8(KEndIconList,              "&lt;/iconList&gt;");
       
    40 _LIT8(KStartNameDesc,            "&lt;description&gt;");
       
    41 _LIT8(KEndNameDesc,              "&lt;/description&gt;");
       
    42 _LIT8(KWildCard,                 "*");
       
    43 _LIT8(KAtToken,                  "@");
       
    44 
       
    45 //Constants
       
    46 const TUint KActionBufferLength  = 1000;
       
    47 
       
    48 /**
       
    49  * Implementation class ( body ) for CUpnpTmServer class
       
    50  *
       
    51  */
       
    52 class CUpnpTmServerImpl : public CBase 
       
    53     {
       
    54 public:
       
    55     static CUpnpTmServerImpl* NewL( CUpnpTmServerDeviceInfo& aDeviceInfo, 
       
    56                                     MUpnpTmServerObserver& aTmServerObserver );
       
    57     
       
    58     virtual ~CUpnpTmServerImpl();   
       
    59 
       
    60     void RegisterAppL( CUpnpRemotableApp* aRemotableApp );
       
    61     void RegisterAppsL(const RPointerArray<CUpnpRemotableApp>& aRemotableAppList);
       
    62     TInt UnRegisterApp( TUint aAppId );
       
    63     TInt UnRegisterApps( const RArray<TUint>& aAppIdArray );
       
    64                                                                   
       
    65     void SetXmlSignatureL( const TDesC8& aSignature );  
       
    66     const TDesC8& XmlSignature()const;
       
    67     // Start and Stop methods
       
    68     void StartDeviceL();
       
    69     void StopDeviceL();
       
    70     CUpnpRemotableApp& GetRemotableApp( TUint aAppId, TInt& aErr );
       
    71     void GenerateUrlComponents( CUpnpHttpServerSession& aHttpServerSession );
       
    72     const TDesC8& ConvertIntToDescriptor( TInt aIntVal );
       
    73     
       
    74 public:
       
    75     //Action handling methods
       
    76     const TDesC8& GetApplicationListL( const TDesC8& aAppListFilter,
       
    77                                    TUint aProfileId, TTerminalModeErrorCode& aErr );
       
    78     TTerminalModeErrorCode LaunchApp( TUint aAppId, TUint aProfileId, RBuf8& aUrl ); 
       
    79     TTerminalModeErrorCode TerminateApp( TUint aAppId, TUint aProfileId );
       
    80     void GetAppStatusL( const TDesC8& aAppIdBuffer,RBuf8& aStatusType,
       
    81                                               TTerminalModeErrorCode& aErr );
       
    82     TTerminalModeErrorCode GetMaxNumProfiles( TUint& aNumMaxProfiles );
       
    83     TTerminalModeErrorCode SetClientProfile( TUint aProfileId, const TDesC8& aInputClientProfile,
       
    84                                                                          RBuf8& aResultProfile );
       
    85     TTerminalModeErrorCode GetClientProfile( TUint aProfileId, RBuf8& aClientProfile );
       
    86     
       
    87     //Event Notification methods
       
    88     void UpdateAppStatusL( const RArray<TUint>& aUpdatedAppIdList );
       
    89     void UpdateAppListL( const RArray<TUint>& aUpdatedAppIdList );
       
    90     void UpdateUnusedProfileIdsL( const RArray<TUint>& aUnusedProfileIdList );
       
    91     
       
    92     // Application icon fetching method
       
    93     void GetIconInfoL( const TDesC8& aUrl, CUpnpHttpServerTransaction*& aResultTrans );
       
    94     
       
    95 private:
       
    96     CUpnpTmServerImpl( MUpnpTmServerObserver& aTmServerObserver );
       
    97     void ConstructL(  CUpnpTmServerDeviceInfo&  aDeviceInfo );
       
    98     void RestoreIap();
       
    99     
       
   100     void AppendDataL( const TDesC8& aData );
       
   101     TTerminalModeErrorCode AuthorizeApp( TUint aAppId );
       
   102     void ConstructActionResponseBufferL( TInt aAppIndex ); 
       
   103     void ConstructLeadingSoapBufferL( TInt aAppIndex );
       
   104     void SetRemotableAppIconInfoL(  const CUpnpTerminalModeIcon& aTmIcon );
       
   105     void SetAllowedProfileIdListL( TInt aAppIndex );
       
   106     void SetTerminalModeInfoElementL( const CUpnpTmInfoElement& aTmInfoElement );
       
   107     void SetResourceStatusL( TInt aAppIndex );
       
   108     void CreateGetAppStatusResponseL( TUint aAppId, TTerminalModeErrorCode& aErr ); 
       
   109     void CreateEventMessageL( const RArray<TUint>& aIdList );
       
   110     friend class CUpnpTmFilteredAppList;
       
   111  
       
   112 private:
       
   113     CUpnpTmServerDevice*                  iTmServerDevice;
       
   114     MUpnpTmServerObserver&                iTmServerObserver;
       
   115     RBuf8                                 iResponseBuf;
       
   116     TBuf8<UpnpString::KShortStringLength> iAddrBuf;
       
   117     TBuf8<UpnpString::KShortStringLength> iPortBuf;   
       
   118     RBuf8                                 iXmSignature;
       
   119     CUpnpRemotableAppStore*               iAppStore;
       
   120     RFs                                   iIconFileSession;
       
   121     CUpnpTmFilteredAppList*               iFilteredAppList;
       
   122     TBuf8<UpnpString::KShortStringLength> iBufVal;
       
   123     CUpnpSettings*                        iIapSetting;
       
   124     TInt                                  iIapId;   // Original IAP ID used by DLNA  
       
   125     TUint                                 iProfileId;
       
   126     // Mapping between application icon filepath and its URL
       
   127     CUpnpTmIconMapping*                   iIconMapping;
       
   128     };
       
   129 
       
   130 #endif  // __UPNPTMSERVERIMPL_H__