services/terminalmodeservice/src/upnpremotableapp.cpp
author hgs
Fri, 03 Sep 2010 09:13:04 +0300
changeset 31 b51a6f4f15ba
parent 24 e9457ebcc4df
permissions -rw-r--r--
201035
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24
hgs
parents:
diff changeset
     1
/**
hgs
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description: CUpnpRemotableApp class implementation.
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
#include "upnpremotableapp.h"
hgs
parents:
diff changeset
    19
#include "OstTraceDefinitions.h"
hgs
parents:
diff changeset
    20
#ifdef OST_TRACE_COMPILER_IN_USE
hgs
parents:
diff changeset
    21
#include "upnpremotableappTraces.h"
hgs
parents:
diff changeset
    22
#endif
hgs
parents:
diff changeset
    23
hgs
parents:
diff changeset
    24
hgs
parents:
diff changeset
    25
// ============================ MEMBER FUNCTIONS ===================================
hgs
parents:
diff changeset
    26
hgs
parents:
diff changeset
    27
// ---------------------------------------------------------------------------------
hgs
parents:
diff changeset
    28
// CUpnpRemotableApp::NewL
hgs
parents:
diff changeset
    29
// Two-phased constructor.
hgs
parents:
diff changeset
    30
// @param aAppId App ID of the remotable app
hgs
parents:
diff changeset
    31
// @param aAppName Name of the remotable app
hgs
parents:
diff changeset
    32
// ---------------------------------------------------------------------------------
hgs
parents:
diff changeset
    33
//
hgs
parents:
diff changeset
    34
EXPORT_C CUpnpRemotableApp* CUpnpRemotableApp::NewL( TUint aAppId ,const TDesC8& aAppName )
hgs
parents:
diff changeset
    35
    {
hgs
parents:
diff changeset
    36
    OstTraceFunctionEntry0( CUPNPREMOTABLEAPP_NEWL_ENTRY );
hgs
parents:
diff changeset
    37
    CUpnpRemotableApp* self = new (ELeave) CUpnpRemotableApp(aAppId);    
hgs
parents:
diff changeset
    38
    CleanupStack::PushL(self);
hgs
parents:
diff changeset
    39
    self->ConstructL( aAppName );  
hgs
parents:
diff changeset
    40
    CleanupStack::Pop(self);
hgs
parents:
diff changeset
    41
    OstTraceFunctionExit0( CUPNPREMOTABLEAPP_NEWL_EXIT );
hgs
parents:
diff changeset
    42
    return self;
hgs
parents:
diff changeset
    43
    }
hgs
parents:
diff changeset
    44
hgs
parents:
diff changeset
    45
// ---------------------------------------------------------------------------------
hgs
parents:
diff changeset
    46
// CUpnpRemotableApp::CUpnpRemotableApp
hgs
parents:
diff changeset
    47
// C++ default constructor can NOT contain any code, that might leave.
hgs
parents:
diff changeset
    48
// ---------------------------------------------------------------------------------
hgs
parents:
diff changeset
    49
//
hgs
parents:
diff changeset
    50
CUpnpRemotableApp::CUpnpRemotableApp( TUint aAppId ):iAppId(aAppId)
hgs
parents:
diff changeset
    51
    {
hgs
parents:
diff changeset
    52
    
hgs
parents:
diff changeset
    53
    }
hgs
parents:
diff changeset
    54
hgs
parents:
diff changeset
    55
// ---------------------------------------------------------------------------------
hgs
parents:
diff changeset
    56
// CUpnpRemotableApp::ConstructL
hgs
parents:
diff changeset
    57
// Symbian 2nd phase constructor can leave.
hgs
parents:
diff changeset
    58
// ---------------------------------------------------------------------------------
hgs
parents:
diff changeset
    59
//
hgs
parents:
diff changeset
    60
void CUpnpRemotableApp::ConstructL( const TDesC8& aAppname )
hgs
parents:
diff changeset
    61
    {
hgs
parents:
diff changeset
    62
    OstTraceFunctionEntry0( CUPNPREMOTABLEAPP_CONSTRUCTL_ENTRY );
hgs
parents:
diff changeset
    63
    iAppName.CreateL(aAppname);
hgs
parents:
diff changeset
    64
    OstTraceFunctionExit0( CUPNPREMOTABLEAPP_CONSTRUCTL_EXIT );
hgs
parents:
diff changeset
    65
    }
hgs
parents:
diff changeset
    66
hgs
parents:
diff changeset
    67
// ---------------------------------------------------------------------------------
hgs
parents:
diff changeset
    68
// CUpnpRemotableApp::~CUpnpRemotableApp
hgs
parents:
diff changeset
    69
// Destructor
hgs
parents:
diff changeset
    70
// ---------------------------------------------------------------------------------
hgs
parents:
diff changeset
    71
//
hgs
parents:
diff changeset
    72
CUpnpRemotableApp::~CUpnpRemotableApp()
hgs
parents:
diff changeset
    73
    {
hgs
parents:
diff changeset
    74
    OstTraceFunctionEntry0( CUPNPREMOTABLEAPP_CUPNPREMOTABLEAPP_ENTRY );
hgs
parents:
diff changeset
    75
    iTmInfoElementList.ResetAndDestroy();
hgs
parents:
diff changeset
    76
    iTmInfoElementList.Close();
hgs
parents:
diff changeset
    77
    iProfileIdList.Close();
hgs
parents:
diff changeset
    78
    iIconList.ResetAndDestroy();
hgs
parents:
diff changeset
    79
    iIconList.Close();
hgs
parents:
diff changeset
    80
    iAppName.Close();
hgs
parents:
diff changeset
    81
    iAppDescription.Close();
hgs
parents:
diff changeset
    82
    iResourceStatus.Close();
hgs
parents:
diff changeset
    83
    OstTraceFunctionExit0( CUPNPREMOTABLEAPP_CUPNPREMOTABLEAPP_EXIT );
hgs
parents:
diff changeset
    84
    }
hgs
parents:
diff changeset
    85
hgs
parents:
diff changeset
    86
// ---------------------------------------------------------------------------------
hgs
parents:
diff changeset
    87
// CUpnpRemotableApp::AddIconL
hgs
parents:
diff changeset
    88
// Method is used to add an icon element to the application.
hgs
parents:
diff changeset
    89
// @param aIcon Pointer to TerminalMode icon object
hgs
parents:
diff changeset
    90
// ---------------------------------------------------------------------------------
hgs
parents:
diff changeset
    91
//
hgs
parents:
diff changeset
    92
EXPORT_C void CUpnpRemotableApp::AddIconL(CUpnpTerminalModeIcon* aIcon)
hgs
parents:
diff changeset
    93
    {
hgs
parents:
diff changeset
    94
    OstTraceFunctionEntry0( CUPNPREMOTABLEAPP_ADDICONL_ENTRY );
hgs
parents:
diff changeset
    95
    iIconList.AppendL(aIcon);
hgs
parents:
diff changeset
    96
    OstTraceFunctionExit0( CUPNPREMOTABLEAPP_ADDICONL_EXIT );
hgs
parents:
diff changeset
    97
    }
hgs
parents:
diff changeset
    98
hgs
parents:
diff changeset
    99
// ---------------------------------------------------------------------------------
hgs
parents:
diff changeset
   100
// CUpnpRemotableApp::SetAppDescriptionL
hgs
parents:
diff changeset
   101
// Method is used to add the description of the application
hgs
parents:
diff changeset
   102
// @param aDescription Description of the aapplication
hgs
parents:
diff changeset
   103
// ---------------------------------------------------------------------------------
hgs
parents:
diff changeset
   104
//
hgs
parents:
diff changeset
   105
EXPORT_C void CUpnpRemotableApp::SetAppDescriptionL( const TDesC8& aDescription )
hgs
parents:
diff changeset
   106
    {
hgs
parents:
diff changeset
   107
    OstTraceFunctionEntry0( CUPNPREMOTABLEAPP_SETAPPDESCRIPTIONL_ENTRY );
hgs
parents:
diff changeset
   108
    iAppDescription.Close();
hgs
parents:
diff changeset
   109
    iAppDescription.CreateL(aDescription);
hgs
parents:
diff changeset
   110
    OstTraceFunctionExit0( CUPNPREMOTABLEAPP_SETAPPDESCRIPTIONL_EXIT );
hgs
parents:
diff changeset
   111
    }
hgs
parents:
diff changeset
   112
hgs
parents:
diff changeset
   113
// ---------------------------------------------------------------------------------
hgs
parents:
diff changeset
   114
// CUpnpRemotableApp::SetAllowedProfileIdListL
hgs
parents:
diff changeset
   115
// Method is used to set the list of allowed profile IDs for the application.
hgs
parents:
diff changeset
   116
// @param aProfileIdList Reference to the list of allowed profile IDs.
hgs
parents:
diff changeset
   117
//                       A copy of the list is maintained.
hgs
parents:
diff changeset
   118
// ---------------------------------------------------------------------------------
hgs
parents:
diff changeset
   119
//
hgs
parents:
diff changeset
   120
EXPORT_C void CUpnpRemotableApp::SetAllowedProfileIdListL( const RArray<TUint>& aProfileIdList )
hgs
parents:
diff changeset
   121
    {
hgs
parents:
diff changeset
   122
    OstTraceFunctionEntry0( CUPNPREMOTABLEAPP_SETALLOWEDPROFILEIDLISTL_ENTRY );
hgs
parents:
diff changeset
   123
    iProfileIdList.Close();
hgs
parents:
diff changeset
   124
    /**
hgs
parents:
diff changeset
   125
     * Create a copy of the profile ID list.
hgs
parents:
diff changeset
   126
     * Only distinct and unique profile IDs are copied into the array.
hgs
parents:
diff changeset
   127
     */
