|
1 /* |
|
2 * Copyright (c) 2002-2005 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: Implementation of CPSetSubscriberIdCheck class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "PSetSubscriberIdCheck.h" |
|
21 |
|
22 _LIT( KRogersImsi, "30272" ); |
|
23 const TInt KMinImsiLength = 5; |
|
24 |
|
25 // ============================ MEMBER FUNCTIONS =============================== |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 // First phase constructor |
|
29 // --------------------------------------------------------------------------- |
|
30 // |
|
31 CPSetSubscriberIdCheck* CPSetSubscriberIdCheck::NewL( ) |
|
32 { |
|
33 CPSetSubscriberIdCheck* self = new ( ELeave ) CPSetSubscriberIdCheck( ); |
|
34 return self; |
|
35 } |
|
36 |
|
37 // ----------------------------------------------------------------------------- |
|
38 // C++ constructor can NOT contain any code, that |
|
39 // might leave. |
|
40 // ----------------------------------------------------------------------------- |
|
41 // |
|
42 CPSetSubscriberIdCheck::CPSetSubscriberIdCheck() |
|
43 { |
|
44 } |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // Destructor. |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 CPSetSubscriberIdCheck::~CPSetSubscriberIdCheck() |
|
51 { |
|
52 } |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // Check if used SIM support dual activation. |
|
56 // --------------------------------------------------------------------------- |
|
57 // |
|
58 TBool CPSetSubscriberIdCheck::DoesSIMSupportDualActivation() |
|
59 { |
|
60 TBool result = EFalse; |
|
61 TInt error = KErrNone; |
|
62 |
|
63 if( iImsi.Length() == 0 ) |
|
64 { |
|
65 RTelServer rTelServer; |
|
66 RTelServer::TPhoneInfo info; |
|
67 RMobilePhone rMobilePhone; |
|
68 TRequestStatus tRequestStatus; |
|
69 |
|
70 error = rTelServer.Connect(); |
|
71 if( error == KErrNone ) |
|
72 { |
|
73 error = rTelServer.GetPhoneInfo( 0, info ); |
|
74 if( error == KErrNone ) |
|
75 { |
|
76 error = rMobilePhone.Open( rTelServer, info.iName ); |
|
77 if( error == KErrNone ) |
|
78 { |
|
79 rMobilePhone.GetSubscriberId( tRequestStatus, iImsi ); |
|
80 User::WaitForRequest( tRequestStatus ); |
|
81 error = tRequestStatus.Int(); |
|
82 rMobilePhone.Close(); |
|
83 } |
|
84 } |
|
85 rTelServer.Close(); |
|
86 } |
|
87 } |
|
88 |
|
89 if(( iImsi.Length() >= KMinImsiLength ) && ( error == KErrNone )) |
|
90 { |
|
91 if( iImsi.Left( KMinImsiLength ).Compare( KRogersImsi ) == 0 ) |
|
92 { |
|
93 result = ETrue; |
|
94 } |
|
95 } |
|
96 |
|
97 return result; |
|
98 } |
|
99 |
|
100 // End of File |