1 /* |
|
2 * Copyright (c) 2007 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: Model for GSPDataHSDPAPlugin. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "GSPDataHSDPAModel.h" |
|
21 #include "GsLogger.h" |
|
22 |
|
23 #include <featmgr.h> |
|
24 #include <commdb.h> |
|
25 #include <settingsinternalcrkeys.h> |
|
26 |
|
27 |
|
28 // CONSTANTS |
|
29 |
|
30 // ================= MEMBER FUNCTIONS ======================= |
|
31 |
|
32 |
|
33 // ---------------------------------------------------------------------------- |
|
34 // CGSPDataHSDPAModel::NewL |
|
35 // |
|
36 // EPOC two-phased constructor |
|
37 // ---------------------------------------------------------------------------- |
|
38 // |
|
39 CGSPDataHSDPAModel* CGSPDataHSDPAModel::NewL() |
|
40 { |
|
41 CGSPDataHSDPAModel* self = new( ELeave ) CGSPDataHSDPAModel; |
|
42 CleanupStack::PushL( self ); |
|
43 self->ConstructL(); |
|
44 CleanupStack::Pop( self ); |
|
45 return self; |
|
46 } |
|
47 |
|
48 |
|
49 // ---------------------------------------------------------------------------- |
|
50 // CGSPDataHSDPAModel::CGSPDataHSDPAModel |
|
51 // |
|
52 // C++ default constructor can NOT contain any code, that |
|
53 // might leave. |
|
54 // ---------------------------------------------------------------------------- |
|
55 // |
|
56 CGSPDataHSDPAModel::CGSPDataHSDPAModel() |
|
57 { |
|
58 __GSLOGSTRING( "[CGSPDataHSDPAModel] CGSPDataHSDPAModel()" ); |
|
59 } |
|
60 |
|
61 |
|
62 // ---------------------------------------------------------------------------- |
|
63 // CGSPDataHSDPAModel::ConstructL |
|
64 // |
|
65 // EPOC default constructor can leave. |
|
66 // ---------------------------------------------------------------------------- |
|
67 // |
|
68 void CGSPDataHSDPAModel::ConstructL() |
|
69 { |
|
70 if( FeatureManager::FeatureSupported( KFeatureIdLoggerGprs ) ) |
|
71 { |
|
72 User::LeaveIfError( iTelServer.Connect() ); |
|
73 User::LeaveIfError( iMobilePhone.Open( iTelServer, KMmTsyPhoneName ) ); |
|
74 User::LeaveIfError( iCustomAPI.Open( iMobilePhone ) ); |
|
75 } |
|
76 } |
|
77 |
|
78 |
|
79 // ---------------------------------------------------------------------------- |
|
80 // CGSPDataHSDPAModel::~CGSPDataHSDPAModel |
|
81 // |
|
82 // Destructor |
|
83 // ---------------------------------------------------------------------------- |
|
84 // |
|
85 CGSPDataHSDPAModel::~CGSPDataHSDPAModel() |
|
86 { |
|
87 if( FeatureManager::FeatureSupported( KFeatureIdLoggerGprs ) ) |
|
88 { |
|
89 iCustomAPI.Close(); |
|
90 iMobilePhone.Close(); |
|
91 iTelServer.Close(); |
|
92 } |
|
93 __GSLOGSTRING( "[CGSPDataConnectionModel] Handles closed." ); |
|
94 } |
|
95 |
|
96 // ---------------------------------------------------------------------------- |
|
97 // CGSPDataModel::CurrentHSDPAItemL |
|
98 // |
|
99 // Returns 0( Disabled ) /1 (Enabled) . |
|
100 // ---------------------------------------------------------------------------- |
|
101 // |
|
102 TInt CGSPDataHSDPAModel::CurrentHSDPAItemL() |
|
103 { |
|
104 TInt hsdpaValue = EFalse; |
|
105 TRequestStatus status; |
|
106 RMmCustomAPI::THSxPAStatus hSxPAStatus; |
|
107 iCustomAPI.ReadHSxPAStatus( status,hSxPAStatus ); |
|
108 User::WaitForRequest( status ); |
|
109 if ( hSxPAStatus == RMmCustomAPI::EHSxPADisabled ) |
|
110 { |
|
111 hsdpaValue = EFalse; // HSDPA Disable |
|
112 } |
|
113 else if ( hSxPAStatus == RMmCustomAPI::EHSxPAEnabled ) |
|
114 { |
|
115 hsdpaValue = ETrue; //HSDPA Enable |
|
116 } |
|
117 return hsdpaValue; |
|
118 } |
|
119 |
|
120 // ---------------------------------------------------------------------------- |
|
121 // CGSPDataModel::CurrentHSDPAItemL |
|
122 // |
|
123 // Set 0( Disabled ) /1 (Enabled) . |
|
124 // ---------------------------------------------------------------------------- |
|
125 // |
|
126 void CGSPDataHSDPAModel::SetHSDPAItemValueL( TInt aHsdpaValue ) |
|
127 { |
|
128 TRequestStatus status; |
|
129 RMmCustomAPI::THSxPAStatus hSxPAStatus; |
|
130 if ( aHsdpaValue == 0 ) |
|
131 { |
|
132 hSxPAStatus = RMmCustomAPI::EHSxPADisabled; |
|
133 } |
|
134 else |
|
135 { |
|
136 hSxPAStatus = RMmCustomAPI::EHSxPAEnabled; |
|
137 } |
|
138 iCustomAPI.WriteHSxPAStatus( status,hSxPAStatus ); |
|
139 User::WaitForRequest( status ); |
|
140 } |
|
141 |
|
142 // End of File |
|