hgs
parents:
diff changeset
   128
    for ( TInt i(0); i < aProfileIdList.Count(); i++ )
hgs
parents:
diff changeset
   129
        {
hgs
parents:
diff changeset
   130
        OstTrace1( TRACE_NORMAL, CUPNPREMOTABLEAPP_SETALLOWEDPROFILEIDLISTL, "CUpnpRemotableApp::SetAllowedProfileIdListL;aProfileIdList[i]=%d", aProfileIdList[i] );
hgs
parents:
diff changeset
   131
        if ( iProfileIdList.Find(aProfileIdList[i]) == KErrNotFound )
hgs
parents:
diff changeset
   132
            {
hgs
parents:
diff changeset
   133
            iProfileIdList.AppendL(aProfileIdList[i]);
hgs
parents:
diff changeset
   134
            }
hgs
parents:
diff changeset
   135
        }
hgs
parents:
diff changeset
   136
    OstTraceFunctionExit0( CUPNPREMOTABLEAPP_SETALLOWEDPROFILEIDLISTL_EXIT );
hgs
parents:
diff changeset
   137
    }
hgs
parents:
diff changeset
   138
hgs
parents:
diff changeset
   139
// ---------------------------------------------------------------------------------
hgs
parents:
diff changeset
   140
// CUpnpRemotableApp::CreateTmInfoElementL
hgs
parents:
diff changeset
   141
