61 // |
61 // |
62 CIAUpdateFWUpdateHandler::~CIAUpdateFWUpdateHandler() |
62 CIAUpdateFWUpdateHandler::~CIAUpdateFWUpdateHandler() |
63 { |
63 { |
64 TInt err = RProperty::Delete(KPSUidNSmlDMSyncApp,KNSmlCurrentFotaUpdateAppName); |
64 TInt err = RProperty::Delete(KPSUidNSmlDMSyncApp,KNSmlCurrentFotaUpdateAppName); |
65 delete iFotaModel; |
65 delete iFotaModel; |
66 delete iDMEngine; |
66 delete iFWSyncAppEngine; |
67 } |
67 } |
68 |
68 |
69 |
69 |
70 // ----------------------------------------------------------------------------- |
70 // ----------------------------------------------------------------------------- |
71 // CIAUpdateFWUpdateHandler::FirmWareUpdatewithNSU() |
71 // CIAUpdateFWUpdateHandler::IsDMSupportAvailableL() |
72 // ----------------------------------------------------------------------------- |
72 // ----------------------------------------------------------------------------- |
73 // |
73 // |
74 EXPORT_C void CIAUpdateFWUpdateHandler::FirmWareUpdatewithNSU() |
74 EXPORT_C TBool CIAUpdateFWUpdateHandler::IsDMSupportAvailableL() |
75 { |
75 { |
76 iRequest = ENSU; |
76 return iFotaModel->IsDMSupportAvailableL(); |
|
77 } |
|
78 |
|
79 // ----------------------------------------------------------------------------- |
|
80 // CIAUpdateFWUpdateHandler::FirmWareUpdatewithFOTA() |
|
81 // ----------------------------------------------------------------------------- |
|
82 // |
|
83 EXPORT_C void CIAUpdateFWUpdateHandler::FirmWareUpdatewithFOTA( MIAUpdateFWUpdateObserver* aObserver ) |
|
84 { |
|
85 iObserver = aObserver; |
77 iStatus = KRequestPending; |
86 iStatus = KRequestPending; |
78 TRequestStatus* status = &iStatus; |
87 TRequestStatus* status = &iStatus; |
79 |
88 |
80 SetActive(); |
89 SetActive(); |
81 User::RequestComplete( status, KErrNone ); |
90 User::RequestComplete( status, KErrNone ); |
82 } |
91 } |
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // CIAUpdateFWUpdateHandler::IsDMSupportAvailableL() |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 EXPORT_C TBool CIAUpdateFWUpdateHandler::IsDMSupportAvailableL() |
|
89 { |
|
90 return iFotaModel->IsDMSupportAvailableL(); |
|
91 } |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // CIAUpdateFWUpdateHandler::FirmWareUpdatewithFOTA() |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 EXPORT_C void CIAUpdateFWUpdateHandler::FirmWareUpdatewithFOTA() |
|
98 { |
|
99 iRequest = EFOTA; |
|
100 iStatus = KRequestPending; |
|
101 TRequestStatus* status = &iStatus; |
|
102 |
|
103 SetActive(); |
|
104 User::RequestComplete( status, KErrNone ); |
|
105 } |
|
106 |
92 |
107 |
93 |
108 // ----------------------------------------------------------------------------- |
94 // ----------------------------------------------------------------------------- |
109 // CIAUpdateFWUpdateHandler::CIAUpdateFWUpdateHandler() |
95 // CIAUpdateFWUpdateHandler::CIAUpdateFWUpdateHandler() |
110 // ----------------------------------------------------------------------------- |
96 // ----------------------------------------------------------------------------- |
120 // ----------------------------------------------------------------------------- |
106 // ----------------------------------------------------------------------------- |
121 // |
107 // |
122 void CIAUpdateFWUpdateHandler::ConstructL() |
108 void CIAUpdateFWUpdateHandler::ConstructL() |
123 { |
109 { |
124 iFotaModel = CIAUpdateFWFotaModel::NewL(); |
110 iFotaModel = CIAUpdateFWFotaModel::NewL(); |
125 iDMEngine = CIAUpdateFWSyncAppEngine::NewL( iFotaModel ); |
111 iFWSyncAppEngine = CIAUpdateFWSyncAppEngine::NewL( iFotaModel ); |
126 } |
112 } |
127 |
113 |
128 |
114 |
129 // ----------------------------------------------------------------------------- |
115 // ----------------------------------------------------------------------------- |
130 // CIAUpdateFWUpdateHandler::RunL() |
116 // CIAUpdateFWUpdateHandler::RunL() |
131 // ----------------------------------------------------------------------------- |
117 // ----------------------------------------------------------------------------- |
132 // |
118 // |
133 void CIAUpdateFWUpdateHandler::RunL() |
119 void CIAUpdateFWUpdateHandler::RunL() |
134 { |
120 { |
135 switch ( iRequest ) |
121 //check whether FOTA engine is available at the moment |
|
122 TBool isDmActive = EFalse; |
|
123 |
|
124 TInt fotamodelstate = iFotaModel->GetCurrentFwUpdState(); |
|
125 |
|
126 FLOG_NUM( "[IAUPDATEFW] fota status = %d", fotamodelstate ); |
|
127 |
|
128 if ( fotamodelstate != RFotaEngineSession::EIdle ) |
|
129 { |
|
130 //if status is downloadcomplete or startingupdate |
|
131 //still allow user to continue |
|
132 if ( ( fotamodelstate != RFotaEngineSession::EDownloadComplete ) && ( fotamodelstate != RFotaEngineSession::EStartingUpdate ) ) |
|
133 { |
|
134 //if download is suspended, try to resume it. |
|
135 if ( fotamodelstate == RFotaEngineSession::EDownloadProgressing) |
|
136 { |
|
137 TInt result = iFotaModel->TryResumeFwUpdDownload(); |
|
138 FLOG_NUM( "[IAUPDATEFW] TryResumeFwUpdDownload result = %d", result ); |
|
139 } |
|
140 //anyway, DM is in use |
|
141 isDmActive = ETrue; |
|
142 } |
|
143 } |
|
144 |
|
145 if ( isDmActive ) |
136 { |
146 { |
137 case ENSU: |
147 FLOG( "[IAUPDATEFW] CIAUpdateFWUpdateHandler::RunL DM is activated" ); |
138 { |
148 return; |
139 |
149 } |
140 break; |
150 |
141 } |
151 TInt profileId( KErrNotFound ); |
142 case EFOTA: |
|
143 { |
|
144 //check whether FOTA engine is available at the moment |
|
145 TBool isDmActive = EFalse; |
|
146 |
|
147 TInt fotamodelstate = iFotaModel->GetCurrentFwUpdState(); |
|
148 |
|
149 FLOG_NUM( "[IAUPDATEFW] fota status = %d", fotamodelstate ); |
|
150 |
|
151 if ( fotamodelstate != RFotaEngineSession::EIdle ) |
|
152 { |
|
153 //if status is downloadcomplete or startingupdate |
|
154 //still allow user to continue |
|
155 if ( ( fotamodelstate != RFotaEngineSession::EDownloadComplete ) && ( fotamodelstate != RFotaEngineSession::EStartingUpdate ) ) |
|
156 { |
|
157 //if download is suspended, try to resume it. |
|
158 if ( fotamodelstate == RFotaEngineSession::EDownloadProgressing) |
|
159 { |
|
160 TInt result = iFotaModel->TryResumeFwUpdDownload(); |
|
161 FLOG_NUM( "[IAUPDATEFW] TryResumeFwUpdDownload result = %d", result ); |
|
162 } |
|
163 //anyway, DM is in use |
|
164 isDmActive = ETrue; |
|
165 } |
|
166 } |
|
167 |
|
168 if ( isDmActive ) |
|
169 { |
|
170 FLOG( "[IAUPDATEFW] CIAUpdateFWUpdateHandler::RunL DM is activated" ); |
|
171 return; |
|
172 } |
|
173 |
|
174 TInt profileId( KErrNotFound ); |
|
175 |
152 |
176 profileId = iFotaModel->DefaultFotaProfileIdL(); |
153 profileId = iFotaModel->DefaultFotaProfileIdL(); |
177 |
154 |
178 if (KErrNotFound != profileId) |
155 if (KErrNotFound != profileId) |
179 { |
156 { |
180 // Define the key KNSmlCurrentFotaUpdateAppName |
157 // Define the key KNSmlCurrentFotaUpdateAppName |
181 TInt err = RProperty::Define( KPSUidNSmlDMSyncApp, |
158 TInt err = RProperty::Define( KPSUidNSmlDMSyncApp, |
182 KNSmlCurrentFotaUpdateAppName, |
159 KNSmlCurrentFotaUpdateAppName, |
183 RProperty::EInt); |
160 RProperty::EInt); |
184 |
161 |
185 RProperty::Set(KPSUidNSmlDMSyncApp,KNSmlCurrentFotaUpdateAppName,1 ); |
162 RProperty::Set(KPSUidNSmlDMSyncApp,KNSmlCurrentFotaUpdateAppName,1 ); |
186 |
163 |
187 iFotaModel->EnableFwUpdRequestL( profileId ); |
164 iFotaModel->EnableFwUpdRequestL( profileId ); |
188 StartSyncL( profileId, EFalse ); |
165 StartSyncL( profileId, EFalse ); |
189 } |
166 } |
190 else |
167 else |
191 { |
168 { |
192 FLOG( "[IAUPDATEFW] CIAUpdateFWUpdateHandler::RunL no DM profile available!" ); |
169 FLOG( "[IAUPDATEFW] CIAUpdateFWUpdateHandler::RunL no DM profile available!" ); |
193 } |
170 } |
194 } |
171 } |
195 break; |
|
196 } |
|
197 } |
|
198 |
|
199 |
172 |
200 // ----------------------------------------------------------------------------- |
173 // ----------------------------------------------------------------------------- |
201 // CIAUpdateFWUpdateHandler::DoCancel() |
174 // CIAUpdateFWUpdateHandler::DoCancel() |
202 // ----------------------------------------------------------------------------- |
175 // ----------------------------------------------------------------------------- |
203 // |
176 // |
204 void CIAUpdateFWUpdateHandler::DoCancel() |
177 void CIAUpdateFWUpdateHandler::DoCancel() |
205 { |
178 { |
206 } |
179 } |
207 |
180 |
208 |
181 |
209 // ----------------------------------------------------------------------------- |
|
210 // CIAUpdateFWUpdateHandler::ShowDialogL() |
|
211 // ----------------------------------------------------------------------------- |
|
212 // |
|
213 void CIAUpdateFWUpdateHandler::ShowDialogL(TDesC& /*aText*/, TDesC& /*aHeading*/ ) |
|
214 { |
|
215 |
|
216 } |
|
217 |
|
218 |
182 |
219 // ----------------------------------------------------------------------------- |
183 // ----------------------------------------------------------------------------- |
220 // CIAUpdateFWUpdateHandler::StartSyncL() |
184 // CIAUpdateFWUpdateHandler::StartSyncL() |
221 // ----------------------------------------------------------------------------- |
185 // ----------------------------------------------------------------------------- |
222 // |
186 // |
223 void CIAUpdateFWUpdateHandler::StartSyncL( |
187 void CIAUpdateFWUpdateHandler::StartSyncL( |
224 const TInt aProfileId, // = KErrNotFound |
188 const TInt aProfileId, // = KErrNotFound |
225 const TBool aUseFotaProgressNote ) // = EFalse |
189 const TBool aUseFotaProgressNote ) // = EFalse |
226 { |
190 { |
227 CIAUpdateFWSyncProfile* profile = |
191 CIAUpdateFWSyncProfile* profile = |
228 iDMEngine->OpenProfileL( aProfileId, ESmlOpenReadWrite ); |
192 iFWSyncAppEngine->OpenProfileL( aProfileId, ESmlOpenReadWrite ); |
229 |
193 |
230 TInt connectionBearer = profile->BearerType(); |
194 TInt connectionBearer = profile->BearerType(); |
231 |
195 |
232 TBuf<KMaxProfileNameLength> serverName; |
196 TBuf<KMaxProfileNameLength> serverName; |
233 profile->GetName( serverName ); |
197 profile->GetName( serverName ); |