|
1 // |
|
2 // testltsysmswrite.cpp |
|
3 // |
|
4 // Copyright (c) Symbian Software Ltd. Your copyright notice. All rights reserved. |
|
5 // |
|
6 |
|
7 //user include |
|
8 #include "testltsysmswrite.h" |
|
9 #include "testltsysmsatutil.h" |
|
10 |
|
11 //constant defination |
|
12 _LIT8(KSmsMessagingData,"11000D91683156211075f6000800064F60597D0021"); |
|
13 _LIT(KSmsSCA,"8613800100500"); |
|
14 |
|
15 CTestLtsySmsWrite::CTestLtsySmsWrite(CTestLtsyModel& aTestModel) |
|
16 : CTestLtsySmsBase(aTestModel) |
|
17 { |
|
18 |
|
19 } |
|
20 |
|
21 CTestLtsySmsWrite::~CTestLtsySmsWrite() |
|
22 { |
|
23 } |
|
24 |
|
25 CTestLtsySmsWrite* CTestLtsySmsWrite::NewLC(CTestLtsyModel& aTestModel) |
|
26 { |
|
27 CTestLtsySmsWrite* self = new (ELeave)CTestLtsySmsWrite(aTestModel); |
|
28 CleanupStack::PushL(self); |
|
29 self->ConstructL(); |
|
30 return self; |
|
31 } |
|
32 |
|
33 CTestLtsySmsWrite* CTestLtsySmsWrite::NewL(CTestLtsyModel& aTestModel) |
|
34 { |
|
35 CTestLtsySmsWrite* self=CTestLtsySmsWrite::NewLC(aTestModel); |
|
36 CleanupStack::Pop(self); |
|
37 return self; |
|
38 } |
|
39 |
|
40 void CTestLtsySmsWrite::ConstructL() |
|
41 { |
|
42 |
|
43 } |
|
44 |
|
45 TVerdict CTestLtsySmsWrite::doTestStepPreambleL() |
|
46 { |
|
47 INFO_PRINTF1(_L("CTestLtsySmsWrite::doTestStepPreambleL called")); |
|
48 SetTestStepResult(EPass); |
|
49 return TestStepResult(); |
|
50 } |
|
51 |
|
52 TVerdict CTestLtsySmsWrite::doTestStepL() |
|
53 { |
|
54 INFO_PRINTF1(_L("CTestLtsySmsWrite::doTestStepL called")); |
|
55 TRAPD(err,WriteSmsL()); |
|
56 if(err != KErrNone) |
|
57 { |
|
58 INFO_PRINTF2(_L("The error was returned %d!! when write message"),err); |
|
59 SetTestStepResult(EFail); |
|
60 } |
|
61 return TestStepResult(); |
|
62 } |
|
63 |
|
64 TVerdict CTestLtsySmsWrite::doTestStepPostambleL() |
|
65 { |
|
66 INFO_PRINTF1(_L("CTestLtsySmsWrite::doTestStepPostambleL called")); |
|
67 return TestStepResult(); |
|
68 } |
|
69 |
|
70 void CTestLtsySmsWrite::WriteSmsL() |
|
71 { |
|
72 |
|
73 RMobilePhone::TMobileAddress smsWriteAddr; |
|
74 smsWriteAddr.iTypeOfNumber = RMobilePhone::EInternationalNumber; |
|
75 smsWriteAddr.iNumberPlan = RMobilePhone::EIsdnNumberPlan; |
|
76 smsWriteAddr.iTelNumber = KSmsSCA; |
|
77 //For GsmTpdu |
|
78 TBuf8<400> writePduAscii(KSmsMessagingData); |
|
79 TBuf8<400> writePduData; |
|
80 writePduData.Zero(); |
|
81 SmsAtUtil::ConvertAsciiToBinary(writePduAscii,writePduData); |
|
82 FillWriteSmsAttibutesL(writePduData,smsWriteAddr); |
|
83 } |
|
84 |
|
85 void CTestLtsySmsWrite::FillWriteSmsAttibutesL(TBuf8<400> aTpdu,RMobilePhone::TMobileAddress aMsgSca) |
|
86 { |
|
87 TRequestStatus status; |
|
88 RMobileSmsStore::TMobileGsmSmsEntryV1 smsEntry; |
|
89 RMobileSmsStore::TMobileGsmSmsEntryV1Pckg smsEntryPckg(smsEntry); |
|
90 smsEntry.iMsgStatus=RMobileSmsStore::EStoredMessageUnsent; |
|
91 smsEntry.iMsgData = aTpdu; |
|
92 smsEntry.iServiceCentre = aMsgSca; |
|
93 SmsStore().Write(status, smsEntryPckg); |
|
94 User::WaitForRequest(status); |
|
95 TInt r = status.Int(); |
|
96 INFO_PRINTF2(_L("Write() request status = %d"),r); |
|
97 } |
|
98 |
|
99 //End of file |