44
|
1 |
// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// This contains CATCommandControlBase which is composite class of a number classes
|
|
15 |
//
|
|
16 |
|
|
17 |
#include "mslogger.h"
|
|
18 |
#include "atcommandbase.h"
|
|
19 |
#include "atcommandcontrolbase.h"
|
|
20 |
|
|
21 |
|
|
22 |
CATCommandControlBase::CATCommandControlBase(CGlobalPhonemanager& aGloblePhone,
|
|
23 |
CCtsyDispatcherCallback& aCtsyDispatcherCallback)
|
|
24 |
:CRequestBase(aGloblePhone),
|
|
25 |
iCtsyDispatcherCallback(aCtsyDispatcherCallback)
|
|
26 |
{
|
|
27 |
// LOGTEXT(_L8("[Ltsy] Starting CATCommandControlBase::CATCommandControlBase()"));
|
|
28 |
iIsDel = EAutoDelete;
|
|
29 |
}
|
|
30 |
|
|
31 |
CATCommandControlBase::~CATCommandControlBase()
|
|
32 |
{
|
|
33 |
// LOGTEXT(_L8("[Ltsy] Starting CATCommandControlBase::~CATCommandControlBase()"));
|
|
34 |
if (EAutoDelete == iIsDel)
|
|
35 |
{
|
|
36 |
CleanAndDeleteAllAtCommands();
|
|
37 |
}
|
|
38 |
|
|
39 |
iArray.Close();
|
|
40 |
}
|
|
41 |
|
|
42 |
TInt CATCommandControlBase::AddAtCommand(const CAtCommandBase* aAtCommand)
|
|
43 |
{
|
|
44 |
// LOGTEXT(_L8("[Ltsy] Starting CATCommandControlBase::AddAtCommand()"));
|
|
45 |
if (NULL == aAtCommand)
|
|
46 |
{
|
|
47 |
return KErrArgument;
|
|
48 |
}
|
|
49 |
|
|
50 |
TInt nRes = iArray.Append(aAtCommand);
|
|
51 |
return nRes;
|
|
52 |
}
|
|
53 |
|
|
54 |
void CATCommandControlBase::RemoveAtCommand(const CAtCommandBase* aAtCommand)
|
|
55 |
{
|
|
56 |
if (NULL != aAtCommand)
|
|
57 |
{
|
|
58 |
TInt nFind = iArray.Find(aAtCommand);
|
|
59 |
if (nFind != KErrNotFound)
|
|
60 |
{
|
|
61 |
iArray.Remove(nFind);
|
|
62 |
iArray.Compress();
|
|
63 |
}
|
|
64 |
}
|
|
65 |
}
|
|
66 |
|
|
67 |
void CATCommandControlBase::RemoveAtCommandByAtType(TLtsyATCommandType aType)
|
|
68 |
{
|
|
69 |
TBool bFlag(ETrue);
|
|
70 |
|
|
71 |
for (TInt n = 0; bFlag && n < iArray.Count(); n++)
|
|
72 |
{
|
|
73 |
if (iArray[n]->AtType() == aType)
|
|
74 |
{
|
|
75 |
iArray.Remove(n);
|
|
76 |
iArray.Compress();
|
|
77 |
bFlag = EFalse;
|
|
78 |
}
|
|
79 |
}
|
|
80 |
}
|
|
81 |
|
|
82 |
CAtCommandBase& CATCommandControlBase::GetAtCommandByAtTypeL(TLtsyATCommandType aType)
|
|
83 |
{
|
|
84 |
TBool bFlag(ETrue);
|
|
85 |
CAtCommandBase *cAtBase(NULL);
|
|
86 |
|
|
87 |
for (TInt n = 0; bFlag && n < iArray.Count(); n++)
|
|
88 |
{
|
|
89 |
if (iArray[n]->AtType() == aType)
|
|
90 |
{
|
|
91 |
cAtBase = iArray[n];
|
|
92 |
}
|
|
93 |
}
|
|
94 |
|
|
95 |
User::LeaveIfNull(cAtBase);
|
|
96 |
|
|
97 |
return (*cAtBase);
|
|
98 |
}
|
|
99 |
|
|
100 |
|
|
101 |
void CATCommandControlBase::SetIsAutoDelete(TAutoDeleteAtCommand aIsDel)
|
|
102 |
{
|
|
103 |
iIsDel = aIsDel;
|
|
104 |
}
|
|
105 |
|
|
106 |
CATCommandControlBase::TAutoDeleteAtCommand CATCommandControlBase::GetIsAutoDelete()
|
|
107 |
{
|
|
108 |
return iIsDel;
|
|
109 |
}
|
|
110 |
|
|
111 |
void CATCommandControlBase::CleanAllAtCommands()
|
|
112 |
{
|
|
113 |
iArray.Reset();
|
|
114 |
}
|
|
115 |
|
|
116 |
void CATCommandControlBase::CleanAndDeleteAllAtCommands()
|
|
117 |
{
|
|
118 |
iArray.ResetAndDestroy();
|
|
119 |
}
|
|
120 |
// End of file
|
|
121 |
|
|
122 |
|
|
123 |
|
|
124 |
|
|
125 |
|
|
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|
|
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
|
134 |
|
|
135 |
|
|
136 |
|