|
1 // Copyright (c) 1999-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 #include "smstestbase.h" |
|
17 |
|
18 class CSmcmRecvActive; |
|
19 class CSmcmRecvOnly : public CSmsTestBase |
|
20 /** |
|
21 * Manual test harness for receiving SMS messages |
|
22 * @note Also enables the user to also send messages to themselves. Defaults.script must have the correct telephone number |
|
23 */ |
|
24 { |
|
25 public: |
|
26 static CSmcmRecvOnly* NewLC(CSmsTestUtils& aSmsTest, const TDesC& aScriptFile, TInt& aNextTest); |
|
27 ~CSmcmRecvOnly(); |
|
28 |
|
29 private: |
|
30 CSmcmRecvOnly(CSmsTestUtils& aSmsTest, const TDesC& aScriptFile, TInt& aNextTest); |
|
31 |
|
32 void ConstructL(); |
|
33 |
|
34 void RunL(); |
|
35 TInt RunError(TInt aError); |
|
36 void DoCancel(); |
|
37 void Complete(TInt aStatus); |
|
38 |
|
39 void ShowMenuL(); |
|
40 void MessageSubMenuL(); |
|
41 |
|
42 void TestSendingL() {}; |
|
43 void TestSchedulingL() {}; |
|
44 |
|
45 void RunAutoL(); |
|
46 void DoRunMainMenuL(TKeyCode aCode); |
|
47 void DoRunSendingMenuL(TKeyCode aCode); |
|
48 void DoRunSendingL(); |
|
49 void DisplayAndRead(const TDesC& aText); |
|
50 void Read(); |
|
51 void ReshowMenu(); |
|
52 |
|
53 void SendShortMessageL(); |
|
54 void SendLongMessageL(); |
|
55 void SendReplaceTypeL(); |
|
56 void SendMessageIndicationL(TUint8 aMessageType = TSmsUtilities::EVoiceMessageWaiting, TUint8 aMessageCount=1); |
|
57 void SendFromScriptL(); |
|
58 void ScheduleSendL(); //< Sends all messages in iSelection |
|
59 void StoreMessageL(TMsvId aId, const CSmsHeader& aHeader); |
|
60 TMsvId CreateMessageLC(const TDesC& aBody); |
|
61 |
|
62 private: |
|
63 |
|
64 enum TSmcmRecvOnlyState |
|
65 /** |
|
66 * |
|
67 */ |
|
68 { |
|
69 EMainMenu, //< Main menu currently displayed |
|
70 ESendingMenu, //< Sending menu currently displayed |
|
71 ESending //< Sending SMS messages |
|
72 } iState; |
|
73 |
|
74 CSmcmRecvActive* iRecvActive; //< Active object that waits to receive SMS messages then displays them |
|
75 CTestUtilsWatcherStarter* iWatchers; //< Start and stop the watchers |
|
76 HBufC* iRecipient; //< Default recipient read from defaults.script |
|
77 HBufC* iServiceCenter; //< Default service center read from defaults.script |
|
78 TInt iReplaceTypeCount; //< Number of replace type messages sent |
|
79 }; |
|
80 |
|
81 class CSmcmRecvActive : public CActive, MMsvSessionObserver |
|
82 /** |
|
83 * Active object that waits to receive SMS messages then displays them |
|
84 */ |
|
85 { |
|
86 public: |
|
87 |
|
88 static CSmcmRecvActive* NewL(CSmsTestUtils& aSmsTest, TInt aPriority); |
|
89 ~CSmcmRecvActive(); |
|
90 void SentL(const CMsvEntrySelection& aSelection); |
|
91 TInt UnMatched() const {return iSent->Count() - iMatched->Count();} |
|
92 TInt Sent() const {return iSent->Count() + iMatched->Count();} |
|
93 TInt Received() const {return iReceived->Count() + iMatched->Count();} |
|
94 void DisplayUnmatched() const; |
|
95 |
|
96 private: |
|
97 |
|
98 CSmcmRecvActive(CSmsTestUtils& aSmsTest, TInt aPriority); |
|
99 void ConstructL(); |
|
100 void RunL(); |
|
101 void DoCancel(); |
|
102 TInt RunError(TInt aError); |
|
103 void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3); |
|
104 void PrintMessageL(TMsvId aId); |
|
105 void ProcessReceivedL(); |
|
106 TBool IsMatchL(CMsvEntry& aLeft, CMsvEntry& aRight); |
|
107 TInt Find(const CMsvEntrySelection& aSelection, TMsvId aId) const; |
|
108 HBufC* GetBodyTextLC(CMsvEntry& aMessage); |
|
109 CSmsHeader* GetHeaderLC(CMsvEntry& aMessage) const; |
|
110 |
|
111 private: |
|
112 |
|
113 CSmsTestUtils& iSmsTest; |
|
114 RTimer iTimer; //< Timer used before displaying received messages |
|
115 CMsvEntrySelection* iSelection; //< Received messaged awaiting processing |
|
116 CMsvEntrySelection* iSent; //< All sent messages |
|
117 CMsvEntrySelection* iReceived; //< Received messages not matched with sent messages |
|
118 CMsvEntrySelection* iMatched; //< Received messages matched with sent messages |
|
119 }; |