239 if ( iReplyBuffer.Length() < partLength ) |
239 if ( iReplyBuffer.Length() < partLength ) |
240 { |
240 { |
241 TRACE_FUNC_EXIT |
241 TRACE_FUNC_EXIT |
242 return KErrNotFound; |
242 return KErrNotFound; |
243 } |
243 } |
244 aDstBuffer.Create( iReplyBuffer, partLength ); |
244 aDstBuffer.Close(); |
245 iReplyBuffer.Delete( 0, partLength ); |
245 TInt err = aDstBuffer.Create( iReplyBuffer, partLength ); |
|
246 if (!err) |
|
247 { |
|
248 iReplyBuffer.Delete( 0, partLength ); |
|
249 } |
246 if ( iReplyBuffer.Length() == 0 ) |
250 if ( iReplyBuffer.Length() == 0 ) |
247 { |
251 { |
248 iReplyBuffer.Close(); |
252 iReplyBuffer.Close(); |
249 } |
253 } |
250 TRACE_FUNC_EXIT |
254 TRACE_FUNC_EXIT |
251 return KErrNone; |
255 return err; |
252 } |
256 } |
253 |
257 |
254 // --------------------------------------------------------------------------- |
258 // --------------------------------------------------------------------------- |
255 // Creates an AT command reply based on the reply type and completes the |
259 // Creates an AT command reply based on the reply type and completes the |
256 // request to ATEXT. Uses iReplyBuffer for reply storage. |
260 // request to ATEXT. Uses iReplyBuffer for reply storage. |
257 // --------------------------------------------------------------------------- |
261 // --------------------------------------------------------------------------- |
258 // |
262 // |
259 TInt CLcCustomPlugin::CreateReplyAndComplete( TATExtensionReplyType aReplyType, |
263 void CLcCustomPlugin::CreateReplyAndComplete( TATExtensionReplyType aReplyType, |
260 const TDesC8& aSrcBuffer, |
264 const TDesC8& aSrcBuffer, |
261 TInt aError ) |
265 TInt aError ) |
262 { |
266 { |
263 TRACE_FUNC_ENTRY |
267 TRACE_FUNC_ENTRY |
264 iReplyBuffer.Close(); |
268 iReplyBuffer.Close(); |
265 if ( aError != KErrNone ) |
269 ASSERT(iHcReply); |
266 { |
270 if ( !aError ) |
267 HandleCommandCompleted( aError, EReplyTypeUndefined ); |
271 { |
268 iHcCmd = NULL; |
272 switch ( aReplyType ) |
269 iHcReply = NULL; |
273 { |
270 TRACE_FUNC_EXIT |
274 case EReplyTypeOther: |
271 return KErrNone; |
275 aError = iReplyBuffer.Create( aSrcBuffer ); |
272 } |
276 break; |
273 if ( !iHcReply ) |
277 case EReplyTypeOk: |
274 { |
278 aError = CreateOkOrErrorReply( iReplyBuffer, ETrue ); |
275 TRACE_FUNC_EXIT |
279 break; |
276 return KErrGeneral; |
280 case EReplyTypeError: |
277 } |
281 aError = CreateOkOrErrorReply( iReplyBuffer, EFalse ); |
278 switch ( aReplyType ) |
282 break; |
279 { |
283 default: |
280 case EReplyTypeOther: |
284 aError = KErrGeneral; |
281 iReplyBuffer.Create( aSrcBuffer ); |
285 } |
282 break; |
286 } |
283 case EReplyTypeOk: |
287 if ( !aError ) |
284 CreateOkOrErrorReply( iReplyBuffer, ETrue ); |
288 { |
285 break; |
289 aError = CreatePartOfReply( *iHcReply ); |
286 case EReplyTypeError: |
290 } |
287 CreateOkOrErrorReply( iReplyBuffer, EFalse ); |
291 |
288 break; |
|
289 default: |
|
290 TRACE_FUNC_EXIT |
|
291 return KErrGeneral; |
|
292 } |
|
293 CreatePartOfReply( *iHcReply ); |
|
294 HandleCommandCompleted( KErrNone, aReplyType ); |
|
295 iHcCmd = NULL; |
292 iHcCmd = NULL; |
296 iHcReply = NULL; |
293 iHcReply = NULL; |
297 TRACE_FUNC_EXIT |
294 |
298 return KErrNone; |
295 HandleCommandCompleted( aError, aError ? EReplyTypeUndefined : aReplyType ); |
|
296 TRACE_FUNC_EXIT |
299 } |
297 } |
300 |
298 |
301 // --------------------------------------------------------------------------- |
299 // --------------------------------------------------------------------------- |
302 // Creates a buffer for "OK" or "ERROR" reply based on the line settings |
300 // Creates a buffer for "OK" or "ERROR" reply based on the line settings |
303 // --------------------------------------------------------------------------- |
301 // --------------------------------------------------------------------------- |