|
1 /* |
|
2 * Copyright (c) 2005-2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "T_BTSyncBandWidthData.h" |
|
19 |
|
20 /*@{*/ |
|
21 //Parameters |
|
22 _LIT(KBandWidth, "bandwidth"); |
|
23 |
|
24 //Commands |
|
25 _LIT(KCmdTBTSyncBandwidth, "TBTSyncBandwidth"); |
|
26 /*@}*/ |
|
27 |
|
28 ////////////////////////////////////////////////////////////////////// |
|
29 // Construction/Destruction |
|
30 ////////////////////////////////////////////////////////////////////// |
|
31 |
|
32 CT_BTSyncBandwidthData* CT_BTSyncBandwidthData::NewL() |
|
33 { |
|
34 CT_BTSyncBandwidthData* ret=new (ELeave) CT_BTSyncBandwidthData(); |
|
35 CleanupStack::PushL(ret); |
|
36 ret->ConstructL(); |
|
37 CleanupStack::Pop(ret); |
|
38 return ret; |
|
39 } |
|
40 |
|
41 CT_BTSyncBandwidthData::CT_BTSyncBandwidthData() |
|
42 : iData(NULL) |
|
43 { |
|
44 } |
|
45 |
|
46 void CT_BTSyncBandwidthData::ConstructL() |
|
47 { |
|
48 } |
|
49 |
|
50 CT_BTSyncBandwidthData::~CT_BTSyncBandwidthData() |
|
51 { |
|
52 DestroyData(); |
|
53 } |
|
54 |
|
55 // Service methods |
|
56 TAny* CT_BTSyncBandwidthData::GetObject() |
|
57 { |
|
58 return iData; |
|
59 } |
|
60 |
|
61 void CT_BTSyncBandwidthData::SetObjectL(TAny* aAny) |
|
62 { |
|
63 //called when loading up persistent data |
|
64 DestroyData(); |
|
65 iData = static_cast<TBTSyncBandwidth*> (aAny); |
|
66 } |
|
67 |
|
68 void CT_BTSyncBandwidthData::DisownObjectL() |
|
69 { |
|
70 iData = NULL; |
|
71 } |
|
72 |
|
73 void CT_BTSyncBandwidthData::DestroyData() |
|
74 { |
|
75 delete iData; |
|
76 iData=NULL; |
|
77 } |
|
78 |
|
79 inline TCleanupOperation CT_BTSyncBandwidthData::CleanupOperation() |
|
80 { |
|
81 return CleanupOperation; |
|
82 } |
|
83 |
|
84 void CT_BTSyncBandwidthData::CleanupOperation(TAny* aAny) |
|
85 { |
|
86 //may be unnecessary |
|
87 TBTSyncBandwidth* arg=static_cast<TBTSyncBandwidth*>(aAny); |
|
88 delete arg; |
|
89 } |
|
90 |
|
91 TBool CT_BTSyncBandwidthData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/) |
|
92 { |
|
93 TBool ret = ETrue; |
|
94 |
|
95 if ( aCommand==KCmdTBTSyncBandwidth ) |
|
96 { |
|
97 DoCmdTBTSyncBandwidth(aSection); |
|
98 } |
|
99 else |
|
100 { |
|
101 ret=EFalse; |
|
102 } |
|
103 |
|
104 return ret; |
|
105 } |
|
106 |
|
107 |
|
108 /** |
|
109 Test TBTSyncBandwidth() |
|
110 */ |
|
111 void CT_BTSyncBandwidthData::DoCmdTBTSyncBandwidth(const TDesC& aSection) |
|
112 { |
|
113 DestroyData(); |
|
114 |
|
115 TInt bandWidth=0; |
|
116 if( !GetIntFromConfig(aSection, KBandWidth(), bandWidth) ) |
|
117 { |
|
118 INFO_PRINTF1(_L("TBTSyncBandwidth Constructor Call")); |
|
119 iData = new (ELeave) TBTSyncBandwidth(); |
|
120 } |
|
121 else |
|
122 { |
|
123 INFO_PRINTF1(_L("TBTSyncBandwidth Constructor Call")); |
|
124 iData = new (ELeave) TBTSyncBandwidth((TUint) bandWidth); |
|
125 } |
|
126 |
|
127 if (iData == NULL) |
|
128 { |
|
129 ERR_PRINTF1(_L("TBTSyncBandwidth is NULL")); |
|
130 SetBlockResult(EFail); |
|
131 } |
|
132 } |