|
1 /* |
|
2 * Copyright (c) 2002 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: Phone interface class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <e32base.h> |
|
22 #include <mmtsy_names.h> |
|
23 #include "CWPPhone.h" |
|
24 #include "WPEngineDebug.h" |
|
25 |
|
26 // CONSTANTS |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS =============================== |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // CWPPhone::CWPPhone |
|
32 // C++ default constructor can NOT contain any code, that |
|
33 // might leave. |
|
34 // ----------------------------------------------------------------------------- |
|
35 // |
|
36 CWPPhone::CWPPhone() |
|
37 { |
|
38 } |
|
39 |
|
40 // ----------------------------------------------------------------------------- |
|
41 // CWPPhone::ConstructL |
|
42 // Symbian 2nd phase constructor can leave. |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 void CWPPhone::ConstructL() |
|
46 { |
|
47 RTelServer server; |
|
48 User::LeaveIfError( server.Connect() ); |
|
49 CleanupClosePushL( server ); |
|
50 |
|
51 RMobilePhone phone; |
|
52 User::LeaveIfError( server.LoadPhoneModule( KMmTsyModuleName ) ); |
|
53 User::LeaveIfError( phone.Open( server, KMmTsyPhoneName ) ); |
|
54 CleanupClosePushL( phone ); |
|
55 User::LeaveIfError( phone.Initialise() ); |
|
56 |
|
57 TRequestStatus status; |
|
58 phone.GetSubscriberId( status, iIMSI ); |
|
59 User::WaitForRequest( status ); |
|
60 |
|
61 if(status!=KErrNone) |
|
62 { |
|
63 |
|
64 CleanupStack::PopAndDestroy( 2 ); // phone, server |
|
65 User::LeaveIfError( status.Int() ); |
|
66 } |
|
67 |
|
68 DVA( "CWPPhone::ConstructL(): IMSI: %S", &iIMSI ); |
|
69 |
|
70 status = KErrNone; |
|
71 RMobilePhone::TMobilePhoneNetworkInfoV1 info; |
|
72 RMobilePhone::TMobilePhoneNetworkInfoV1Pckg infoPckg( info ); |
|
73 phone.GetHomeNetwork( status, infoPckg ); |
|
74 User::WaitForRequest( status ); |
|
75 iCountry = info.iCountryCode; |
|
76 iNetwork = info.iNetworkId; |
|
77 DVA( "CWPPhone::ConstructL(): Country: %S", &iCountry ); |
|
78 DVA( "CWPPhone::ConstructL(): Network: %S", &iNetwork ); |
|
79 |
|
80 CleanupStack::PopAndDestroy( 2 ); // phone, server |
|
81 } |
|
82 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // CWPPhone::NewL |
|
85 // Two-phased constructor. |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 CWPPhone* CWPPhone::NewL() |
|
89 { |
|
90 DEBUG( "CWPPhone::NewL()" ); |
|
91 CWPPhone* self = NewLC(); |
|
92 CleanupStack::Pop(); |
|
93 return self; |
|
94 } |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // CWPPhone::NewLC |
|
98 // Two-phased constructor. |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 CWPPhone* CWPPhone::NewLC() |
|
102 { |
|
103 DEBUG( "CWPPhone::NewLC()" ); |
|
104 CWPPhone* self = new(ELeave) CWPPhone; |
|
105 CleanupStack::PushL(self); |
|
106 self->ConstructL(); |
|
107 return self; |
|
108 } |
|
109 |
|
110 // Destructor |
|
111 CWPPhone::~CWPPhone() |
|
112 { |
|
113 } |
|
114 |
|
115 // ----------------------------------------------------------------------------- |
|
116 // CWPPhone::SubscriberId |
|
117 // ----------------------------------------------------------------------------- |
|
118 // |
|
119 const RMobilePhone::TMobilePhoneSubscriberId& CWPPhone::SubscriberId() const |
|
120 { |
|
121 return iIMSI; |
|
122 } |
|
123 |
|
124 // ----------------------------------------------------------------------------- |
|
125 // CWPPhone::Country |
|
126 // ----------------------------------------------------------------------------- |
|
127 // |
|
128 const RMobilePhone::TMobilePhoneNetworkCountryCode& CWPPhone::Country() const |
|
129 { |
|
130 return iCountry; |
|
131 } |
|
132 |
|
133 // ----------------------------------------------------------------------------- |
|
134 // CWPPhone::Network |
|
135 // ----------------------------------------------------------------------------- |
|
136 // |
|
137 const RMobilePhone::TMobilePhoneNetworkIdentity& CWPPhone::Network() const |
|
138 { |
|
139 return iNetwork; |
|
140 } |
|
141 |
|
142 // End of File |