|
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_BTSyncPacketsData.h" |
|
19 #include "T_BTUtil.h" |
|
20 |
|
21 /*@{*/ |
|
22 // Parameter |
|
23 _LIT(KTBTSyncPacket, "tbtsyncpacket"); |
|
24 |
|
25 //Commands |
|
26 _LIT(KCmdTBTSyncPackets, "TBTSyncPackets"); |
|
27 |
|
28 // Logging |
|
29 _LIT(KLogMissingParameter, "Missing parameter '%S'"); |
|
30 /*@}*/ |
|
31 |
|
32 |
|
33 ////////////////////////////////////////////////////////////////////// |
|
34 // Construction/Destruction |
|
35 ////////////////////////////////////////////////////////////////////// |
|
36 |
|
37 CT_BTSyncPacketsData* CT_BTSyncPacketsData::NewL() |
|
38 { |
|
39 CT_BTSyncPacketsData* ret=new (ELeave) CT_BTSyncPacketsData(); |
|
40 CleanupStack::PushL(ret); |
|
41 ret->ConstructL(); |
|
42 CleanupStack::Pop(ret); |
|
43 return ret; |
|
44 } |
|
45 |
|
46 CT_BTSyncPacketsData::CT_BTSyncPacketsData() |
|
47 : iData(NULL) |
|
48 { |
|
49 } |
|
50 |
|
51 void CT_BTSyncPacketsData::ConstructL() |
|
52 { |
|
53 } |
|
54 |
|
55 CT_BTSyncPacketsData::~CT_BTSyncPacketsData() |
|
56 { |
|
57 DestroyData(); |
|
58 } |
|
59 |
|
60 // Service methods |
|
61 TAny* CT_BTSyncPacketsData::GetObject() |
|
62 { |
|
63 return iData; |
|
64 } |
|
65 |
|
66 void CT_BTSyncPacketsData::SetObjectL(TAny* aAny) |
|
67 { |
|
68 DestroyData(); |
|
69 iData = static_cast<TBTSyncPackets*> (aAny); |
|
70 } |
|
71 |
|
72 void CT_BTSyncPacketsData::DisownObjectL() |
|
73 { |
|
74 iData = NULL; |
|
75 } |
|
76 |
|
77 void CT_BTSyncPacketsData::DestroyData() |
|
78 { |
|
79 delete iData; |
|
80 iData=NULL; |
|
81 } |
|
82 |
|
83 inline TCleanupOperation CT_BTSyncPacketsData::CleanupOperation() |
|
84 { |
|
85 return CleanupOperation; |
|
86 } |
|
87 |
|
88 void CT_BTSyncPacketsData::CleanupOperation(TAny* aAny) |
|
89 { |
|
90 //may be unnecessary |
|
91 TBTSyncPackets* arg=static_cast<TBTSyncPackets*>(aAny); |
|
92 delete arg; |
|
93 } |
|
94 |
|
95 TBool CT_BTSyncPacketsData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/) |
|
96 { |
|
97 TBool ret = ETrue; |
|
98 |
|
99 if ( aCommand==KCmdTBTSyncPackets ) |
|
100 { |
|
101 DoCmdTBTSyncPackets(aSection); |
|
102 } |
|
103 else |
|
104 { |
|
105 ret=EFalse; |
|
106 } |
|
107 |
|
108 return ret; |
|
109 } |
|
110 |
|
111 |
|
112 /** |
|
113 Test TBTSyncPackets() |
|
114 */ |
|
115 void CT_BTSyncPacketsData::DoCmdTBTSyncPackets(const TDesC& aSection) |
|
116 { |
|
117 DestroyData(); |
|
118 |
|
119 TBTSyncPackets::TSyncPackets syncPacket; |
|
120 if ( CT_BTUtil::ReadTBTSyncPackets(*this, syncPacket, aSection, KTBTSyncPacket()) ) |
|
121 { |
|
122 INFO_PRINTF1(_L("TBTSyncPackets Constructor Call")); |
|
123 iData = new (ELeave) TBTSyncPackets(syncPacket); |
|
124 } |
|
125 else |
|
126 { |
|
127 ERR_PRINTF2(KLogMissingParameter, &KTBTSyncPacket()); |
|
128 SetBlockResult(EFail); |
|
129 } |
|
130 |
|
131 if (iData == NULL) |
|
132 { |
|
133 ERR_PRINTF1(_L("TBTSyncPackets is NULL")); |
|
134 SetBlockResult(EFail); |
|
135 } |
|
136 } |