24
|
1 |
// Copyright (c) 1997-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 |
// SIMPHONEFACTORY.CPP
|
|
15 |
// Phone Factory Class for the Simulator TSY
|
|
16 |
// This file contains the implementation for the CSimPhoneFactory Class.
|
|
17 |
//
|
|
18 |
//
|
|
19 |
|
|
20 |
/**
|
|
21 |
@file
|
|
22 |
*/
|
|
23 |
|
|
24 |
#include "CSimPhoneFactory.h"
|
|
25 |
#include "CSimPhone.h"
|
|
26 |
#include "../inc/utils.h"
|
|
27 |
|
|
28 |
extern "C"
|
|
29 |
/**
|
|
30 |
* This function must be exported as the first ordinal from the DLL.
|
|
31 |
* The ETel Server will call this function to create a phone factory class,
|
|
32 |
* from which ultimately all other classes are derived.
|
|
33 |
*/
|
|
34 |
{
|
|
35 |
IMPORT_C CPhoneFactoryBase* LibEntry(void);
|
|
36 |
}
|
|
37 |
|
|
38 |
EXPORT_C CPhoneFactoryBase* LibEntry()
|
|
39 |
/**
|
|
40 |
* Create a phone factory class.
|
|
41 |
*/
|
|
42 |
{
|
|
43 |
return new CSimPhoneFactory;
|
|
44 |
}
|
|
45 |
|
|
46 |
CSimPhoneFactory::CSimPhoneFactory()
|
|
47 |
/**
|
|
48 |
* Return the DLL version number.
|
|
49 |
*/
|
|
50 |
{
|
|
51 |
iVersion=TVersion(KEtelMajorVersionNumber,KEtelMinorVersionNumber,KEtelBuildVersionNumber);
|
|
52 |
}
|
|
53 |
|
|
54 |
CSimPhoneFactory::~CSimPhoneFactory()
|
|
55 |
{}
|
|
56 |
|
|
57 |
|
|
58 |
CPhoneBase* CSimPhoneFactory::NewPhoneL(const TDesC& aName)
|
|
59 |
/**
|
|
60 |
* Creates and returns a pointer to a new phone object.
|
|
61 |
*
|
|
62 |
* @param aName Name of the GSM phone ('GsmPhone')
|
|
63 |
* @return CPhoneBase pointer to the new CSimPhone object, if the phone name is valid
|
|
64 |
* NULL otherwise
|
|
65 |
* @leave Leave This function may leave for many reasons
|
|
66 |
*/
|
|
67 |
{
|
|
68 |
if (aName.CompareF(KPhoneName)!=0)
|
|
69 |
{
|
|
70 |
User::Leave(KErrNotFound);
|
|
71 |
}
|
|
72 |
CSimPhone* newPhone= CSimPhone::NewL(iPhoneBaseRef);
|
|
73 |
return newPhone;
|
|
74 |
}
|
|
75 |
|
|
76 |
TInt CSimPhoneFactory::EnumeratePhones()
|
|
77 |
/**
|
|
78 |
* Returns the number of phones supported by the TSY.
|
|
79 |
*
|
|
80 |
* @return TInt Number of phone supported. Only 1 phone is supported.
|
|
81 |
*/
|
|
82 |
{
|
|
83 |
return KNumberOfPhones;
|
|
84 |
}
|
|
85 |
|
|
86 |
TInt CSimPhoneFactory::GetPhoneInfo(const TInt aIndex, RTelServer::TPhoneInfo& aInfo)
|
|
87 |
/**
|
|
88 |
* Retrieves phone information
|
|
89 |
*
|
|
90 |
* @param aIndex There is only one phone, so the valid index is zero.
|
|
91 |
* @param aInfo Structure containing name of phone, number of lines and type of network
|
|
92 |
* @return TInt An error code.
|
|
93 |
*/
|
|
94 |
{
|
|
95 |
if(aIndex!=0)
|
|
96 |
return KErrNotFound;
|
|
97 |
aInfo.iName.Copy(KPhoneName);
|
|
98 |
aInfo.iNumberOfLines=KNumberOfLines;
|
|
99 |
aInfo.iNetworkType=RTelServer::ENetworkTypeMobileDigital;
|
|
100 |
aInfo.iExtensions=(TUint)0; // Note that the Multimode ETel API extension number should be inserted here.
|
|
101 |
return KErrNone;
|
|
102 |
}
|
|
103 |
|
|
104 |
TBool CSimPhoneFactory::IsSupported(const TInt aMixin)
|
|
105 |
/**
|
|
106 |
* Returns a boolean indicating the support of extended functionality.
|
|
107 |
*
|
|
108 |
* @param aMixin Limited subset of Muiltimode Etel API functionality
|
|
109 |
* @return ETrue aMixin functionality is supported
|
|
110 |
* EFalse aMixin functionality is not supported
|
|
111 |
*/
|
|
112 |
{
|
|
113 |
switch (aMixin)
|
|
114 |
{
|
|
115 |
case KETelExtMultimodeV1: // 3000 is unique reference for Multimode Etel v1.0 API
|
|
116 |
case KETelFuncMobileNetwork:
|
|
117 |
case KETelFuncMobilePower:
|
|
118 |
case KETelFuncMobileSignal:
|
|
119 |
case KETelFuncMobileIndicator:
|
|
120 |
case KETelFuncMobileDTMF:
|
|
121 |
case KETelFuncMobileDataCall:
|
|
122 |
case KETelFuncMobileEmergencyCall:
|
|
123 |
case KETelFuncMobileSmsMessaging:
|
|
124 |
case KETelFuncMobilePhonebook:
|
|
125 |
case KETelFuncMobileOwnNumberStore:
|
|
126 |
case KETelFuncMobileSmsStore:
|
|
127 |
// case KETelFuncMobileSmspStore:
|
|
128 |
case KETelExtPcktV1: //Packet API
|
|
129 |
case KETelExtSatV1:
|
|
130 |
//security is not supported by alll modules of the tsy
|
|
131 |
case RMobileCall::KETelMobileDataCallParamsV1:
|
|
132 |
case RMobileCall::KETel3rdPartyCallParamsV1:
|
|
133 |
return ETrue;
|
|
134 |
case KETelExtMultimodeV2:
|
|
135 |
case KETelExtPcktV2: //Packet API
|
|
136 |
case KETelExtSatV2:
|
|
137 |
case KEtelFuncMobileMultimediaCallSettings:
|
|
138 |
case KEtelFuncMobileNetworkSecurity:
|
|
139 |
case KEtelFuncMobileUSIMApplications:
|
|
140 |
return CheckSupportAgainstVersion(2);
|
|
141 |
case KETelExtMultimodeV3:
|
|
142 |
case KETelExtPcktV3: //Packet API
|
|
143 |
return CheckSupportAgainstVersion(3);
|
|
144 |
case KETelExtMultimodeV4:
|
|
145 |
return CheckSupportAgainstVersion(4);
|
|
146 |
case KEtelExtMultimodeV5:
|
|
147 |
return CheckSupportAgainstVersion(5);
|
|
148 |
case KEtelExtMultimodeV6:
|
|
149 |
return CheckSupportAgainstVersion(6);
|
|
150 |
case KEtelExtMultimodeV9:
|
|
151 |
case KEtelFuncCellInfo:
|
|
152 |
return CheckSupportAgainstVersion(9);
|
|
153 |
default:
|
|
154 |
return EFalse;
|
|
155 |
}
|
|
156 |
}
|
|
157 |
|
|
158 |
TBool CSimPhoneFactory::CheckSupportAgainstVersion(const TInt& aVersion)
|
|
159 |
{
|
|
160 |
TBool ret = EFalse;
|
|
161 |
|
|
162 |
if(iPhoneBaseRef == NULL)
|
|
163 |
{
|
|
164 |
ret = ETrue;
|
|
165 |
}
|
|
166 |
else
|
|
167 |
{
|
|
168 |
CSimPhone* thePhone = static_cast<CSimPhone*>(iPhoneBaseRef);
|
|
169 |
if(thePhone->iSimTsyVersion >= aVersion)
|
|
170 |
{
|
|
171 |
ret = ETrue;
|
|
172 |
}
|
|
173 |
else
|
|
174 |
{
|
|
175 |
ret = EFalse;
|
|
176 |
}
|
|
177 |
}
|
|
178 |
|
|
179 |
return ret;
|
|
180 |
}
|