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 |
//
|
|
15 |
|
|
16 |
/**
|
|
17 |
@file
|
|
18 |
@internalAll
|
|
19 |
*/
|
|
20 |
|
|
21 |
|
|
22 |
#ifndef __SIMSMSMESS_H_
|
|
23 |
#define __SIMSMSMESS_H_
|
|
24 |
|
|
25 |
#include <etelmm.h>
|
|
26 |
#include <et_phone.h>
|
|
27 |
|
|
28 |
#include "CSimPhone.h"
|
|
29 |
#include "csimtimer.h"
|
|
30 |
|
|
31 |
#include "CSimSmsStore.h"
|
|
32 |
#include "utils.h"
|
|
33 |
|
|
34 |
const TUint KMaxSmsPduLength=168;
|
|
35 |
typedef TBuf8<KMaxSmsPduLength> TSmsPdu;
|
|
36 |
|
|
37 |
const TUint KMaxSmsScaLength=100;
|
|
38 |
typedef TBuf8<KMaxSmsScaLength> TSmsSca;
|
|
39 |
|
|
40 |
const TUint KMaxSmsDestinationLength=50;
|
|
41 |
typedef TBuf8<KMaxSmsDestinationLength> TSmsDestination;
|
|
42 |
|
|
43 |
const TUint KMaxSmsExpectedErrorLength=10;
|
|
44 |
typedef TBuf8<KMaxSmsExpectedErrorLength> TSmsExpectedError;
|
|
45 |
|
|
46 |
|
|
47 |
struct TSmsTxParametersGsm
|
|
48 |
{
|
|
49 |
TInt iFlags;
|
|
50 |
RMobileSmsMessaging::TMobileSmsGsmTpdu iPdu;
|
|
51 |
TSmsSca iSca;
|
|
52 |
TInt iRef;
|
|
53 |
RMobileSmsMessaging::TMobileSmsGsmTpdu iSubmitReport;
|
|
54 |
TInt iExpectedError;
|
|
55 |
};
|
|
56 |
|
|
57 |
|
|
58 |
struct TSmsRxParametersGsm
|
|
59 |
{
|
|
60 |
RMobileSmsMessaging::TMobileSmsGsmTpdu iPdu;
|
|
61 |
RMobileSmsMessaging::TMobileSmsGsmTpdu iDeliveryReport;
|
|
62 |
TSmsSca iSca;
|
|
63 |
};
|
|
64 |
|
|
65 |
|
|
66 |
struct TConstraintEntry
|
|
67 |
{
|
|
68 |
TInt iIpcCnt; // <The Number of times an IPC(now only sendMessage suported)before incoming messages are simulated
|
|
69 |
TInt iRxCnt; // <The number of times sms messages are going to be simulated
|
|
70 |
};
|
|
71 |
|
|
72 |
|
|
73 |
class CSimSmsStore;
|
|
74 |
class CSimPhone;
|
|
75 |
class CSimSmsMessaging : public CSubSessionExtBase, public MTimerCallBack
|
|
76 |
{
|
|
77 |
friend class CSimSmsStore;
|
|
78 |
|
|
79 |
public:
|
|
80 |
static CSimSmsMessaging* NewL(CSimPhone* aPhone);
|
|
81 |
CSimSmsMessaging(CSimPhone* aPhone);
|
|
82 |
~CSimSmsMessaging();
|
|
83 |
|
|
84 |
static void CloseSmsObj(TAny* aObj);
|
|
85 |
const CTestConfigSection* CfgFileSection();
|
|
86 |
|
|
87 |
virtual CTelObject::TReqMode ReqModeL(const TInt aIpc);
|
|
88 |
// MTelObjectTSY pure virtual
|
|
89 |
virtual TInt RegisterNotification(const TInt aIpc);
|
|
90 |
virtual TInt DeregisterNotification(const TInt aIpc);
|
|
91 |
virtual void Init();
|
|
92 |
virtual CTelObject* OpenNewObjectByNameL(const TDesC& aName);
|
|
93 |
virtual CTelObject* OpenNewObjectL(TDes& aNewName);
|
|
94 |
virtual TInt NumberOfSlotsL(const TInt aIpc);
|
|
95 |
virtual TInt CancelService(const TInt aIpc,const TTsyReqHandle aTsyReqHandle);
|
|
96 |
|
|
97 |
// MSubSessionExtBaseTSY pure virtual
|
|
98 |
virtual TInt ExtFunc(const TTsyReqHandle aTsyReqHandle,const TInt aIpc,const TDataPackage& aPackage);
|
|
99 |
|
|
100 |
void ReloadConfigurationSettingsL();
|
|
101 |
|
|
102 |
protected:
|
|
103 |
void ConstructL();
|
|
104 |
|
|
105 |
private:
|
|
106 |
enum TSmsRxEvent
|
|
107 |
{
|
|
108 |
ESmsEventPostedRxReq,
|
|
109 |
ESmsEventRxTimer,
|
|
110 |
ESmsEventRxAckNack,
|
|
111 |
ESmsEventResume
|
|
112 |
};
|
|
113 |
|
|
114 |
enum TSmsRxState
|
|
115 |
{
|
|
116 |
ESmsRxStateIdle,
|
|
117 |
ESmsRxStateWaitingForSmsRx,
|
|
118 |
ESmsRxStateWaitingForNetworkAckNackResponse,
|
|
119 |
ESmsRxStateWaitingForAckNack,
|
|
120 |
ESmsRxStateSuspend,
|
|
121 |
ESmsRxStateWaitingForNetworkResumeResponse,
|
|
122 |
ESmsRxStateWaitingToStart
|
|
123 |
} iRxState;
|
|
124 |
|
|
125 |
enum TSmsTxEvent
|
|
126 |
{
|
|
127 |
ESmsEventSendReq,
|
|
128 |
ESmsEventSubmitReportReceived
|
|
129 |
};
|
|
130 |
|
|
131 |
enum TSmsTxState
|
|
132 |
{
|
|
133 |
ESmsTxStateIdle,
|
|
134 |
ESmsTxStateWaitingForSubmitReport
|
|
135 |
} iTxState;
|
|
136 |
|
|
137 |
TInt HandleExtFunc(const TTsyReqHandle aTsyReqHandle,const TInt aIpc,const TDataPackage& aPackage);
|
|
138 |
|
|
139 |
void FindAndCreateSmsStoresL(CSimPhone* aPhone);
|
|
140 |
void FindAndCreateRxAttributesL();
|
|
141 |
void FindAndCreateTxAttributesL();
|
|
142 |
void FindAndCreateConstraints();
|
|
143 |
void FindAndCreateSmsParamsL();
|
|
144 |
|
|
145 |
TInt ReceiveMessageL(const TTsyReqHandle aTsyReqHandle,TDes8* aSmsPdu,TDes8* aSmsAttrib);
|
|
146 |
void ReceiveMessageCancel();
|
|
147 |
void SendMessageCancel();
|
|
148 |
TInt GetCaps(const TTsyReqHandle aReqHandle,TDes8* aPckg1);
|
|
149 |
TInt EnumerateMessagingStores(TTsyReqHandle aReqHandle,TDes8* aPckg);
|
|
150 |
TInt GetMessageStoreInfo(TTsyReqHandle aReqHandle,TDes8* aPckg1, TDes8* aPckg2);
|
|
151 |
TInt GetReceiveMode(const TTsyReqHandle aReqHandle,TDes8* aPckg);
|
|
152 |
TInt SetReceiveMode(const TTsyReqHandle aReqHandle,TDes8* aPckg);
|
|
153 |
TInt AckSmsStored(const TTsyReqHandle aReqHandle,TDes8* aMsg,TDes8* aFullFlag);
|
|
154 |
TInt NackSmsStored(const TTsyReqHandle aReqHandle,TDes8* aMsg,TDes8* aRpCausePckg);
|
|
155 |
void AckNackCancel();
|
|
156 |
TInt ResumeSmsReception(const TTsyReqHandle aReqHandle);
|
|
157 |
void ResumeSmsReceptionCancel();
|
|
158 |
TInt SendMessageL(const TTsyReqHandle aTsyReqHandle,TDes8* aPckg1, TDes8* aPckg2);
|
|
159 |
TInt GetSmspListPhase1(const TTsyReqHandle aTsyReqHandle,
|
|
160 |
TDes8* aParam1,TDes8* aParam2);
|
|
161 |
void GetSmspListPhase1L(TTsyReqHandle aTsyReqHandle,RMobilePhone::TClientId& aClientId,TInt& aBufSize);
|
|
162 |
TInt GetSmspListPhase2(const TTsyReqHandle aTsyReqHandle,
|
|
163 |
TDes8* aParam1,TDes8* aParam2);
|
|
164 |
void GetSmspListCancel();
|
|
165 |
TInt StoreSmspList(const TTsyReqHandle aTsyReqHandle,TDes8* aPckg);
|
|
166 |
void StoreSmspListCancel();
|
|
167 |
void CompletePendingReq();
|
|
168 |
void CompleteTxPendingReq(TInt aError);
|
|
169 |
TInt AttemptSmsRxComplete();
|
|
170 |
void StartSmsMtTimer();
|
|
171 |
void TimerCallBack(TInt aId);
|
|
172 |
void PopulateSmsRxAttrib(const TDesC8& aAsciiScaAddr,RMobileSmsMessaging::TMobileSmsReceiveAttributesV1* aAttrib);
|
|
173 |
|
|
174 |
void PopulateSmsTxAttrib(RMobileSmsMessaging::TMobileSmsSendAttributesV1* aAttrib);
|
|
175 |
|
|
176 |
void PopulateSmsTxAttrib(RMobileSmsMessaging::TMobileSmsAttributesV1* aAttrib);
|
|
177 |
|
|
178 |
void RecordSca(const TDesC8& aAsciiScaAddr, RMobileSmsMessaging::TMobileSmspEntryV1& aEntry);
|
|
179 |
void RecordDestination(const TDesC8& aAsciiScaAddr, RMobileSmsMessaging::TMobileSmspEntryV1& aEntry);
|
|
180 |
void PopulateSmspListFromConfigFile();
|
|
181 |
TBool IpcMatch();
|
|
182 |
TInt ActionRxEventUnstoredClientAck(TSmsRxEvent aRxEvent);
|
|
183 |
TInt ActionRxEventUnstoredPhoneAck(TSmsRxEvent aRxEvent);
|
|
184 |
TInt ActionRxEventStored(TSmsRxEvent aRxEvent);
|
|
185 |
TInt ActionTxEvent(TSmsTxEvent aTxEvent);
|
|
186 |
|
|
187 |
TBool CanStartRxEvent() const;
|
|
188 |
TBool ConstraintEllapsed() const;
|
|
189 |
|
|
190 |
void LogRequest(const TBool aEntering, TInt aIpc, TInt aError);
|
|
191 |
|
|
192 |
#ifdef _DEBUG
|
|
193 |
void LogTMobileSmsAttributesV1(const RMobileSmsMessaging::TMobileSmsAttributesV1& aSmsAttributesV1);
|
|
194 |
void AppendTonToBuffer(TDes8& aBuffer, const RMobilePhone::TMobileTON& aTon);
|
|
195 |
void AppendNpiToBuffer(TDes8& aBuffer, const RMobilePhone::TMobileNPI& aNpi);
|
|
196 |
#endif
|
|
197 |
|
|
198 |
HBufC8* PduToAscii(TDesC8& aSmsPdu);
|
|
199 |
void DumpPdu(const TDesC8& aText, TDesC8& aSmsPdu, HBufC8* aPduInAscii = 0);
|
|
200 |
|
|
201 |
void Reset();
|
|
202 |
void InitializeL();
|
|
203 |
|
|
204 |
private:
|
|
205 |
|
|
206 |
CSimTimer* iRxTimer;
|
|
207 |
CSimTimer* iTxTimer;
|
|
208 |
CSimTimer* iSmspTimer;
|
|
209 |
TTsyReqHandle iSmsRxReqHandle;
|
|
210 |
TTsyReqHandle iSmsTxReqHandle;
|
|
211 |
TTsyReqHandle iSmspReqHandle;
|
|
212 |
TTsyReqHandle iPendingReqHandle; // < Request handle for pending Ack, Nack or Resume Completion.
|
|
213 |
|
|
214 |
CSimPhone* iPhone;
|
|
215 |
CArrayFixFlat<CSimSmsStore*>* iSmsStores;
|
|
216 |
|
|
217 |
CArrayFixFlat<TSmsRxParametersGsm>* iSmsRxParameterListGsm; // < Contains the values associated with the SmsRx tag for GSM
|
|
218 |
|
|
219 |
TInt iSmsRxPeriod; // < The period between simulating received SMS messages.
|
|
220 |
TInt iAckNackCompletePause; // < The pause before Ack/Nack requests are completed.
|
|
221 |
TInt iResumeCompletePause; // < The pause before Resume requests are completed.
|
|
222 |
TBool iSmsStoreFull; // < Flag to indicate that last Ack/NAck received stated that the store was full.
|
|
223 |
TInt iSmsRxCnt; // < Count of the number of SMS messages received.
|
|
224 |
TBool iSmsRxReqOutstanding; // < Flags if ReceiveMessage has been posted by the client
|
|
225 |
TDes8* iSmsRxPdu;
|
|
226 |
RMobileSmsMessaging::TMobileSmsReceiveAttributesV1* iSmsRxAttrib; // <Attributes to be return to the client On ReceiveMessage completion
|
|
227 |
|
|
228 |
CArrayFixFlat<TSmsTxParametersGsm>* iSmsTxParametersListGsm; // < Contains the values associated with the Smstx tag
|
|
229 |
|
|
230 |
RMobileSmsMessaging::TMobileSmsSendAttributesV1* iSmsTxAttrib; // <Attributes to be return to the client On SendMessage completion
|
|
231 |
|
|
232 |
TInt iSmsTxCnt; // < Count the number times RSmsMessaging::SendMessage. completes
|
|
233 |
TInt iSmsTxPause; // < The period between the layer 3 send request and the submit report reception
|
|
234 |
RMobileSmsMessaging::TMobileSmsControlCaps iSmsControlCaps; // < The control capabilities of messaging(TMobileSmsControlCaps)
|
|
235 |
|
|
236 |
RMobileSmsMessaging::TMobileSmsReceiveMode iSmsReceiveMode; // < The control capabilities of messaging(TMobileSmsControlCaps)
|
|
237 |
|
|
238 |
//constraint
|
|
239 |
TInt iCurrentConstraint; // < The index in the iConstraints Array currently in use
|
|
240 |
TInt iConstraintRxCnt; // < The number of SmsMessages received under 1 constraint
|
|
241 |
RArray<TConstraintEntry> iConstraints; // < An array of constraints
|
|
242 |
|
|
243 |
//smsp
|
|
244 |
CArrayPtrFlat<CListReadAllAttempt>* iSmspReadAll; // < A list of the oustanding two phase batch read requests.
|
|
245 |
CMobilePhoneSmspList* iSmspEntries; // < A pointer to the SMSpList array.
|
|
246 |
TInt iSmspBatchPause; // < The pause value used to delay the completion of a batch SMS Store manipulation request.
|
|
247 |
TBool iSmspBusy; // < Used as a semaphore to avoid store/get at the same time.
|
|
248 |
|
|
249 |
RMobileSmsMessaging::TMobileSmsModeCaps iSmsModeCaps; // < The mode capabilities of messaging(TMobileSmsControlCaps)
|
|
250 |
TInt iSmsRxStartDelay;
|
|
251 |
TBool iSmsReceiveModeSet;
|
|
252 |
TUint8 iLastTxMsgId[2];
|
|
253 |
};
|
|
254 |
|
|
255 |
#endif // __SIMSMSMESS_H_
|