// Method is used to create a terminal mode info for the application and 
hgs
parents:
diff changeset
   142
// it gets appended to the terminal mode list.
hgs
parents:
diff changeset
   143
// @param aTerminalModeInfoType Terminal Mode Info Type
hgs
parents:
diff changeset
   144
// @return Returns the reference to the CUpnpTerminalModeInfo object
hgs
parents:
diff changeset
   145
// ---------------------------------------------------------------------------------
hgs
parents:
diff changeset
   146
//
hgs
parents:
diff changeset
   147
EXPORT_C CUpnpTmInfoElement& CUpnpRemotableApp::CreateTmInfoElementL(
hgs
parents:
diff changeset
   148
                       CUpnpTmInfoElement::TTerminalModeInfoType aTerminalModeInfoType )
hgs
parents:
diff changeset
   149
    {
hgs
parents:
diff changeset
   150
    OstTraceFunctionEntry0( CUPNPREMOTABLEAPP_CREATETERMINALMODEINFOL_ENTRY );
hgs
parents:
diff changeset
   151
    CUpnpTmInfoElement* tmInfoElement = CUpnpTmInfoElement::NewL(aTerminalModeInfoType);
hgs
parents:
diff changeset
   152
    CleanupStack::PushL(tmInfoElement);
hgs
parents:
diff changeset
   153
    iTmInfoElementList.AppendL(tmInfoElement);
hgs
parents:
diff changeset
   154
    CleanupStack::Pop(tmInfoElement);
hgs
parents:
diff changeset
   155
    OstTraceFunctionExit0( CUPNPREMOTABLEAPP_CREATETERMINALMODEINFOL_EXIT );
hgs
parents:
diff changeset
   156
    return *tmInfoElement;
hgs
parents:
diff changeset
   157
    }
hgs
parents:
diff changeset
   158
hgs
parents:
diff changeset
   159
// ---------------------------------------------------------------------------------
hgs
parents:
diff changeset
   160
// CUpnpRemotableApp::SetResourceStatusL
hgs
parents:
diff changeset
   161
// Method is used to define the current status of the resource.
hgs
parents:
diff changeset
   162
// @param aResourceStatus Status of the resource
hgs
parents:
diff changeset
   163
//   “free” – Resource is free. Can be used by the Terminal Mode client. (default)
hgs
parents:
diff changeset
   164
//   “busy” – Resource already used. Resource assignment can be overridden by
hgs
parents:
diff changeset
   165
//            a client’s invocation LaunchApplication action.
hgs
parents:
diff changeset
   166
//   “NA” – Resource already used. Resource assignment cannot be overridden by a 
hgs
parents:
diff changeset
   167
//          LaunchApplication action invoked by a client.
hgs
parents:
diff changeset
   168
// ---------------------------------------------------------------------------------
hgs
parents:
diff changeset
   169
//
hgs
parents:
diff changeset
   170
EXPORT_C void CUpnpRemotableApp::SetResourceStatusL( const TDesC8& aResourceStatus )
hgs
parents:
diff changeset
   171
    {
hgs
parents:
diff changeset
   172
    OstTraceFunctionEntry0( CUPNPREMOTABLEAPP_SETRESOURCESTATUSL_ENTRY );
hgs
parents:
diff changeset
   173
    iResourceStatus.Close();
hgs
parents:
diff changeset
   174
    iResourceStatus.CreateL(aResourceStatus); 
hgs
parents:
diff changeset
   175
    OstTraceFunctionExit0( CUPNPREMOTABLEAPP_SETRESOURCESTATUSL_EXIT );
hgs
parents:
diff changeset
   176
    }
hgs
parents:
diff changeset
   177