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