38 _LIT8(KCmd, "Send"); |
38 _LIT8(KCmd, "Send"); |
39 _LIT8(KTo, "To"); |
39 _LIT8(KTo, "To"); |
40 _LIT8(KBodyText, "BodyText"); |
40 _LIT8(KBodyText, "BodyText"); |
41 _LIT8(KAttachmentname, "Attachment"); |
41 _LIT8(KAttachmentname, "Attachment"); |
42 _LIT8(KMimeType, "MimeType"); |
42 _LIT8(KMimeType, "MimeType"); |
43 _LIT8(KMessageParam, "Messageparam"); |
43 _LIT8(KMessageParam, "MessageParam"); |
|
44 _LIT8(KType, "MessageType"); |
44 _LIT8(KErrCode,"ErrorCode"); |
45 _LIT8(KErrCode,"ErrorCode"); |
45 |
46 |
46 // Positive test case with Type, Number and BodyText |
47 // Positive test case with Type, Number and BodyText |
47 int sendmessage_test1(int, char**) |
48 int sendmessage_test1(int, char**) |
48 { |
49 { |
926 |
927 |
927 return err; |
928 return err; |
928 |
929 |
929 } |
930 } |
930 |
931 |
|
932 int sendmessage_test11(int, char**) |
|
933 { |
|
934 __UHEAP_MARK; |
|
935 |
|
936 CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
937 CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
938 CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
939 |
|
940 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
941 |
|
942 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
943 |
|
944 RCriteriaArray a; |
|
945 a.AppendL(crit); |
|
946 |
|
947 iServiceHandler->AttachL(a); |
|
948 |
|
949 iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
950 |
|
951 TInt pos = 0; |
|
952 MLiwInterface* interface = NULL; |
|
953 _LIT8(KDataSource, "IMessaging"); |
|
954 outParamList->FindFirst(pos,KDataSource ); |
|
955 if(pos != KErrNotFound) |
|
956 { |
|
957 interface = (*outParamList)[pos].Value().AsInterface(); |
|
958 } |
|
959 |
|
960 inParamList->Reset(); |
|
961 outParamList->Reset(); |
|
962 delete crit; |
|
963 crit = NULL; |
|
964 a.Reset(); |
|
965 |
|
966 TInt32 tmplateId = GetTemplateId( interface, inParamList, outParamList, EFalse ); |
|
967 |
|
968 inParamList->AppendL(TLiwGenericParam( KType, TLiwVariant( _L("SMS") ))); |
|
969 inParamList->AppendL(TLiwGenericParam( KTo, TLiwVariant( _L("9008032761") ))); |
|
970 inParamList->AppendL(TLiwGenericParam( KBodyText, TLiwVariant( _L("SMS with MMS template ID ") ))); |
|
971 |
|
972 |
|
973 if(tmplateId > 0) |
|
974 { |
|
975 CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
976 CleanupStack::PushL(map); |
|
977 |
|
978 TLiwVariant liwmessageid(tmplateId); |
|
979 map->InsertL(_L8("TemplateId"),liwmessageid); |
|
980 liwmessageid.Reset(); |
|
981 |
|
982 CLiwDefaultList* reclist = CLiwDefaultList::NewL(); |
|
983 CleanupStack::PushL(reclist); |
|
984 reclist->AppendL(TLiwVariant(_L("9008032762"))); |
|
985 |
|
986 TLiwVariant recps(reclist); |
|
987 map->InsertL(_L8("To"),recps); |
|
988 recps.Reset(); |
|
989 reclist->DecRef(); |
|
990 CleanupStack::Pop(reclist); |
|
991 |
|
992 inParamList->AppendL(TLiwGenericParam( KMessageParam, TLiwVariant( map )));// Null mimetype |
|
993 map->DecRef(); |
|
994 CleanupStack::Pop(map); |
|
995 } |
|
996 |
|
997 TRAPD(err,interface->ExecuteCmdL( KCmd, *inParamList ,*outParamList,0,NULL )); |
|
998 |
|
999 if(err == KErrNone) |
|
1000 { |
|
1001 TInt index = 0; |
|
1002 const TLiwGenericParam* err1 = outParamList->FindFirst(index,KErrCode); |
|
1003 err = err1->Value().AsTInt32(); |
|
1004 } |
|
1005 |
|
1006 |
|
1007 inParamList->Reset(); |
|
1008 outParamList->Reset(); |
|
1009 |
|
1010 interface->Close(); |
|
1011 iServiceHandler->Reset(); |
|
1012 delete iServiceHandler; |
|
1013 |
|
1014 __UHEAP_MARKEND; |
|
1015 if(tmplateId) |
|
1016 { |
|
1017 if( err==1004 ) |
|
1018 return KErrNone; |
|
1019 else |
|
1020 return KErrGeneral; |
|
1021 } |
|
1022 else |
|
1023 return err; |
|
1024 |
|
1025 } |
|
1026 |
931 TInt32 GetTemplateId(MLiwInterface *aObj ,CLiwGenericParamList* aInputlist, CLiwGenericParamList* aOutputlist, TBool aSMS ) |
1027 TInt32 GetTemplateId(MLiwInterface *aObj ,CLiwGenericParamList* aInputlist, CLiwGenericParamList* aOutputlist, TBool aSMS ) |
932 { |
1028 { |
933 _LIT8(KCmd,"GetList"); |
1029 _LIT8(KCmd,"GetList"); |
934 aInputlist->Reset(); |
1030 aInputlist->Reset(); |
935 aOutputlist->Reset(); |
1031 aOutputlist->Reset(); |