services/terminalmodeservice/src/upnptmserver.cpp
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: CUpnpTmServer class implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 //  Include Files  
       
    19 #include "upnptmserver.h"   
       
    20 #include "upnptmserverimpl.h"
       
    21 #include "OstTraceDefinitions.h"
       
    22 #ifdef OST_TRACE_COMPILER_IN_USE
       
    23 #include "upnptmserverTraces.h"
       
    24 #endif
       
    25 
       
    26 // ============================ MEMBER FUNCTIONS ===================================
       
    27 
       
    28 // ---------------------------------------------------------------------------------
       
    29 // CUpnpTmServer::NewL
       
    30 // Two-phased constructor.
       
    31 // ---------------------------------------------------------------------------------
       
    32 //
       
    33 EXPORT_C CUpnpTmServer* CUpnpTmServer::NewL( CUpnpTmServerDeviceInfo& aDeviceInfo,
       
    34                                             MUpnpTmServerObserver& aUpnpTmServerObserver)
       
    35     {
       
    36     OstTraceFunctionEntry0( CUPNPTMSERVER_NEWL_ENTRY );
       
    37     CUpnpTmServer* self = new (ELeave) CUpnpTmServer();
       
    38     CleanupStack::PushL(self);
       
    39     self->ConstructL( aDeviceInfo, aUpnpTmServerObserver);
       
    40     CleanupStack::Pop(self);
       
    41     OstTraceFunctionExit0( CUPNPTMSERVER_NEWL_EXIT );
       
    42     return self;
       
    43     }
       
    44 
       
    45 // ---------------------------------------------------------------------------------
       
    46 // CUpnpTmServer::CUpnpTmServer
       
    47 // C++ default constructor can NOT contain any code, that
       
    48 // might leave.
       
    49 // ---------------------------------------------------------------------------------
       
    50 //
       
    51 CUpnpTmServer::CUpnpTmServer()
       
    52     {
       
    53     
       
    54     }
       
    55 
       
    56 // ---------------------------------------------------------------------------------
       
    57 // CUpnpTmServer::ConstructL
       
    58 // Symbian 2nd phase constructor can leave.
       
    59 // ---------------------------------------------------------------------------------
       
    60 //
       
    61 void CUpnpTmServer::ConstructL( CUpnpTmServerDeviceInfo& aDeviceInfo, MUpnpTmServerObserver& aUpnpTmServerObserver)
       
    62     {
       
    63     OstTraceFunctionEntry0( CUPNPTMSERVER_CONSTRUCTL_ENTRY );
       
    64     iTmServerImpl = CUpnpTmServerImpl::NewL( aDeviceInfo, aUpnpTmServerObserver);
       
    65     OstTraceFunctionExit0( CUPNPTMSERVER_CONSTRUCTL_EXIT );
       
    66     }
       
    67 
       
    68 // ---------------------------------------------------------------------------------
       
    69 // Default Destructor
       
    70 // ---------------------------------------------------------------------------------
       
    71 //
       
    72 CUpnpTmServer::~CUpnpTmServer()
       
    73     {
       
    74     OstTraceFunctionEntry0( CUPNPTMSERVER_CUPNPTMSERVER_ENTRY );
       
    75     delete iTmServerImpl;
       
    76     OstTraceFunctionExit0( CUPNPTMSERVER_CUPNPTMSERVER_EXIT );
       
    77     }
       
    78 
       
    79 // ---------------------------------------------------------------------------------
       
    80 // Method is used by Automotive Server to register its applications one by one.
       
    81 // @param aRemotableApp Pointer to Remotable app object. Ownership is transferred.
       
    82 // ---------------------------------------------------------------------------------
       
    83 //
       
    84 EXPORT_C void CUpnpTmServer::RegisterAppL( CUpnpRemotableApp* aRemotableApp )
       
    85     {
       
    86     OstTraceFunctionEntry0( CUPNPTMSERVER_REGISTERAPPL_ENTRY );
       
    87     iTmServerImpl->RegisterAppL(aRemotableApp);
       
    88     OstTraceFunctionExit0( CUPNPTMSERVER_REGISTERAPPL_EXIT );
       
    89     }
       
    90 
       
    91 // ---------------------------------------------------------------------------------
       
    92 // Method is used by Automotive Server to register all the desired applications 
       
    93 // in one go.
       
    94 // @param aRemotableAppList Pointer Array of remotable app objects.
       
    95 //                          Ownership of all the objects is passed.
       
    96 // ---------------------------------------------------------------------------------
       
    97 //
       
    98 EXPORT_C void CUpnpTmServer::RegisterAppsL(const RPointerArray<CUpnpRemotableApp>& aRemotableAppList)
       
    99     {
       
   100     OstTraceFunctionEntry0( CUPNPTMSERVER_REGISTERAPPSL_ENTRY );
       
   101     iTmServerImpl->RegisterAppsL(aRemotableAppList);
       
   102     OstTraceFunctionExit0( CUPNPTMSERVER_REGISTERAPPSL_EXIT );
       
   103     }
       
   104 
       
   105 // ---------------------------------------------------------------------------------
       
   106 // Method is used by Automotive Server to un-register its applications which have 
       
   107 // already been registeredone by one
       
   108 // @param aAppId App ID of the application
       
   109 // ---------------------------------------------------------------------------------
       
   110 //
       
   111 EXPORT_C TInt CUpnpTmServer::UnRegisterApp( TUint aAppId )
       
   112     {
       
   113     OstTraceFunctionEntry0( CUPNPTMSERVER_UNREGISTERAPP_ENTRY );
       
   114     OstTrace1( TRACE_NORMAL, CUPNPTMSERVER_UNREGISTERAPP, "CUpnpTmServer::UnRegisterApp;aAppId=%u", aAppId ); 
       
   115     return iTmServerImpl->UnRegisterApp( aAppId );
       
   116     }
       
   117 
       
   118 // ---------------------------------------------------------------------------------
       
   119 // Method is used to un-register multiple applications in one go.
       
   120 // @param aAppIdArray Array of app IDs
       
   121 // ---------------------------------------------------------------------------------
       
   122 //
       
   123 EXPORT_C TInt CUpnpTmServer::UnRegisterApps( const RArray<TUint>& aAppIdArray )
       
   124     {
       
   125     OstTraceFunctionEntry0( CUPNPTMSERVER_UNREGISTERAPPS_ENTRY );
       
   126     return iTmServerImpl->UnRegisterApps( aAppIdArray );
       
   127     }
       
   128 
       
   129 // ---------------------------------------------------------------------------------
       
   130 // Method to set the XML signature of the registered apps.
       
   131 // @param aSignature XML formatted signature buffer
       
   132 // ---------------------------------------------------------------------------------
       
   133 //
       
   134 EXPORT_C void CUpnpTmServer::SetXmlSignatureL( const TDesC8& aSignature )
       
   135     {
       
   136     OstTraceFunctionEntry0( CUPNPTMSERVER_SETXMLSIGNATUREL_ENTRY );
       
   137     iTmServerImpl->SetXmlSignatureL( aSignature );   
       
   138     OstTraceFunctionExit0( CUPNPTMSERVER_SETXMLSIGNATUREL_EXIT );
       
   139     }
       
   140 
       
   141 // ---------------------------------------------------------------------------------
       
   142 // Method is used by Automotive Server to start publishing the remote ui server 
       
   143 // device and its service
       
   144 // ---------------------------------------------------------------------------------
       
   145 //
       
   146 EXPORT_C void CUpnpTmServer::StartL()
       
   147     {
       
   148     OstTraceFunctionEntry0( CUPNPTMSERVER_STARTL_ENTRY );
       
   149     iTmServerImpl->StartDeviceL();
       
   150     OstTraceFunctionExit0( CUPNPTMSERVER_STARTL_EXIT );
       
   151     }
       
   152 
       
   153 // ---------------------------------------------------------------------------------
       
   154 // Method is used by Automotive Server to stop publishing the remote ui server 
       
   155 // device and its service
       
   156 // -------------------------------------------------------------------------------------
       
   157 //
       
   158 EXPORT_C void CUpnpTmServer::StopL()
       
   159     {
       
   160     OstTraceFunctionEntry0( CUPNPTMSERVER_STOPL_ENTRY );
       
   161     iTmServerImpl->StopDeviceL();
       
   162     OstTraceFunctionExit0( CUPNPTMSERVER_STOPL_EXIT );
       
   163     }
       
   164 
       
   165 // ---------------------------------------------------------------------------------
       
   166 // Method to fetch the Remotable App object by passing the App ID of the same.
       
   167 // Method is invoked by the Automotive Server when it wishes to modify any of the
       
   168 // existing remotable app.
       
   169 // @param aAppId APP ID of the application for which caller wants the access.
       
   170 // @param aErr[out] Error code. KErrNone if app is found otherwise KErrNotFound
       
   171 // Returns reference to the remotable app object.
       
   172 // --------------------------------------------------------------------------------- 
       
   173 //
       
   174 EXPORT_C CUpnpRemotableApp& CUpnpTmServer::GetRemotableApp( TUint aAppId, TInt& aErr )
       
   175     {
       
   176     OstTraceFunctionEntry0( CUPNPTMSERVER_REMOTABLEAPP_ENTRY );
       
   177     OstTrace1( TRACE_NORMAL, DUP1_CUPNPTMSERVER_GETREMOTABLEAPP, "CUpnpTmServer::GetRemotableApp;aAppId =%d", aAppId  );
       
   178     return iTmServerImpl->GetRemotableApp( aAppId, aErr );  
       
   179     }
       
   180 
       
   181 // ---------------------------------------------------------------------------------
       
   182 // Method through which the notification of applications whose status 
       
   183 // has changed is sent across to the Car Kit through the Service 
       
   184 // @param aUpdatedAppIdList Array of app IDs which have undergone some 
       
   185 //                          kind of change[ added, delete or modified ]
       
   186 // ---------------------------------------------------------------------------------   
       
   187 //
       
   188 EXPORT_C void CUpnpTmServer::UpdateAppStatusL( const RArray<TUint>& aUpdatedAppIdList )
       
   189     {
       
   190     OstTraceFunctionEntry0( CUPNPTMSERVER_UPDATEAPPSTATUSL_ENTRY );
       
   191     iTmServerImpl->UpdateAppStatusL( aUpdatedAppIdList );   
       
   192     OstTraceFunctionExit0( CUPNPTMSERVER_UPDATEAPPSTATUSL_EXIT );
       
   193     }
       
   194 
       
   195 // ---------------------------------------------------------------------------------
       
   196 // Method through which the notification of applications whose entries 
       
   197 // in the application list have  changed is sent across to the Car Kit 
       
   198 // through the Service 
       
   199 // @param aUpdatedAppIdList Array of app IDs which have undergone some 
       
   200 //                          kind of change[ added, delete or modified ]
       
   201 // ---------------------------------------------------------------------------------   
       
   202 //
       
   203 EXPORT_C void CUpnpTmServer::UpdateAppListL( const RArray<TUint>& aUpdatedAppIdList )
       
   204     {
       
   205     OstTraceFunctionEntry0( CUPNPTMSERVER_UPDATEAPPLISTL_ENTRY );
       
   206     iTmServerImpl->UpdateAppListL( aUpdatedAppIdList );  
       
   207     OstTraceFunctionExit0( CUPNPTMSERVER_UPDATEAPPLISTL_EXIT );
       
   208     }
       
   209 
       
   210 // ---------------------------------------------------------------------------------
       
   211 // Method through which the notification of profileIDs which are not used
       
   212 // used by any Terminal Mode service hosted on the Terminal Mode device
       
   213 // is sent across to the Car Kit through the Service 
       
   214 // @param aUnusedProfileIdList Array of profile IDs which have undergone some 
       
   215 //                             kind of change
       
   216 // ---------------------------------------------------------------------------------   
       
   217 //
       
   218 EXPORT_C void CUpnpTmServer::UpdateUnusedProfileIdsL( const RArray<TUint>& aUnusedProfileIdList )
       
   219     {
       
   220     OstTraceFunctionEntry0( CUPNPTMSERVER_UPDATEUNUSEDPROFILEIDSL_ENTRY );
       
   221     iTmServerImpl->UpdateUnusedProfileIdsL( aUnusedProfileIdList );   
       
   222     OstTraceFunctionExit0( CUPNPTMSERVER_UPDATEUNUSEDPROFILEIDSL_EXIT );
       
   223     }