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: CUpnpTmServerDevice class implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include "upnptmserverdevice.h" |
|
20 #include <upnpconnectionmanagernetworkeventprovider.h> |
|
21 #include "OstTraceDefinitions.h" |
|
22 #ifdef OST_TRACE_COMPILER_IN_USE |
|
23 #include "upnptmserverdeviceTraces.h" |
|
24 #endif |
|
25 |
|
26 |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS =================================== |
|
29 |
|
30 // --------------------------------------------------------------------------------- |
|
31 // CUpnpTmServerDevice::NewL |
|
32 // Two-phased constructor. |
|
33 // --------------------------------------------------------------------------------- |
|
34 // |
|
35 CUpnpTmServerDevice* CUpnpTmServerDevice::NewL( CUpnpTmServerDeviceInfo& aDeviceInfo, |
|
36 CUpnpTmServerImpl& aTmServerImpl ) |
|
37 { |
|
38 OstTraceFunctionEntry0( CUPNPTMSERVERDEVICE_NEWL_ENTRY ); |
|
39 CUpnpTmServerDevice* self = new( ELeave ) CUpnpTmServerDevice(); |
|
40 CleanupStack::PushL( self ); |
|
41 self->ConstructL( aDeviceInfo, aTmServerImpl ); |
|
42 CleanupStack::Pop(self); |
|
43 OstTraceFunctionExit0( CUPNPTMSERVERDEVICE_NEWL_EXIT ); |
|
44 return self; |
|
45 } |
|
46 |
|
47 // ------------------------------------------------------------------------------------- |
|
48 // CUpnpTmServerDevice::CUpnpTmServerDevice |
|
49 // C++ default constructor can NOT contain any code, that |
|
50 // might leave. |
|
51 // --------------------------------------------------------------------------------- |
|
52 // |
|
53 CUpnpTmServerDevice::CUpnpTmServerDevice():iIsStarted(EFalse) |
|
54 { |
|
55 } |
|
56 |
|
57 // --------------------------------------------------------------------------------- |
|
58 // CUpnpTmServerDevice::ConstructL |
|
59 // Symbian 2nd phase constructor can leave. |
|
60 // --------------------------------------------------------------------------------- |
|
61 // |
|
62 void CUpnpTmServerDevice::ConstructL( CUpnpTmServerDeviceInfo& aDeviceInfo, |
|
63 CUpnpTmServerImpl& aTmServerImpl ) |
|
64 { |
|
65 OstTraceFunctionEntry0( CUPNPTMSERVERDEVICE_CONSTRUCTL_ENTRY ); |
|
66 iXmlParser = CUpnpTmServerDeviceXmlParser::NewL( aDeviceInfo ); |
|
67 iXmlParser->StartL(); |
|
68 iDescriptionProvider = CUpnpTmServerDescriptionProvider::NewL(); |
|
69 |
|
70 iDescriptionStore = CUpnpDeviceDescriptionStore::NewL( iXmlParser->DevicePath() ); |
|
71 // creates device |
|
72 iDevice = CUpnpDeviceImplementation::NewL( iXmlParser->DescriptionUri(), |
|
73 *iDescriptionStore, |
|
74 *iDescriptionProvider ); |
|
75 // Creates two services |
|
76 iTmAppServerService = CUpnpTmAppServerService::NewL( *iDevice, iXmlParser->AppServerSrvPath(), aTmServerImpl ); |
|
77 iTmClientProfileService = CUpnpTmClientProfileService::NewL( *iDevice, iXmlParser->ClientProfileSrvPath(), |
|
78 aTmServerImpl ); |
|
79 OstTraceFunctionExit0( CUPNPTMSERVERDEVICE_CONSTRUCTL_EXIT ); |
|
80 } |
|
81 |
|
82 // --------------------------------------------------------------------------------- |
|
83 // CUpnpTmServerDevice::~CUpnpTmServerDevice |
|
84 // Destructor |
|
85 // --------------------------------------------------------------------------------- |
|
86 // |
|
87 CUpnpTmServerDevice::~CUpnpTmServerDevice() |
|
88 { |
|
89 OstTraceFunctionEntry0( CUPNPTMSERVERDEVICE_CUPNPTMSERVERDEVICE_ENTRY ); |
|
90 delete iTmAppServerService; |
|
91 delete iTmClientProfileService; |
|
92 delete iDevice; |
|
93 delete iDescriptionStore; |
|
94 delete iDescriptionProvider; |
|
95 delete iXmlParser; |
|
96 OstTraceFunctionExit0( CUPNPTMSERVERDEVICE_CUPNPTMSERVERDEVICE_EXIT ); |
|
97 } |
|
98 |
|
99 // --------------------------------------------------------------------------------- |
|
100 // CUpnpTmServerDevice::StartTmServerDeviceL |
|
101 // Starts the Terminal Mode Server Device if not started. |
|
102 // --------------------------------------------------------------------------------- |
|
103 // |
|
104 void CUpnpTmServerDevice::StartTmServerDeviceL() |
|
105 { |
|
106 OstTraceFunctionEntry0( CUPNPTMSERVERDEVICE_STARTTMSERVERDEVICEL_ENTRY ); |
|
107 if ( iIsStarted ) |
|
108 { |
|
109 // Device is already up and running |
|
110 OstTraceFunctionExit0( CUPNPTMSERVERDEVICE_STARTTMSERVERDEVICEL_EXIT ); |
|
111 return; |
|
112 } |
|
113 |
|
114 if ( !iDevice ) |
|
115 { |
|
116 // Leaves if the device object is not initialised |
|
117 User::Leave(KErrNotReady); |
|
118 } |
|
119 // Starts TM Server Device |
|
120 iDevice->StartL(); |
|
121 iIsStarted = ETrue; |
|
122 OstTraceFunctionExit0( DUP1_CUPNPTMSERVERDEVICE_STARTTMSERVERDEVICEL_EXIT ); |
|
123 } |
|
124 |
|
125 // --------------------------------------------------------------------------------- |
|
126 // CUpnpTmServerDevice::StopTmServerDeviceL |
|
127 // Stops the Terminal Mode Server Device. |
|
128 // --------------------------------------------------------------------------------- |
|
129 // |
|
130 void CUpnpTmServerDevice::StopTmServerDeviceL() |
|
131 { |
|
132 OstTraceFunctionEntry0( CUPNPTMSERVERDEVICE_STOPTMSERVERDEVICEL_ENTRY ); |
|
133 if ( iDevice ) |
|
134 { |
|
135 iDevice->StopL(); |
|
136 } |
|
137 iIsStarted = EFalse; |
|
138 OstTraceFunctionExit0( CUPNPTMSERVERDEVICE_STOPTMSERVERDEVICEL_EXIT ); |
|
139 } |
|
140 |
|
141 // --------------------------------------------------------------------------------- |
|
142 // CUpnpTmServerDevice::AppStatusUpdateL |
|
143 // Notifies the client about the application status updates |
|
144 // @param aStatusEventBuffer buffer holding the update app status information |
|
145 // --------------------------------------------------------------------------------- |
|
146 // |
|
147 void CUpnpTmServerDevice::AppStatusUpdateL( const TDesC8& aStatusEventBuffer ) |
|
148 { |
|
149 OstTraceFunctionEntry0( CUPNPTMSERVERDEVICE_APPSTATUSUPDATEL_ENTRY ); |
|
150 iTmAppServerService->AppStatusUpdateEventL(aStatusEventBuffer); |
|
151 OstTraceFunctionExit0( CUPNPTMSERVERDEVICE_APPSTATUSUPDATEL_EXIT ); |
|
152 } |
|
153 |
|
154 // --------------------------------------------------------------------------------- |
|
155 // CUpnpTmServerDevice::AppListUpdateL |
|
156 // Notifies the client about the application list updates |
|
157 // @param aListEventBuffer buffer holding the update app list information |
|
158 // --------------------------------------------------------------------------------- |
|
159 // |
|
160 void CUpnpTmServerDevice::AppListUpdateL( const TDesC8& aListEventBuffer ) |
|
161 { |
|
162 OstTraceFunctionEntry0( CUPNPTMSERVERDEVICE_APPLISTUPDATEL_ENTRY ); |
|
163 iTmAppServerService->AppListUpdateEventL(aListEventBuffer); |
|
164 OstTraceFunctionExit0( CUPNPTMSERVERDEVICE_APPLISTUPDATEL_EXIT ); |
|
165 } |
|
166 |
|
167 // --------------------------------------------------------------------------------- |
|
168 // CUpnpTmServerDevice::aUnusedProfileIdBuffer |
|
169 // Notifies the client about the application list updates |
|
170 // @param aUnusedProfileIdBuffer buffer holding the update app list information |
|
171 // --------------------------------------------------------------------------------- |
|
172 // |
|
173 void CUpnpTmServerDevice::UnUsedProfileIdUpdateL( const TDesC8& aUnusedProfileIdBuffer ) |
|
174 { |
|
175 OstTraceFunctionEntry0( CUPNPTMSERVERDEVICE_UNUSEDPROFILEIDUPDATEL_ENTRY ); |
|
176 iTmClientProfileService->UnUsedProfileIdEventL(aUnusedProfileIdBuffer); |
|
177 OstTraceFunctionExit0( CUPNPTMSERVERDEVICE_UNUSEDPROFILEIDUPDATEL_EXIT ); |
|
178 } |
|
179 |
|
180 // End of File |
|