|
1 /* |
|
2 * Copyright (c) 2003 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: This module contains Implementation of the class CCbsMcnListener member |
|
15 * functions. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 |
|
22 #include "CCbsMcnListener.h" |
|
23 #include "RCbsMcnSession.h" |
|
24 #include "CMcn.h" |
|
25 #include "CbsLogger.h" |
|
26 |
|
27 // CONSTANTS |
|
28 |
|
29 const TInt KMcnListenerPriority = CActive::EPriorityStandard; |
|
30 |
|
31 // ================= MEMBER FUNCTIONS ======================= |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // CCbsMcnListener::CCbsMcnListener |
|
35 // C++ default constructor can NOT contain any code, that |
|
36 // might leave. |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 CCbsMcnListener::CCbsMcnListener( |
|
40 CMcn& aMcn, |
|
41 RCbsMcnSession& aSession ) |
|
42 : CActive( KMcnListenerPriority ), |
|
43 iMcn( aMcn ), |
|
44 iSession( aSession ), |
|
45 iMcnPckg( iMcnMessage ) |
|
46 { |
|
47 } |
|
48 |
|
49 // ----------------------------------------------------------------------------- |
|
50 // CCbsMcnListener::ConstructL |
|
51 // Symbian 2nd phase constructor can leave. |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 void CCbsMcnListener::ConstructL() |
|
55 { |
|
56 CBSLOGSTRING("CBSMCNCLIENT: >>> CCbsMcnListener::ConstructL()"); |
|
57 |
|
58 CActiveScheduler::Add( this ); |
|
59 Receive(); |
|
60 |
|
61 CBSLOGSTRING("CBSMCNCLIENT: <<< CCbsMcnListener::ConstructL()"); |
|
62 } |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // CCbsMcnListener::NewL |
|
66 // Two-phased constructor. |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 CCbsMcnListener* CCbsMcnListener::NewL( |
|
70 CMcn& aMcn, |
|
71 RCbsMcnSession& aSession ) |
|
72 { |
|
73 CCbsMcnListener* self = new ( ELeave ) CCbsMcnListener( aMcn, aSession ); |
|
74 CleanupStack::PushL( self ); |
|
75 self->ConstructL(); |
|
76 CleanupStack::Pop(); |
|
77 return self; |
|
78 } |
|
79 |
|
80 |
|
81 // Destructor |
|
82 CCbsMcnListener::~CCbsMcnListener() |
|
83 { |
|
84 Cancel(); |
|
85 } |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CCbsMcnListener::RunL |
|
88 // This method is called when an Mcn message is received. |
|
89 // (other items were commented in a header). |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 void CCbsMcnListener::RunL() |
|
93 { |
|
94 CBSLOGSTRING2("CBSMCNCLIENT: >>> CCbsMcnListener::RunL(): iStatus: %d", iStatus.Int() ); |
|
95 CBSLOGSTRING2("CBSMCNCLIENT: CCbsMcnListener::RunL(): Msg topic number: %d", iMcnMessage.iTopicNumber ); |
|
96 CBSLOGSTRING2("CBSMCNCLIENT: CCbsMcnListener::RunL(): Msg network mode: %d", iMcnMessage.iNetworkMode ); |
|
97 |
|
98 // MCN message and parameters received from the network |
|
99 // and stored into iMcnMessage |
|
100 iMcn.RelayMessage( iMcnMessage ); |
|
101 if ( iStatus.Int() != KErrServerTerminated && iStatus.Int() != KErrCancel ) |
|
102 { |
|
103 Receive(); |
|
104 } |
|
105 |
|
106 CBSLOGSTRING("CBSMCNCLIENT: <<< CCbsMcnListener::RunL()"); |
|
107 } |
|
108 |
|
109 // ----------------------------------------------------------------------------- |
|
110 // CCbsMcnListener::DoCancel |
|
111 // Cancels the outstanding Mcn request. |
|
112 // (other items were commented in a header). |
|
113 // ----------------------------------------------------------------------------- |
|
114 // |
|
115 void CCbsMcnListener::DoCancel() |
|
116 { |
|
117 iSession.ReadMcnMessageCancel(); |
|
118 } |
|
119 |
|
120 // ----------------------------------------------------------------------------- |
|
121 // CCbsMcnListener::Receive |
|
122 // Receive an Mcn message from network. |
|
123 // (other items were commented in a header). |
|
124 // ----------------------------------------------------------------------------- |
|
125 // |
|
126 void CCbsMcnListener::Receive() |
|
127 { |
|
128 CBSLOGSTRING("CBSMCNCLIENT: >>> CCbsMcnListener::Receive()"); |
|
129 |
|
130 iSession.ReadMcnMessage( iStatus, iMcnPckg ); |
|
131 |
|
132 SetActive(); |
|
133 CBSLOGSTRING("CBSMCNCLIENT: <<< CCbsMcnListener::Receive()"); |
|
134 } |
|
135 |
|
136 // End of File |