|
1 /* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
2 * All rights reserved. |
|
3 * This component and the accompanying materials are made available |
|
4 * under the terms of "Eclipse Public License v1.0" |
|
5 * which accompanies this distribution, and is available |
|
6 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 * Initial Contributors: |
|
8 * Nokia Corporation - initial contribution. |
|
9 * |
|
10 * Contributors: |
|
11 * Description : |
|
12 * |
|
13 */ |
|
14 |
|
15 #include "ussdreadmessageimpl.h" |
|
16 |
|
17 #include "cusdcommandhandler.h" |
|
18 #include "debug.h" |
|
19 |
|
20 CUSSDReadMessageImpl* CUSSDReadMessageImpl::NewL(MUSSDCallback* aCallback, RMobileUssdMessaging& aUssdSession) |
|
21 { |
|
22 TRACE_FUNC_ENTRY |
|
23 CUSSDReadMessageImpl* self = new(ELeave) CUSSDReadMessageImpl(aCallback, aUssdSession); |
|
24 TRACE_FUNC_EXIT |
|
25 return self; |
|
26 } |
|
27 |
|
28 CUSSDReadMessageImpl::CUSSDReadMessageImpl(MUSSDCallback* aCallback, |
|
29 RMobileUssdMessaging& aUssdSession): |
|
30 CActive(CActive::EPriorityStandard), |
|
31 iCallback(aCallback), |
|
32 iUssdSession(aUssdSession) |
|
33 { |
|
34 TRACE_FUNC_ENTRY |
|
35 CActiveScheduler::Add(this); |
|
36 TRACE_FUNC_EXIT |
|
37 } |
|
38 |
|
39 CUSSDReadMessageImpl::~CUSSDReadMessageImpl() |
|
40 { |
|
41 TRACE_FUNC_ENTRY |
|
42 Cancel(); |
|
43 TRACE_FUNC_EXIT |
|
44 } |
|
45 |
|
46 void CUSSDReadMessageImpl::RunL() |
|
47 { |
|
48 TRACE_FUNC_ENTRY |
|
49 iCallback->HandleReadMessageComplete(iStatus.Int()); |
|
50 TRACE_FUNC_EXIT |
|
51 } |
|
52 |
|
53 void CUSSDReadMessageImpl::DoCancel() |
|
54 { |
|
55 TRACE_FUNC_ENTRY |
|
56 iUssdSession.CancelAsyncRequest(EMobileUssdMessagingReceiveMessage); |
|
57 TRACE_FUNC_EXIT |
|
58 } |
|
59 |
|
60 TInt CUSSDReadMessageImpl::ReadUSSDMessage(TDes8& aReceivedData, |
|
61 RMobileUssdMessaging::TMobileUssdAttributesV1& aUssdReadAttribute) |
|
62 { |
|
63 TRACE_FUNC_ENTRY |
|
64 |
|
65 TInt retCode = KErrNone; |
|
66 if(!IsActive()) |
|
67 { |
|
68 TPckg<RMobileUssdMessaging::TMobileUssdAttributesV1> msgAttributes(aUssdReadAttribute); |
|
69 iUssdSession.ReceiveMessage(iStatus, aReceivedData, msgAttributes); |
|
70 SetActive(); |
|
71 } |
|
72 else |
|
73 { |
|
74 retCode = KErrInUse; |
|
75 } |
|
76 |
|
77 TRACE_FUNC_EXIT |
|
78 return retCode; |
|
79 } |