753 |
778 |
754 return KErrGeneral ; |
779 return KErrGeneral ; |
755 } |
780 } |
756 |
781 |
757 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
782 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
758 TBuf8<20>CmdBuf(KCmdGetLocation) ; |
783 TBuf8<20>CmdBuf(KCmdGetLocation) ; |
759 |
784 |
760 CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; |
785 CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; |
761 |
786 |
762 //Append LocationInformation Category |
787 //Append LocationInformation Category |
763 TLiwGenericParam informationCategory(KLocationInfoCategory , TLiwVariant(KLocationBasicinfo)) ; |
788 TLiwGenericParam informationCategory(KLocationInfoCategory , TLiwVariant(KLocationBasicinfo)) ; |
764 InputList->AppendL(informationCategory) ; |
789 InputList->AppendL(informationCategory) ; |
765 |
790 |
766 //Appending update options |
791 //Appending update options |
767 CLiwMap* updateoptionMap = CLiwDefaultMap::NewL(); |
792 CLiwMap* updateoptionMap = CLiwDefaultMap::NewL(); |
768 |
793 |
769 TInt32 updateInterval = 30000; |
794 TInt32 updateInterval = 30000; |
770 |
795 |
771 updateoptionMap->InsertL(KUpdateOptionInterval,TLiwVariant(updateInterval)); |
796 updateoptionMap->InsertL(KUpdateOptionInterval,TLiwVariant(updateInterval)); |
772 |
797 |
773 TInt32 updateTimeOut = -10000; |
798 TInt32 updateTimeOut = -10000; |
774 updateoptionMap->InsertL(KUpdateOptionTimeOut,TLiwVariant(updateTimeOut)); |
799 updateoptionMap->InsertL(KUpdateOptionTimeOut,TLiwVariant(updateTimeOut)); |
775 |
800 |
776 TInt32 updateMaxAge = 2000; |
801 TInt32 updateMaxAge = 2000; |
777 updateoptionMap->InsertL(KUpdateOptionMaxAge,TLiwVariant(updateMaxAge)); |
802 updateoptionMap->InsertL(KUpdateOptionMaxAge,TLiwVariant(updateMaxAge)); |
778 |
803 |
779 TLiwGenericParam updateOption(KUpdateOptionMap,TLiwVariant(updateoptionMap)); |
804 TLiwGenericParam updateOption(KUpdateOptionMap,TLiwVariant(updateoptionMap)); |
780 InputList->AppendL(updateOption) ; |
805 InputList->AppendL(updateOption) ; |
781 updateoptionMap->DecRef(); |
806 updateoptionMap->DecRef(); |
782 |
807 |
783 CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; |
808 CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; |
784 |
809 |
785 |
810 |
786 |
811 |
787 |
812 |
788 locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList); |
813 locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList); |
789 |
814 |
790 |
815 |
791 pos = 0; |
816 pos = 0; |
792 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
817 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
793 |
818 |
794 if(!ErrorParm) |
819 if(!ErrorParm) |
795 { |
820 { |
796 |
821 |
797 return KErrGeneral ; |
822 return KErrGeneral ; |
798 } |
823 } |
799 TInt error = (ErrorParm->Value()).AsTInt32(); |
824 TInt error = (ErrorParm->Value()).AsTInt32(); |
800 if( SErrBadArgumentType == error ) |
825 if( SErrBadArgumentType == error ) |
801 { |
826 { |
802 error = KErrNone; |
827 error = KErrNone; |
803 |
828 |
804 |
829 |
805 } |
830 } |
806 locinterface->Close() ; |
831 locinterface->Close() ; |
807 delete ServiceHandler ; |
832 delete ServiceHandler ; |
808 delete OutParmList; |
833 delete OutParmList; |
809 delete InputList; |
834 delete InputList; |
810 a.ResetAndDestroy() ; |
835 a.ResetAndDestroy() ; |
811 a.Close() ; |
836 a.Close() ; |
812 __UHEAP_MARKEND ; |
837 __UHEAP_MARKEND ; |
813 return error; |
838 return error; |
814 |
839 |
815 |
840 |
816 |
841 |
817 |
842 |
818 } |
843 } |
819 TInt CTestProvider :: GetLocationWrongInfoClass( CStifItemParser& /*aItem*/ ) |
844 TInt CTestProvider :: GetLocationWrongInfoClass( CStifItemParser& /*aItem*/ ) |
820 { |
845 { |
821 __UHEAP_MARK ; |
846 __UHEAP_MARK ; |
822 |
847 |
823 |
848 |
824 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
849 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
825 |
850 |
826 // Input and output parameter list |
851 // Input and output parameter list |
827 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
852 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
828 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
853 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
829 |
854 |
830 |
855 |
831 |
856 |
832 |
857 |
833 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
858 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
834 |
859 |
835 |
860 |
836 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
861 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
837 |
862 |
838 RCriteriaArray a; |
863 RCriteriaArray a; |
839 a.AppendL(crit); |
864 a.AppendL(crit); |
840 |
865 |
841 ServiceHandler->AttachL(a) ; |
866 ServiceHandler->AttachL(a) ; |
842 |
867 |
843 |
868 |
844 |
869 |
845 |
870 |
846 |
871 |
847 |
872 |
848 |
873 |
849 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
874 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
850 |
875 |
851 |
876 |
852 |
877 |
853 |
878 |
854 TInt pos = 0; |
879 TInt pos = 0; |
855 |
880 |
856 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
881 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
857 |
882 |
858 if(!errorprm) |
883 if(!errorprm) |
859 { |
884 { |
860 |
885 |
861 return KErrGeneral ; |
886 return KErrGeneral ; |
862 } |
887 } |
863 |
888 |
864 |
889 |
865 _LIT8(KDataSource, "ILocation"); |
890 _LIT8(KDataSource, "ILocation"); |
866 |
891 |
867 pos = 0 ; |
892 pos = 0 ; |
868 |
893 |
869 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
894 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
870 |
895 |
871 if(!genericparm) |
896 if(!genericparm) |
872 { |
897 { |
873 |
898 |
874 return KErrGeneral ; |
899 return KErrGeneral ; |
875 } |
900 } |
876 |
901 |
877 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
902 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
878 |
903 |
879 |
904 |
880 |
905 |
881 TBuf8<20>CmdBuf(KCmdGetLocation) ; |
906 TBuf8<20>CmdBuf(KCmdGetLocation) ; |
882 |
907 |
883 outputlist->Reset() ; |
908 outputlist->Reset() ; |
884 inputlist->Reset() ; |
909 inputlist->Reset() ; |
885 _LIT8(KClass,"LocationInformationClass"); |
910 _LIT8(KClass,"LocationInformationClass"); |
886 _LIT(KClassArg,"Invalid"); |
911 _LIT(KClassArg,"Invalid"); |
887 inputlist->AppendL(TLiwGenericParam(KClass,TLiwVariant(KClassArg))); |
912 inputlist->AppendL(TLiwGenericParam(KClass,TLiwVariant(KClassArg))); |
888 |
913 |
889 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); |
914 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); |
890 |
915 |
891 pos = 0 ; |
916 pos = 0 ; |
892 |
917 |
893 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
918 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
894 |
919 |
895 if(!ErrorParm) |
920 if(!ErrorParm) |
896 { |
921 { |
897 |
922 |
898 return KErrGeneral ; |
923 return KErrGeneral ; |
899 } |
924 } |
900 TInt error = (ErrorParm->Value()).AsTInt32(); |
925 TInt error = (ErrorParm->Value()).AsTInt32(); |
901 if( SErrBadArgumentType == error ) |
926 if( SErrBadArgumentType == error ) |
902 { |
927 { |
903 error = KErrNone; |
928 error = KErrNone; |
904 |
929 |
905 |
930 |
906 } |
931 } |
907 locinterface->Close() ; |
932 locinterface->Close() ; |
908 delete ServiceHandler ; |
933 delete ServiceHandler ; |
909 a.ResetAndDestroy() ; |
934 a.ResetAndDestroy() ; |
910 a.Close() ; |
935 a.Close() ; |
911 __UHEAP_MARKEND ; |
936 __UHEAP_MARKEND ; |
912 return error; |
937 return error; |
913 |
938 |
914 } |
939 } |
915 |
940 |
916 TInt CTestProvider :: TraceWrongInfoClass( CStifItemParser& /*aItem*/ ) |
941 TInt CTestProvider :: TraceWrongInfoClass( CStifItemParser& /*aItem*/ ) |
917 { |
942 { |
918 __UHEAP_MARK ; |
943 __UHEAP_MARK ; |
919 TInt start = User::CountAllocCells(); |
944 TInt start = User::CountAllocCells(); |
920 ASyncLocCBF callback; |
945 ASyncLocCBF callback; |
921 |
946 |
922 |
947 |
923 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
948 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
924 |
|
925 // Input and output parameter list |
949 // Input and output parameter list |
926 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
950 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
927 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
951 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
952 |
|
953 |
|
954 |
|
955 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
|
956 |
|
957 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
958 |
|
959 RCriteriaArray a; |
|
960 a.AppendL(crit); |
|
961 ServiceHandler->AttachL(a) ; |
|
962 |
|
963 |
|
964 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
965 |
|
966 |
|
967 TInt pos = 0; |
|
968 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
|
969 |
|
970 if(!errorprm) |
|
971 { |
|
972 |
|
973 return KErrGeneral ; |
|
974 } |
|
975 |
|
976 |
|
977 _LIT8(KDataSource, "ILocation"); |
|
978 pos = 0 ; |
928 |
979 |
929 |
980 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
930 |
981 if(!genericparm) |
931 |
982 { |
932 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
983 |
933 |
984 return KErrGeneral ; |
934 |
985 } |
935 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
986 |
936 |
987 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
937 RCriteriaArray a; |
988 |
938 a.AppendL(crit); |
989 |
939 |
|
940 ServiceHandler->AttachL(a) ; |
|
941 |
|
942 |
|
943 |
|
944 |
|
945 |
|
946 |
|
947 |
|
948 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
949 |
|
950 |
|
951 |
|
952 |
|
953 TInt pos = 0; |
|
954 |
|
955 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
|
956 |
|
957 if(!errorprm) |
|
958 { |
|
959 |
|
960 return KErrGeneral ; |
|
961 } |
|
962 |
|
963 |
|
964 _LIT8(KDataSource, "ILocation"); |
|
965 |
|
966 pos = 0 ; |
|
967 |
|
968 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
|
969 |
|
970 if(!genericparm) |
|
971 { |
|
972 |
|
973 return KErrGeneral ; |
|
974 } |
|
975 |
|
976 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
|
977 |
|
978 |
|
979 |
|
980 TBuf8<20>CmdBuf(KCmdTraceLocation) ; |
990 TBuf8<20>CmdBuf(KCmdTraceLocation) ; |
981 |
991 |
982 outputlist->Reset() ; |
992 outputlist->Reset() ; |
983 inputlist->Reset() ; |
993 inputlist->Reset() ; |
984 _LIT8(KClass,"LocationInformationClass"); |
994 _LIT8(KClass,"LocationInformationClass"); |
985 _LIT(KClassArg,"Invalid"); |
995 _LIT(KClassArg,"Invalid"); |
986 inputlist->AppendL(TLiwGenericParam(KClass,TLiwVariant(KClassArg))); |
996 inputlist->AppendL(TLiwGenericParam(KClass,TLiwVariant(KClassArg))); |
|
997 |
|
998 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous,&callback); |
|
999 |
|
1000 pos = 0 ; |
|
1001 |
|
1002 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
1003 if(!ErrorParm) |
|
1004 { |
|
1005 |
|
1006 return KErrGeneral ; |
|
1007 } |
|
1008 TInt error = (ErrorParm->Value()).AsTInt32(); |
|
1009 if( SErrBadArgumentType == error ) |
|
1010 { |
|
1011 error = KErrNone; |
|
1012 } |
|
1013 locinterface->Close() ; |
|
1014 outputlist->Reset() ; |
|
1015 inputlist->Reset() ; |
987 |
1016 |
988 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous,&callback); |
1017 //delete inputlist; |
989 |
1018 //delete outputlist; |
990 pos = 0 ; |
1019 |
991 |
|
992 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
993 |
|
994 if(!ErrorParm) |
|
995 { |
|
996 |
|
997 return KErrGeneral ; |
|
998 } |
|
999 TInt error = (ErrorParm->Value()).AsTInt32(); |
|
1000 if( SErrBadArgumentType == error ) |
|
1001 { |
|
1002 error = KErrNone; |
|
1003 |
|
1004 |
|
1005 } |
|
1006 locinterface->Close() ; |
|
1007 outputlist->Reset() ; |
|
1008 inputlist->Reset() ; |
|
1009 delete ServiceHandler ; |
1020 delete ServiceHandler ; |
1010 a.ResetAndDestroy() ; |
1021 a.ResetAndDestroy() ; |
1011 a.Close() ; |
1022 a.Close() ; |
1012 TInt end = User::CountAllocCells(); |
1023 TInt end = User::CountAllocCells(); |
1013 __UHEAP_MARKEND ; |
1024 __UHEAP_MARKEND ; |
1014 return error; |
1025 return error; |
1015 |
1026 |
1016 } |
1027 } |
1017 |
1028 |
1018 TInt CTestProvider :: getlocationPostionbasedpdateoption( CStifItemParser& /*aItem*/ ) |
1029 TInt CTestProvider :: getlocationPostionbasedpdateoption( CStifItemParser& /*aItem*/ ) |
1019 { |
1030 { |
1020 __UHEAP_MARK ; |
1031 __UHEAP_MARK ; |
1021 RFile LogFile ; |
1032 RFile LogFile ; |
1022 RFs LogSession ; |
1033 RFs LogSession ; |
1023 TBuf8<50> data ; |
1034 TBuf8<50> data ; |
1024 TRealFormat format ; |
1035 TRealFormat format ; |
1025 |
1036 |
1026 |
1037 |
1027 if(LogSession.Connect() != KErrNone) |
1038 if(LogSession.Connect() != KErrNone) |
1028 { |
1039 { |
1029 _LIT(KLog , "Failed to connect to file server") ; |
1040 _LIT(KLog , "Failed to connect to file server") ; |
1030 iLog->Log(KLog) ; |
1041 iLog->Log(KLog) ; |
1031 return KErrGeneral ; |
1042 return KErrGeneral ; |
1032 } |
1043 } |
1033 |
1044 |
1034 |
1045 |
1035 |
1046 |
1036 |
1047 |
1037 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
1048 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
1038 { |
1049 { |
1039 if(LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) != KErrNone) |
1050 if(LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) != KErrNone) |
1040 { |
1051 { |
1041 _LIT(KLog , "Failed to create notifications log file") ; |
1052 _LIT(KLog , "Failed to create notifications log file") ; |
1042 iLog->Log(KLog) ; |
1053 iLog->Log(KLog) ; |
1043 return KErrGeneral ; |
1054 return KErrGeneral ; |
1044 } |
1055 } |
1045 |
1056 |
1046 } |
1057 } |
1047 |
1058 |
1048 _LIT(KLog , "In CTGetLocation") ; |
1059 _LIT(KLog , "In CTGetLocation") ; |
1049 iLog->Log(KLog) ; |
1060 iLog->Log(KLog) ; |
1050 |
1061 |
1051 |
1062 |
1052 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
1063 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
1053 |
1064 |
1054 // Input and output parameter list |
1065 // Input and output parameter list |
1055 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
1066 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
1056 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
1067 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
1057 |
1068 |
1058 |
1069 |
1059 |
1070 |
1060 |
1071 |
1061 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
1072 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
1062 |
1073 |
1063 |
1074 |
1064 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
1075 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
1065 |
1076 |
1066 RCriteriaArray a; |
1077 RCriteriaArray a; |
1067 a.AppendL(crit); |
1078 a.AppendL(crit); |
1068 |
1079 |
1069 ServiceHandler->AttachL(a) ; |
1080 ServiceHandler->AttachL(a) ; |
1070 |
1081 |
1071 |
1082 |
1072 |
1083 |
1073 |
1084 |
1074 |
1085 |
1075 |
1086 |
1076 |
1087 |
1077 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
1088 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
1078 |
1089 |
1079 |
1090 |
1080 |
1091 |
1081 |
1092 |
1082 TInt pos = 0; |
1093 TInt pos = 0; |
1083 |
1094 |
1084 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
1095 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
1085 |
1096 |
1086 if(!errorprm) |
1097 if(!errorprm) |
1087 { |
1098 { |
1088 _LIT(Klog , "Success/Failure error code missing from outputlist") ; |
1099 _LIT(Klog , "Success/Failure error code missing from outputlist") ; |
1089 iLog->Log(Klog) ; |
1100 iLog->Log(Klog) ; |
1090 return KErrGeneral ; |
1101 return KErrGeneral ; |
1091 } |
1102 } |
1092 |
1103 |
1093 |
1104 |
1094 _LIT8(KDataSource, "ILocation"); |
1105 _LIT8(KDataSource, "ILocation"); |
1095 |
1106 |
1096 pos = 0 ; |
1107 pos = 0 ; |
1097 |
1108 |
1098 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
1109 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
1099 |
1110 |
1100 if(!genericparm) |
1111 if(!genericparm) |
1101 { |
1112 { |
1102 _LIT(KLog , "Interface not found"); |
1113 _LIT(KLog , "Interface not found"); |
1103 iLog->Log(KLog) ; |
1114 iLog->Log(KLog) ; |
1104 return KErrGeneral ; |
1115 return KErrGeneral ; |
1105 } |
1116 } |
1106 |
1117 |
1107 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
1118 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
1108 |
1119 |
1109 |
1120 |
1110 |
1121 |
1111 TBuf8<20>CmdBuf(KCmdGetLocation) ; |
1122 TBuf8<20>CmdBuf(KCmdGetLocation) ; |
1112 |
1123 |
1113 outputlist->Reset() ; |
1124 outputlist->Reset() ; |
1114 inputlist->Reset() ; |
1125 inputlist->Reset() ; |
1115 _LIT(KClass,"GenericLocationInfo"); |
1126 _LIT(KClass,"GenericLocationInfo"); |
1116 inputlist->AppendL( TLiwGenericParam( KNullDesC8,TLiwVariant( ) ) ); |
1127 inputlist->AppendL( TLiwGenericParam( KNullDesC8,TLiwVariant( ) ) ); |
1117 //inputlist->AppendL(TLiwGenericParam(NULL)); |
1128 //inputlist->AppendL(TLiwGenericParam(NULL)); |
1118 CLiwDefaultMap* updatemap = CLiwDefaultMap::NewL(); |
1129 CLiwDefaultMap* updatemap = CLiwDefaultMap::NewL(); |
1119 |
1130 |
1120 _LIT8(KInterval,"UpdateInterval"); |
1131 _LIT8(KInterval,"UpdateInterval"); |
1121 _LIT8(KTimeout,"UpdateTimeOut"); |
1132 _LIT8(KTimeout,"UpdateTimeOut"); |
1122 _LIT8(KAge,"UpdateMaxAge"); |
1133 _LIT8(KAge,"UpdateMaxAge"); |
1123 _LIT8(KPartial,"PartialUpdates"); |
1134 _LIT8(KPartial,"PartialUpdates"); |
1124 const TInt KTime = 1000000; |
1135 const TInt KTime = 1000000; |
1125 |
1136 |
1126 updatemap->InsertL(KInterval , TLiwVariant(TInt32(2*KTime))); |
1137 updatemap->InsertL(KInterval , TLiwVariant(TInt32(2*KTime))); |
1127 updatemap->InsertL(KTimeout , TLiwVariant(TInt32(30*KTime))); |
1138 updatemap->InsertL(KTimeout , TLiwVariant(TInt32(30*KTime))); |
1128 updatemap->InsertL(KAge , TLiwVariant(TInt32(0))); |
1139 updatemap->InsertL(KAge , TLiwVariant(TInt32(0))); |
1129 updatemap->InsertL(KPartial , TLiwVariant(TBool(FALSE))); |
1140 updatemap->InsertL(KPartial , TLiwVariant(TBool(FALSE))); |
1130 |
1141 |
1131 inputlist->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(updatemap))); |
1142 inputlist->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(updatemap))); |
1132 updatemap->DecRef(); |
1143 updatemap->DecRef(); |
1133 |
1144 |
1134 |
1145 |
1135 |
1146 |
1136 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); |
1147 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); |
1137 |
1148 |
1138 pos = 0 ; |
1149 pos = 0 ; |
1139 |
1150 |
1140 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
1151 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
1141 |
1152 |
1142 if(!ErrorParm) |
1153 if(!ErrorParm) |
1143 { |
1154 { |
1144 _LIT(Klog, "Success/Failure state not known") ; |
1155 _LIT(Klog, "Success/Failure state not known") ; |
1145 iLog->Log(Klog) ; |
1156 iLog->Log(Klog) ; |
1146 return KErrGeneral ; |
1157 return KErrGeneral ; |
1147 } |
1158 } |
1148 |
1159 |
1149 if((ErrorParm->Value()).AsTInt32() ) |
1160 if((ErrorParm->Value()).AsTInt32() ) |
1150 { |
1161 { |
1151 _LIT(KLog , "ExecutecmdL failed "); |
1162 _LIT(KLog , "ExecutecmdL failed "); |
1152 iLog->Log(KLog) ; |
1163 iLog->Log(KLog) ; |
1153 //return (ErrorParm->Value()).AsTInt32() ; |
1164 //return (ErrorParm->Value()).AsTInt32() ; |
1154 } |
1165 } |
1155 |
1166 |
1156 |
1167 |
1157 |
1168 |
1158 TInt index = 0 ; |
1169 TInt index = 0 ; |
1159 |
1170 |
1160 const TLiwGenericParam *GenericParam = outputlist->FindFirst(index , KLocationMap); |
1171 const TLiwGenericParam *GenericParam = outputlist->FindFirst(index , KLocationMap); |
1161 |
1172 |
1162 |
1173 |
1163 if(!GenericParam) |
1174 if(!GenericParam) |
1164 { |
1175 { |
1165 _LIT(Klog, "Out Param not found") ; |
1176 _LIT(Klog, "Out Param not found") ; |
1166 iLog->Log(Klog) ; |
1177 iLog->Log(Klog) ; |
1167 return KErrGeneral ; //Param Error |
1178 return KErrGeneral ; //Param Error |
1168 } |
1179 } |
1169 |
1180 |
1170 TLiwVariant Variant ; |
1181 TLiwVariant Variant ; |
1171 |
1182 |
1172 Variant = GenericParam->Value() ; |
1183 Variant = GenericParam->Value() ; |
1173 const CLiwMap *LocMap = Variant.AsMap() ; |
1184 const CLiwMap *LocMap = Variant.AsMap() ; |
1174 |
1185 |
1175 TLiwVariant PosVariant ; |
1186 TLiwVariant PosVariant ; |
1176 |
1187 |
1177 LocMap->FindL(KLongitudeKey , PosVariant) ; |
1188 LocMap->FindL(KLongitudeKey , PosVariant) ; |
1178 TReal64 LongData = (TReal64)PosVariant.AsTReal() ; //Longitude |
1189 TReal64 LongData = (TReal64)PosVariant.AsTReal() ; //Longitude |
1179 data.Num(LongData , format) ; |
1190 data.Num(LongData , format) ; |
1180 LogFile.Write(_L8("\n")) ; |
1191 LogFile.Write(_L8("\n")) ; |
1181 LogFile.Write(_L8("Logitude = ")) ; |
1192 LogFile.Write(_L8("Logitude = ")) ; |
1182 LogFile.Write(data) ; |
1193 LogFile.Write(data) ; |
1183 |
1194 |
1184 LocMap->FindL(KLatitudeKey ,PosVariant) ; //Latitude |
1195 LocMap->FindL(KLatitudeKey ,PosVariant) ; //Latitude |
1185 |
1196 |
1186 TReal64 LatData = (TReal64)PosVariant.AsTReal() ; |
1197 TReal64 LatData = (TReal64)PosVariant.AsTReal() ; |
1187 data.Num(LatData , format) ; |
1198 data.Num(LatData , format) ; |
1188 LogFile.Write(_L8(" Latitude = ")) ; |
1199 LogFile.Write(_L8(" Latitude = ")) ; |
1189 LogFile.Write(data) ; |
1200 LogFile.Write(data) ; |
1190 |
1201 |
1191 LocMap->FindL(KAltitudeKey , PosVariant) ; //Altitude |
1202 LocMap->FindL(KAltitudeKey , PosVariant) ; //Altitude |
1192 TReal32 AltData = PosVariant.AsTReal() ; |
1203 TReal32 AltData = PosVariant.AsTReal() ; |
1193 data.Num(AltData , format) ; |
1204 data.Num(AltData , format) ; |
1194 |
1205 |
1195 LogFile.Write(_L8(" Altitude = ")) ; |
1206 LogFile.Write(_L8(" Altitude = ")) ; |
1196 LogFile.Write(data) ; |
1207 LogFile.Write(data) ; |
1197 |
1208 |
1198 LogFile.Close() ; |
1209 LogFile.Close() ; |
1199 LogSession.Close() ; |
1210 LogSession.Close() ; |
1200 |
1211 |
1201 locinterface->Close() ; |
1212 locinterface->Close() ; |
1202 delete ServiceHandler ; |
1213 delete ServiceHandler ; |
1203 a.ResetAndDestroy() ; |
1214 a.ResetAndDestroy() ; |
1204 a.Close() ; |
1215 a.Close() ; |
1205 |
1216 |
1206 __UHEAP_MARKEND ; |
1217 __UHEAP_MARKEND ; |
1207 return KErrNone ; |
1218 return KErrNone ; |
1208 |
1219 |
1209 |
1220 |
1210 |
1221 |
1211 } |
1222 } |
1212 |
1223 |
1213 TInt CTestProvider :: getlocationPostionbasedwithupdateoption( CStifItemParser& /*aItem*/ ) |
1224 TInt CTestProvider :: getlocationPostionbasedwithupdateoption( CStifItemParser& /*aItem*/ ) |
1214 { |
1225 { |
1215 __UHEAP_MARK ; |
1226 __UHEAP_MARK ; |
1216 RFile LogFile ; |
1227 RFile LogFile ; |
1217 RFs LogSession ; |
1228 RFs LogSession ; |
1218 TBuf8<50> data ; |
1229 TBuf8<50> data ; |
1219 TRealFormat format ; |
1230 TRealFormat format ; |
1220 |
1231 |
1221 |
1232 |
1222 if(LogSession.Connect() != KErrNone) |
1233 if(LogSession.Connect() != KErrNone) |
1223 { |
1234 { |
1224 _LIT(KLog , "Failed to connect to file server") ; |
1235 _LIT(KLog , "Failed to connect to file server") ; |
1225 iLog->Log(KLog) ; |
1236 iLog->Log(KLog) ; |
1226 return KErrGeneral ; |
1237 return KErrGeneral ; |
1227 } |
1238 } |
1228 |
1239 |
1229 |
1240 |
1230 |
1241 |
1231 |
1242 |
1232 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
1243 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
1233 { |
1244 { |
1234 if(LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) != KErrNone) |
1245 if(LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) != KErrNone) |
1235 { |
1246 { |
1236 _LIT(KLog , "Failed to create notifications log file") ; |
1247 _LIT(KLog , "Failed to create notifications log file") ; |
1237 iLog->Log(KLog) ; |
1248 iLog->Log(KLog) ; |
1238 return KErrGeneral ; |
1249 return KErrGeneral ; |
1239 } |
1250 } |
1240 |
1251 |
1241 } |
1252 } |
1242 |
1253 |
1243 _LIT(KLog , "In CTGetLocation") ; |
1254 _LIT(KLog , "In CTGetLocation") ; |
1244 iLog->Log(KLog) ; |
1255 iLog->Log(KLog) ; |
1245 |
1256 |
1246 |
1257 |
1247 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
1258 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
1248 |
1259 |
1249 // Input and output parameter list |
1260 // Input and output parameter list |
1250 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
1261 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
1251 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
1262 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
1252 |
1263 |
1253 |
1264 |
1254 |
1265 |
1255 |
1266 |
1256 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
1267 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
1257 |
1268 |
1258 |
1269 |
1259 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
1270 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
1260 |
1271 |
1261 RCriteriaArray a; |
1272 RCriteriaArray a; |
1262 a.AppendL(crit); |
1273 a.AppendL(crit); |
1263 |
1274 |
1264 ServiceHandler->AttachL(a) ; |
1275 ServiceHandler->AttachL(a) ; |
1265 |
1276 |
1266 |
1277 |
1267 |
1278 |
1268 |
1279 |
1269 |
1280 |
1270 |
1281 |
1271 |
1282 |
1272 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
1283 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
1273 |
1284 |
1274 |
1285 |
1275 |
1286 |
1276 |
1287 |
1277 TInt pos = 0; |
1288 TInt pos = 0; |
1278 |
1289 |
1279 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
1290 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
1280 |
1291 |
1281 if(!errorprm) |
1292 if(!errorprm) |
1282 { |
1293 { |
1283 _LIT(Klog , "Success/Failure error code missing from outputlist") ; |
1294 _LIT(Klog , "Success/Failure error code missing from outputlist") ; |
1284 iLog->Log(Klog) ; |
1295 iLog->Log(Klog) ; |
1285 return KErrGeneral ; |
1296 return KErrGeneral ; |
1286 } |
1297 } |
1287 |
1298 |
1288 |
1299 |
1289 _LIT8(KDataSource, "ILocation"); |
1300 _LIT8(KDataSource, "ILocation"); |
1290 |
1301 |
1291 pos = 0 ; |
1302 pos = 0 ; |
1292 |
1303 |
1293 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
1304 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
1294 |
1305 |
1295 if(!genericparm) |
1306 if(!genericparm) |
1296 { |
1307 { |
1297 _LIT(KLog , "Interface not found"); |
1308 _LIT(KLog , "Interface not found"); |
1298 iLog->Log(KLog) ; |
1309 iLog->Log(KLog) ; |
1299 return KErrGeneral ; |
1310 return KErrGeneral ; |
1300 } |
1311 } |
1301 |
1312 |
1302 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
1313 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
1303 |
1314 |
1304 |
1315 |
1305 |
1316 |
1306 TBuf8<20>CmdBuf(KCmdGetLocation) ; |
1317 TBuf8<20>CmdBuf(KCmdGetLocation) ; |
1307 |
1318 |
1308 outputlist->Reset() ; |
1319 outputlist->Reset() ; |
1309 inputlist->Reset() ; |
1320 inputlist->Reset() ; |
1310 _LIT(KClass,"GenericLocationInfo"); |
1321 _LIT(KClass,"GenericLocationInfo"); |
1311 inputlist->AppendL( TLiwGenericParam( KNullDesC8,TLiwVariant( KClass ) ) ); |
1322 inputlist->AppendL( TLiwGenericParam( KNullDesC8,TLiwVariant( KClass ) ) ); |
1312 CLiwDefaultMap* updatemap = CLiwDefaultMap::NewL(); |
1323 CLiwDefaultMap* updatemap = CLiwDefaultMap::NewL(); |
1313 |
1324 |
1314 _LIT8(KInterval,"UpdateInterval"); |
1325 _LIT8(KInterval,"UpdateInterval"); |
1315 _LIT8(KTimeout,"UpdateTimeOut"); |
1326 _LIT8(KTimeout,"UpdateTimeOut"); |
1316 _LIT8(KAge,"UpdateMaxAge"); |
1327 _LIT8(KAge,"UpdateMaxAge"); |
1317 _LIT8(KPartial,"PartialUpdates"); |
1328 _LIT8(KPartial,"PartialUpdates"); |
1318 const TInt KTime = 1000000; |
1329 const TInt KTime = 1000000; |
1319 |
1330 |
1320 updatemap->InsertL(KInterval , TLiwVariant(TInt32(2*KTime))); |
1331 updatemap->InsertL(KInterval , TLiwVariant(TInt32(2*KTime))); |
1321 updatemap->InsertL(KTimeout , TLiwVariant(TInt32(30*KTime))); |
1332 updatemap->InsertL(KTimeout , TLiwVariant(TInt32(30*KTime))); |
1322 updatemap->InsertL(KAge , TLiwVariant(TInt32(0))); |
1333 updatemap->InsertL(KAge , TLiwVariant(TInt32(0))); |
1323 updatemap->InsertL(KPartial , TLiwVariant(TBool(FALSE))); |
1334 updatemap->InsertL(KPartial , TLiwVariant(TBool(FALSE))); |
1324 |
1335 |
1325 inputlist->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(updatemap))); |
1336 inputlist->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(updatemap))); |
1326 updatemap->DecRef(); |
1337 updatemap->DecRef(); |
1327 |
1338 |
1328 |
1339 |
1329 |
1340 |
1330 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); |
1341 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); |
1331 |
1342 |
1332 pos = 0 ; |
1343 pos = 0 ; |
1333 |
1344 |
1334 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
1345 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
1335 |
1346 |
1336 if(!ErrorParm) |
1347 if(!ErrorParm) |
1337 { |
1348 { |
1338 _LIT(Klog, "Success/Failure state not known") ; |
1349 _LIT(Klog, "Success/Failure state not known") ; |
1339 iLog->Log(Klog) ; |
1350 iLog->Log(Klog) ; |
1340 return KErrGeneral ; |
1351 return KErrGeneral ; |
1341 } |
1352 } |
1342 |
1353 |
1343 if((ErrorParm->Value()).AsTInt32() ) |
1354 if((ErrorParm->Value()).AsTInt32() ) |
1344 { |
1355 { |
1345 _LIT(KLog , "ExecutecmdL failed "); |
1356 _LIT(KLog , "ExecutecmdL failed "); |
1346 iLog->Log(KLog) ; |
1357 iLog->Log(KLog) ; |
1347 return (ErrorParm->Value()).AsTInt32() ; |
1358 return (ErrorParm->Value()).AsTInt32() ; |
1348 } |
1359 } |
1349 |
1360 |
1350 |
1361 |
1351 |
1362 |
1352 TInt index = 0 ; |
1363 TInt index = 0 ; |
1353 |
1364 |
1354 const TLiwGenericParam *GenericParam = outputlist->FindFirst(index , KLocationMap); |
1365 const TLiwGenericParam *GenericParam = outputlist->FindFirst(index , KLocationMap); |
1355 |
1366 |
1356 |
1367 |
1357 if(!GenericParam) |
1368 if(!GenericParam) |
1358 { |
1369 { |
1359 _LIT(Klog, "Out Param not found") ; |
1370 _LIT(Klog, "Out Param not found") ; |
1360 iLog->Log(Klog) ; |
1371 iLog->Log(Klog) ; |
1361 return KErrGeneral ; //Param Error |
1372 return KErrGeneral ; //Param Error |
1362 } |
1373 } |
1363 |
1374 |
1364 TLiwVariant Variant ; |
1375 TLiwVariant Variant ; |
1365 |
1376 |
1366 Variant = GenericParam->Value() ; |
1377 Variant = GenericParam->Value() ; |
1367 const CLiwMap *LocMap = Variant.AsMap() ; |
1378 const CLiwMap *LocMap = Variant.AsMap() ; |
1368 |
1379 |
1369 TLiwVariant PosVariant ; |
1380 TLiwVariant PosVariant ; |
1370 |
1381 |
1371 LocMap->FindL(KLongitudeKey , PosVariant) ; |
1382 LocMap->FindL(KLongitudeKey , PosVariant) ; |
1372 TReal64 LongData = (TReal64)PosVariant.AsTReal() ; //Longitude |
1383 TReal64 LongData = (TReal64)PosVariant.AsTReal() ; //Longitude |
1373 data.Num(LongData , format) ; |
1384 data.Num(LongData , format) ; |
1374 LogFile.Write(_L8("\n")) ; |
1385 LogFile.Write(_L8("\n")) ; |
1375 LogFile.Write(_L8("Logitude = ")) ; |
1386 LogFile.Write(_L8("Logitude = ")) ; |
1376 LogFile.Write(data) ; |
1387 LogFile.Write(data) ; |
1377 |
1388 |
1378 LocMap->FindL(KLatitudeKey ,PosVariant) ; //Latitude |
1389 LocMap->FindL(KLatitudeKey ,PosVariant) ; //Latitude |
1379 |
1390 |
1380 TReal64 LatData = (TReal64)PosVariant.AsTReal() ; |
1391 TReal64 LatData = (TReal64)PosVariant.AsTReal() ; |
1381 data.Num(LatData , format) ; |
1392 data.Num(LatData , format) ; |
1382 LogFile.Write(_L8(" Latitude = ")) ; |
1393 LogFile.Write(_L8(" Latitude = ")) ; |
1383 LogFile.Write(data) ; |
1394 LogFile.Write(data) ; |
1384 |
1395 |
1385 LocMap->FindL(KAltitudeKey , PosVariant) ; //Altitude |
1396 LocMap->FindL(KAltitudeKey , PosVariant) ; //Altitude |
1386 TReal32 AltData = PosVariant.AsTReal() ; |
1397 TReal32 AltData = PosVariant.AsTReal() ; |
1387 data.Num(AltData , format) ; |
1398 data.Num(AltData , format) ; |
1388 |
1399 |
1389 LogFile.Write(_L8(" Altitude = ")) ; |
1400 LogFile.Write(_L8(" Altitude = ")) ; |
1390 LogFile.Write(data) ; |
1401 LogFile.Write(data) ; |
1391 |
1402 |
1392 |
1403 |
1393 TLiwVariant Speed ; |
1404 TLiwVariant Speed ; |
1394 |
1405 |
1395 index = LocMap->FindL(_L8("HorizontalSpeed") , Speed ) ; |
1406 index = LocMap->FindL(_L8("HorizontalSpeed") , Speed ) ; |
1396 |
1407 |
1397 if(index ) |
1408 if(index ) |
1398 { |
1409 { |
1399 |
1410 |
1400 TReal speed = Speed.AsTReal() ; |
1411 TReal speed = Speed.AsTReal() ; |
1401 |
1412 |
1402 data.Num(speed , format) ; |
1413 data.Num(speed , format) ; |
1403 |
1414 |
1404 LogFile.Write(_L8("Speed = ")) ; |
1415 LogFile.Write(_L8("Speed = ")) ; |
1405 LogFile.Write(data) ; |
1416 LogFile.Write(data) ; |
1406 |
1417 |
1407 } |
1418 } |
1408 |
1419 |
1409 |
1420 |
1410 TLiwVariant SpeedError ; |
1421 TLiwVariant SpeedError ; |
1411 index = LocMap->FindL( _L8("HorizontalSpeedError") , SpeedError) ; |
1422 index = LocMap->FindL( _L8("HorizontalSpeedError") , SpeedError) ; |
1412 |
1423 |
1413 |
1424 |
1414 if(index ) |
1425 if(index ) |
1415 { |
1426 { |
1416 |
1427 |
1417 TReal speed = SpeedError.AsTReal() ; |
1428 TReal speed = SpeedError.AsTReal() ; |
1418 |
1429 |
1419 data.Num(speed , format) ; |
1430 data.Num(speed , format) ; |
1420 |
1431 |
1421 LogFile.Write(_L8("Speed = ")) ; |
1432 LogFile.Write(_L8("Speed = ")) ; |
1422 LogFile.Write(data) ; |
1433 LogFile.Write(data) ; |
1423 |
1434 |
1424 } |
1435 } |
1425 |
1436 |
1426 index = 0 ; |
1437 index = 0 ; |
1427 |
1438 |
1428 TLiwVariant SatInfo ; |
1439 TLiwVariant SatInfo ; |
1429 |
1440 |
1430 index = LocMap->FindL(_L8("SatelliteNumView") , SatInfo) ; |
1441 index = LocMap->FindL(_L8("SatelliteNumView") , SatInfo) ; |
1431 |
1442 |
1432 if(index ) |
1443 if(index ) |
1433 { |
1444 { |
1434 |
1445 |
1435 TInt satnumView = SatInfo.AsTInt32() ; |
1446 TInt satnumView = SatInfo.AsTInt32() ; |
1436 data.Num(satnumView , format); |
1447 data.Num(satnumView , format); |
1437 |
1448 |
1438 LogFile.Write(_L8("Satellite information")) ; |
1449 LogFile.Write(_L8("Satellite information")) ; |
1439 |
1450 |
1440 LogFile.Write(_L8("Number of visible satellites ")) ; |
1451 LogFile.Write(_L8("Number of visible satellites ")) ; |
1441 LogFile.Write(data) ; |
1452 LogFile.Write(data) ; |
1442 } |
1453 } |
1443 |
1454 |
1444 index = 0 ; |
1455 index = 0 ; |
1445 |
1456 |
1446 TLiwVariant SatInfoview ; |
1457 TLiwVariant SatInfoview ; |
1447 |
1458 |
1448 index = LocMap->FindL( _L8("SatelliteNumViewUsed") , SatInfoview) ; |
1459 index = LocMap->FindL( _L8("SatelliteNumViewUsed") , SatInfoview) ; |
1449 if(index ) |
1460 if(index ) |
1450 { |
1461 { |
1451 |
1462 |
1452 |
1463 |
1453 TInt satnumViewUsed = SatInfoview.AsTInt32() ; |
1464 TInt satnumViewUsed = SatInfoview.AsTInt32() ; |
1454 data.Num(satnumViewUsed , format); |
1465 data.Num(satnumViewUsed , format); |
1455 |
1466 |
1456 LogFile.Write(_L8("\nSatellite information")) ; |
1467 LogFile.Write(_L8("\nSatellite information")) ; |
1457 |
1468 |
1458 LogFile.Write(_L8("\nSatelliteNumViewUsed")) ; |
1469 LogFile.Write(_L8("\nSatelliteNumViewUsed")) ; |
1459 LogFile.Write(data) ; |
1470 LogFile.Write(data) ; |
1460 } |
1471 } |
1461 |
1472 |
1462 index = 0 ; |
1473 index = 0 ; |
1463 |
1474 |
1464 TInt Headinginfo = 0 ; |
1475 TInt Headinginfo = 0 ; |
1465 |
1476 |
1466 TLiwVariant Heading ; |
1477 TLiwVariant Heading ; |
1467 Headinginfo = LocMap->FindL(_L8("Heading") ,Heading) ; |
1478 Headinginfo = LocMap->FindL(_L8("Heading") ,Heading) ; |
1468 |
1479 |
1469 if(Headinginfo) |
1480 if(Headinginfo) |
1470 { |
1481 { |
1471 |
1482 |
1472 |
1483 |
1473 TReal heading = Heading.AsTReal() ; |
1484 TReal heading = Heading.AsTReal() ; |
1474 data.Num(heading , format); |
1485 data.Num(heading , format); |
1475 |
1486 |
1476 LogFile.Write(_L8("\ncompass information")) ; |
1487 LogFile.Write(_L8("\ncompass information")) ; |
1477 |
1488 |
1478 LogFile.Write(_L8("\nHeading")) ; |
1489 LogFile.Write(_L8("\nHeading")) ; |
1479 LogFile.Write(data) ; |
1490 LogFile.Write(data) ; |
1480 } |
1491 } |
1481 |
1492 |
1482 |
1493 |
1483 if(Headinginfo) |
1494 if(Headinginfo) |
1484 { |
1495 { |
1485 TLiwVariant HeadingError ; |
1496 TLiwVariant HeadingError ; |
1486 index = LocMap->FindL( _L8("HeadingError") , HeadingError ) ; |
1497 index = LocMap->FindL( _L8("HeadingError") , HeadingError ) ; |
1487 |
1498 |
1488 if(index) |
1499 if(index) |
1489 { |
1500 { |
1490 |
1501 |
1491 |
1502 |
1492 TReal heading = HeadingError.AsTReal() ; |
1503 TReal heading = HeadingError.AsTReal() ; |
1493 data.Num(heading , format); |
1504 data.Num(heading , format); |
1494 |
1505 |
1495 LogFile.Write(_L8("\ncompass information")) ; |
1506 LogFile.Write(_L8("\ncompass information")) ; |
1496 |
1507 |
1497 LogFile.Write(_L8("\nHeading Error")) ; |
1508 LogFile.Write(_L8("\nHeading Error")) ; |
1498 LogFile.Write(data) ; |
1509 LogFile.Write(data) ; |
1499 |
1510 |
1500 } |
1511 } |
1501 |
1512 |
1502 TLiwVariant MagneticHeading ; |
1513 TLiwVariant MagneticHeading ; |
1503 index = LocMap->FindL( _L8("MagneticHeading") , MagneticHeading) ; |
1514 index = LocMap->FindL( _L8("MagneticHeading") , MagneticHeading) ; |
1504 |
1515 |
1505 if(index) |
1516 if(index) |
1506 { |
1517 { |
1507 |
1518 |
1508 |
1519 |
1509 TReal heading = MagneticHeading.AsTReal() ; |
1520 TReal heading = MagneticHeading.AsTReal() ; |
1510 data.Num(heading , format); |
1521 data.Num(heading , format); |
1511 |
1522 |
1512 LogFile.Write(_L8("\ncompass information")) ; |
1523 LogFile.Write(_L8("\ncompass information")) ; |
1513 |
1524 |
1514 LogFile.Write(_L8("\n MagneticHeading ")) ; |
1525 LogFile.Write(_L8("\n MagneticHeading ")) ; |
1515 LogFile.Write(data) ; |
1526 LogFile.Write(data) ; |
1516 |
1527 |
1517 } |
1528 } |
1518 |
1529 |
1519 |
1530 |
1520 TLiwVariant MagneticHeadingError ; |
1531 TLiwVariant MagneticHeadingError ; |
1521 index = LocMap->FindL(_L8("MagneticHeadingError") ,MagneticHeadingError) ; |
1532 index = LocMap->FindL(_L8("MagneticHeadingError") ,MagneticHeadingError) ; |
1522 |
1533 |
1523 if(index) |
1534 if(index) |
1524 { |
1535 { |
1525 |
1536 |
1526 |
1537 |
1527 TReal heading = MagneticHeadingError.AsTReal() ; |
1538 TReal heading = MagneticHeadingError.AsTReal() ; |
1528 data.Num(heading , format); |
1539 data.Num(heading , format); |
1529 |
1540 |
1530 LogFile.Write(_L8("\ncompass information")) ; |
1541 LogFile.Write(_L8("\ncompass information")) ; |
1531 |
1542 |
1532 LogFile.Write(_L8("\nMagneticHeading Error")) ; |
1543 LogFile.Write(_L8("\nMagneticHeading Error")) ; |
1533 LogFile.Write(data) ; |
1544 LogFile.Write(data) ; |
1534 |
1545 |
1535 } |
1546 } |
1536 |
1547 |
1537 |
1548 |
1538 } //End of Heading |
1549 } //End of Heading |
1539 |
1550 |
1540 |
1551 |
1541 |
1552 |
1542 TLiwVariant TrueCourse ; |
1553 TLiwVariant TrueCourse ; |
1543 index = LocMap->FindL( _L8("TrueCourse") , TrueCourse ) ; |
1554 index = LocMap->FindL( _L8("TrueCourse") , TrueCourse ) ; |
1544 |
1555 |
1545 if( index) |
1556 if( index) |
1546 { |
1557 { |
1547 |
1558 |
1548 |
1559 |
1549 TReal heading = TrueCourse.AsTReal() ; |
1560 TReal heading = TrueCourse.AsTReal() ; |
1550 data.Num(heading , format); |
1561 data.Num(heading , format); |
1551 |
1562 |
1552 LogFile.Write(_L8("\nDirection ")) ; |
1563 LogFile.Write(_L8("\nDirection ")) ; |
1553 |
1564 |
1554 LogFile.Write(_L8("\n TrueCourse Error")) ; |
1565 LogFile.Write(_L8("\n TrueCourse Error")) ; |
1555 LogFile.Write(data) ; |
1566 LogFile.Write(data) ; |
1556 |
1567 |
1557 |
1568 |
1558 |
1569 |
1559 TLiwVariant TrueCourseError ; |
1570 TLiwVariant TrueCourseError ; |
1560 index = LocMap->FindL( _L8("TrueCourseError") , TrueCourseError ) ; |
1571 index = LocMap->FindL( _L8("TrueCourseError") , TrueCourseError ) ; |
1561 |
1572 |
1562 if( index) |
1573 if( index) |
1563 { |
1574 { |
1564 |
1575 |
1565 |
1576 |
1566 TReal heading = TrueCourseError.AsTReal() ; |
1577 TReal heading = TrueCourseError.AsTReal() ; |
1567 data.Num(heading , format); |
1578 data.Num(heading , format); |
1568 |
1579 |
1569 LogFile.Write(_L8("\ncompass information")) ; |
1580 LogFile.Write(_L8("\ncompass information")) ; |
1570 |
1581 |
1571 LogFile.Write(_L8("\nMagneticHeading Error")) ; |
1582 LogFile.Write(_L8("\nMagneticHeading Error")) ; |
1572 LogFile.Write(data) ; |
1583 LogFile.Write(data) ; |
1573 |
1584 |
1574 } |
1585 } |
1575 |
1586 |
1576 |
1587 |
1577 } |
1588 } |
1578 |
1589 |
1579 |
1590 |
1580 TLiwVariant MagneticCourse ; |
1591 TLiwVariant MagneticCourse ; |
1581 index = LocMap->FindL(_L8("MagneticCourse") , MagneticCourse ) ; |
1592 index = LocMap->FindL(_L8("MagneticCourse") , MagneticCourse ) ; |
1582 |
1593 |
1583 |
1594 |
1584 if(index) |
1595 if(index) |
1585 { |
1596 { |
1586 |
1597 |
1587 TReal heading = MagneticCourse.AsTReal() ; |
1598 TReal heading = MagneticCourse.AsTReal() ; |
1588 data.Num(heading , format); |
1599 data.Num(heading , format); |
1589 |
1600 |
1590 LogFile.Write(_L8("\ncompass information")) ; |
1601 LogFile.Write(_L8("\ncompass information")) ; |
1591 |
1602 |
1592 LogFile.Write(_L8("\nMagneticCourse ")) ; |
1603 LogFile.Write(_L8("\nMagneticCourse ")) ; |
1593 LogFile.Write(data) ; |
1604 LogFile.Write(data) ; |
1594 |
1605 |
1595 |
1606 |
1596 |
1607 |
1597 TLiwVariant MagneticCourseError ; |
1608 TLiwVariant MagneticCourseError ; |
1598 index = LocMap->FindL(_L8("MagneticCourseError") ,MagneticCourseError ) ; |
1609 index = LocMap->FindL(_L8("MagneticCourseError") ,MagneticCourseError ) ; |
1599 |
1610 |
1600 if( index) |
1611 if( index) |
1601 { |
1612 { |
1602 |
1613 |
1603 |
1614 |
1604 TReal heading = MagneticCourseError.AsTReal() ; |
1615 TReal heading = MagneticCourseError.AsTReal() ; |
1605 data.Num(heading , format); |
1616 data.Num(heading , format); |
1606 |
1617 |
1607 LogFile.Write(_L8("\ncompass information")) ; |
1618 LogFile.Write(_L8("\ncompass information")) ; |
1608 |
1619 |
1609 LogFile.Write(_L8("\n MagneticCourseError Error")) ; |
1620 LogFile.Write(_L8("\n MagneticCourseError Error")) ; |
1610 LogFile.Write(data) ; |
1621 LogFile.Write(data) ; |
1611 |
1622 |
1612 } |
1623 } |
1613 |
1624 |
1614 |
1625 |
1615 } |
1626 } |
1616 |
1627 |
1617 |
1628 |
1618 |
1629 |
1619 TLiwVariant NmeaNum ; |
1630 TLiwVariant NmeaNum ; |
1620 index = LocMap->FindL(_L8("NMEASentence") , NmeaNum ) ; |
1631 index = LocMap->FindL(_L8("NMEASentence") , NmeaNum ) ; |
1621 |
1632 |
1622 |
1633 |
1623 if(index) |
1634 if(index) |
1624 { |
1635 { |
1625 |
1636 |
1626 TInt32 NMEASentence = NmeaNum.AsTInt32() ; |
1637 TInt32 NMEASentence = NmeaNum.AsTInt32() ; |
1627 data.Num(NMEASentence , format); |
1638 data.Num(NMEASentence , format); |
1628 |
1639 |
1629 LogFile.Write(_L8("\nNMEA Information")) ; |
1640 LogFile.Write(_L8("\nNMEA Information")) ; |
1630 |
1641 |
1631 LogFile.Write(_L8("\n number of NMEA Sentences ")) ; |
1642 LogFile.Write(_L8("\n number of NMEA Sentences ")) ; |
1632 LogFile.Write(data) ; |
1643 LogFile.Write(data) ; |
1633 |
1644 |
1634 index = 0 ; |
1645 index = 0 ; |
1635 |
1646 |
1636 const TLiwGenericParam *MagneticCourseError = outputlist->FindFirst(index , _L8("NMEASentenceStart") ) ; |
1647 const TLiwGenericParam *MagneticCourseError = outputlist->FindFirst(index , _L8("NMEASentenceStart") ) ; |
1637 |
1648 |
1638 if(-1 != index) |
1649 if(-1 != index) |
1639 { |
1650 { |
1640 Variant = MagneticCourseError->Value() ; |
1651 Variant = MagneticCourseError->Value() ; |
1641 |
1652 |
1642 |
1653 |
1643 } |
1654 } |
1644 |
1655 |
1645 |
1656 |
1646 } |
1657 } |
1647 |
1658 |
1648 |
1659 |
1649 LogFile.Close() ; |
1660 LogFile.Close() ; |
1650 LogSession.Close() ; |
1661 LogSession.Close() ; |
1651 |
1662 |
1652 locinterface->Close() ; |
1663 locinterface->Close() ; |
1653 delete ServiceHandler ; |
1664 delete ServiceHandler ; |
1654 a.ResetAndDestroy() ; |
1665 a.ResetAndDestroy() ; |
1655 a.Close() ; |
1666 a.Close() ; |
1656 |
1667 |
1657 __UHEAP_MARKEND ; |
1668 __UHEAP_MARKEND ; |
1658 return KErrNone ; |
1669 return KErrNone ; |
1659 |
1670 |
1660 |
1671 |
1661 |
1672 |
1662 } |
1673 } |
1663 |
1674 |
1664 |
1675 |
1665 TInt CTestProvider :: getlocationPostionbased( CStifItemParser& /*aItem*/ ) |
1676 TInt CTestProvider :: getlocationPostionbased( CStifItemParser& /*aItem*/ ) |
1666 { |
1677 { |
1667 __UHEAP_MARK ; |
1678 __UHEAP_MARK ; |
1668 RFile LogFile ; |
1679 RFile LogFile ; |
1669 RFs LogSession ; |
1680 RFs LogSession ; |
1670 TBuf8<50> data ; |
1681 TBuf8<50> data ; |
1671 TRealFormat format ; |
1682 TRealFormat format ; |
1672 |
1683 |
1673 |
1684 |
1674 if(LogSession.Connect() != KErrNone) |
1685 if(LogSession.Connect() != KErrNone) |
1675 { |
1686 { |
1676 _LIT(KLog , "Failed to connect to file server") ; |
1687 _LIT(KLog , "Failed to connect to file server") ; |
1677 iLog->Log(KLog) ; |
1688 iLog->Log(KLog) ; |
1678 return KErrGeneral ; |
1689 return KErrGeneral ; |
1679 } |
1690 } |
1680 |
1691 |
1681 |
1692 |
1682 |
1693 |
1683 |
1694 |
1684 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
1695 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
1685 { |
1696 { |
1686 if(LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) != KErrNone) |
1697 if(LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) != KErrNone) |
1687 { |
1698 { |
1688 _LIT(KLog , "Failed to create notifications log file") ; |
1699 _LIT(KLog , "Failed to create notifications log file") ; |
1689 iLog->Log(KLog) ; |
1700 iLog->Log(KLog) ; |
1690 return KErrGeneral ; |
1701 return KErrGeneral ; |
1691 } |
1702 } |
1692 |
1703 |
1693 } |
1704 } |
1694 |
1705 |
1695 _LIT(KLog , "In CTGetLocation") ; |
1706 _LIT(KLog , "In CTGetLocation") ; |
1696 iLog->Log(KLog) ; |
1707 iLog->Log(KLog) ; |
1697 |
1708 |
1698 |
1709 |
1699 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
1710 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
1700 |
1711 |
1701 // Input and output parameter list |
1712 // Input and output parameter list |
1702 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
1713 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
1703 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
1714 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
1704 |
1715 |
1705 |
1716 |
1706 |
1717 |
1707 |
1718 |
1708 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
1719 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
1709 |
1720 |
1710 |
1721 |
1711 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
1722 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
1712 |
1723 |
1713 RCriteriaArray a; |
1724 RCriteriaArray a; |
1714 a.AppendL(crit); |
1725 a.AppendL(crit); |
1715 |
1726 |
1716 ServiceHandler->AttachL(a) ; |
1727 ServiceHandler->AttachL(a) ; |
1717 |
1728 |
1718 |
1729 |
1719 |
1730 |
1720 |
1731 |
1721 |
1732 |
1722 |
1733 |
1723 |
1734 |
1724 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
1735 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
1725 |
1736 |
1726 |
1737 |
1727 |
1738 |
1728 |
1739 |
1729 TInt pos = 0; |
1740 TInt pos = 0; |
1730 |
1741 |
1731 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
1742 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
1732 |
1743 |
1733 if(!errorprm) |
1744 if(!errorprm) |
1734 { |
1745 { |
1735 _LIT(Klog , "Success/Failure error code missing from outputlist") ; |
1746 _LIT(Klog , "Success/Failure error code missing from outputlist") ; |
1736 iLog->Log(Klog) ; |
1747 iLog->Log(Klog) ; |
1737 return KErrGeneral ; |
1748 return KErrGeneral ; |
1738 } |
1749 } |
1739 |
1750 |
1740 |
1751 |
1741 _LIT8(KDataSource, "ILocation"); |
1752 _LIT8(KDataSource, "ILocation"); |
1742 |
1753 |
1743 pos = 0 ; |
1754 pos = 0 ; |
1744 |
1755 |
1745 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
1756 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
1746 |
1757 |
1747 if(!genericparm) |
1758 if(!genericparm) |
1748 { |
1759 { |
1749 _LIT(KLog , "Interface not found"); |
1760 _LIT(KLog , "Interface not found"); |
1750 iLog->Log(KLog) ; |
1761 iLog->Log(KLog) ; |
1751 return KErrGeneral ; |
1762 return KErrGeneral ; |
1752 } |
1763 } |
1753 |
1764 |
1754 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
1765 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
1755 |
1766 |
1756 |
1767 |
1757 |
1768 |
1758 TBuf8<20>CmdBuf(KCmdGetLocation) ; |
1769 TBuf8<20>CmdBuf(KCmdGetLocation) ; |
1759 |
1770 |
1760 outputlist->Reset() ; |
1771 outputlist->Reset() ; |
1761 inputlist->Reset() ; |
1772 inputlist->Reset() ; |
1762 _LIT(KClass,"GenericLocationInfo"); |
1773 _LIT(KClass,"GenericLocationInfo"); |
1763 inputlist->AppendL( TLiwGenericParam( KNullDesC8,TLiwVariant( KClass ) ) ); |
1774 inputlist->AppendL( TLiwGenericParam( KNullDesC8,TLiwVariant( KClass ) ) ); |
1764 |
1775 |
1765 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); |
1776 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); |
1766 |
1777 |
1767 pos = 0 ; |
1778 pos = 0 ; |
1768 |
1779 |
1769 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
1780 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
1770 |
1781 |
1771 if(!ErrorParm) |
1782 if(!ErrorParm) |
1772 { |
1783 { |
1773 _LIT(Klog, "Success/Failure state not known") ; |
1784 _LIT(Klog, "Success/Failure state not known") ; |
1774 iLog->Log(Klog) ; |
1785 iLog->Log(Klog) ; |
1775 return KErrGeneral ; |
1786 return KErrGeneral ; |
1776 } |
1787 } |
1777 |
1788 |
1778 if((ErrorParm->Value()).AsTInt32() ) |
1789 if((ErrorParm->Value()).AsTInt32() ) |
1779 { |
1790 { |
1780 _LIT(KLog , "ExecutecmdL failed "); |
1791 _LIT(KLog , "ExecutecmdL failed "); |
1781 iLog->Log(KLog) ; |
1792 iLog->Log(KLog) ; |
1782 return (ErrorParm->Value()).AsTInt32() ; |
1793 return (ErrorParm->Value()).AsTInt32() ; |
1783 } |
1794 } |
1784 |
1795 |
1785 |
1796 |
1786 |
1797 |
1787 TInt index = 0 ; |
1798 TInt index = 0 ; |
1788 |
1799 |
1789 const TLiwGenericParam *GenericParam = outputlist->FindFirst(index , KLocationMap); |
1800 const TLiwGenericParam *GenericParam = outputlist->FindFirst(index , KLocationMap); |
1790 |
1801 |
1791 |
1802 |
1792 if(!GenericParam) |
1803 if(!GenericParam) |
1793 { |
1804 { |
1794 _LIT(Klog, "Out Param not found") ; |
1805 _LIT(Klog, "Out Param not found") ; |
1795 iLog->Log(Klog) ; |
1806 iLog->Log(Klog) ; |
1796 return KErrGeneral ; //Param Error |
1807 return KErrGeneral ; //Param Error |
1797 } |
1808 } |
1798 |
1809 |
1799 TLiwVariant Variant ; |
1810 TLiwVariant Variant ; |
1800 |
1811 |
1801 Variant = GenericParam->Value() ; |
1812 Variant = GenericParam->Value() ; |
1802 const CLiwMap *LocMap = Variant.AsMap() ; |
1813 const CLiwMap *LocMap = Variant.AsMap() ; |
1803 |
1814 |
1804 TLiwVariant PosVariant ; |
1815 TLiwVariant PosVariant ; |
1805 |
1816 |
1806 LocMap->FindL(KLongitudeKey , PosVariant) ; |
1817 LocMap->FindL(KLongitudeKey , PosVariant) ; |
1807 TReal64 LongData = (TReal64)PosVariant.AsTReal() ; //Longitude |
1818 TReal64 LongData = (TReal64)PosVariant.AsTReal() ; //Longitude |
1808 data.Num(LongData , format) ; |
1819 data.Num(LongData , format) ; |
1809 LogFile.Write(_L8("\n")) ; |
1820 LogFile.Write(_L8("\n")) ; |
1810 LogFile.Write(_L8("Logitude = ")) ; |
1821 LogFile.Write(_L8("Logitude = ")) ; |
1811 LogFile.Write(data) ; |
1822 LogFile.Write(data) ; |
1812 |
1823 |
1813 LocMap->FindL(KLatitudeKey ,PosVariant) ; //Latitude |
1824 LocMap->FindL(KLatitudeKey ,PosVariant) ; //Latitude |
1814 |
1825 |
1815 TReal64 LatData = (TReal64)PosVariant.AsTReal() ; |
1826 TReal64 LatData = (TReal64)PosVariant.AsTReal() ; |
1816 data.Num(LatData , format) ; |
1827 data.Num(LatData , format) ; |
1817 LogFile.Write(_L8(" Latitude = ")) ; |
1828 LogFile.Write(_L8(" Latitude = ")) ; |
1818 LogFile.Write(data) ; |
1829 LogFile.Write(data) ; |
1819 |
1830 |
1820 LocMap->FindL(KAltitudeKey , PosVariant) ; //Altitude |
1831 LocMap->FindL(KAltitudeKey , PosVariant) ; //Altitude |
1821 TReal32 AltData = PosVariant.AsTReal() ; |
1832 TReal32 AltData = PosVariant.AsTReal() ; |
1822 data.Num(AltData , format) ; |
1833 data.Num(AltData , format) ; |
1823 |
1834 |
1824 LogFile.Write(_L8(" Altitude = ")) ; |
1835 LogFile.Write(_L8(" Altitude = ")) ; |
1825 LogFile.Write(data) ; |
1836 LogFile.Write(data) ; |
1826 |
1837 |
1827 |
1838 |
1828 TLiwVariant Speed ; |
1839 TLiwVariant Speed ; |
1829 |
1840 |
1830 index = LocMap->FindL(_L8("HorizontalSpeed") , Speed ) ; |
1841 index = LocMap->FindL(_L8("HorizontalSpeed") , Speed ) ; |
1831 |
1842 |
1832 if(index ) |
1843 if(index ) |
1833 { |
1844 { |
1834 |
1845 |
1835 TReal speed = Speed.AsTReal() ; |
1846 TReal speed = Speed.AsTReal() ; |
1836 |
1847 |
1837 data.Num(speed , format) ; |
1848 data.Num(speed , format) ; |
1838 |
1849 |
1839 LogFile.Write(_L8("Speed = ")) ; |
1850 LogFile.Write(_L8("Speed = ")) ; |
1840 LogFile.Write(data) ; |
1851 LogFile.Write(data) ; |
1841 |
1852 |
1842 } |
1853 } |
1843 |
1854 |
1844 |
1855 |
1845 TLiwVariant SpeedError ; |
1856 TLiwVariant SpeedError ; |
1846 index = LocMap->FindL( _L8("HorizontalSpeedError") , SpeedError) ; |
1857 index = LocMap->FindL( _L8("HorizontalSpeedError") , SpeedError) ; |
1847 |
1858 |
1848 |
1859 |
1849 if(index ) |
1860 if(index ) |
1850 { |
1861 { |
1851 |
1862 |
1852 TReal speed = SpeedError.AsTReal() ; |
1863 TReal speed = SpeedError.AsTReal() ; |
1853 |
1864 |
1854 data.Num(speed , format) ; |
1865 data.Num(speed , format) ; |
1855 |
1866 |
1856 LogFile.Write(_L8("Speed = ")) ; |
1867 LogFile.Write(_L8("Speed = ")) ; |
1857 LogFile.Write(data) ; |
1868 LogFile.Write(data) ; |
1858 |
1869 |
1859 } |
1870 } |
1860 |
1871 |
1861 index = 0 ; |
1872 index = 0 ; |
1862 |
1873 |
1863 TLiwVariant SatInfo ; |
1874 TLiwVariant SatInfo ; |
1864 |
1875 |
1865 index = LocMap->FindL(_L8("SatelliteNumView") , SatInfo) ; |
1876 index = LocMap->FindL(_L8("SatelliteNumView") , SatInfo) ; |
1866 |
1877 |
1867 if(index ) |
1878 if(index ) |
1868 { |
1879 { |
1869 |
1880 |
1870 TInt satnumView = SatInfo.AsTInt32() ; |
1881 TInt satnumView = SatInfo.AsTInt32() ; |
1871 data.Num(satnumView , format); |
1882 data.Num(satnumView , format); |
1872 |
1883 |
1873 LogFile.Write(_L8("Satellite information")) ; |
1884 LogFile.Write(_L8("Satellite information")) ; |
1874 |
1885 |
1875 LogFile.Write(_L8("Number of visible satellites ")) ; |
1886 LogFile.Write(_L8("Number of visible satellites ")) ; |
1876 LogFile.Write(data) ; |
1887 LogFile.Write(data) ; |
1877 } |
1888 } |
1878 |
1889 |
1879 index = 0 ; |
1890 index = 0 ; |
1880 |
1891 |
1881 TLiwVariant SatInfoview ; |
1892 TLiwVariant SatInfoview ; |
1882 |
1893 |
1883 index = LocMap->FindL( _L8("SatelliteNumViewUsed") , SatInfoview) ; |
1894 index = LocMap->FindL( _L8("SatelliteNumViewUsed") , SatInfoview) ; |
1884 if(index ) |
1895 if(index ) |
1885 { |
1896 { |
1886 |
1897 |
1887 |
1898 |
1888 TInt satnumViewUsed = SatInfoview.AsTInt32() ; |
1899 TInt satnumViewUsed = SatInfoview.AsTInt32() ; |
1889 data.Num(satnumViewUsed , format); |
1900 data.Num(satnumViewUsed , format); |
1890 |
1901 |
1891 LogFile.Write(_L8("\nSatellite information")) ; |
1902 LogFile.Write(_L8("\nSatellite information")) ; |
1892 |
1903 |
1893 LogFile.Write(_L8("\nSatelliteNumViewUsed")) ; |
1904 LogFile.Write(_L8("\nSatelliteNumViewUsed")) ; |
1894 LogFile.Write(data) ; |
1905 LogFile.Write(data) ; |
1895 } |
1906 } |
1896 |
1907 |
1897 index = 0 ; |
1908 index = 0 ; |
1898 |
1909 |
1899 TInt Headinginfo = 0 ; |
1910 TInt Headinginfo = 0 ; |
1900 |
1911 |
1901 TLiwVariant Heading ; |
1912 TLiwVariant Heading ; |
1902 Headinginfo = LocMap->FindL(_L8("Heading") ,Heading) ; |
1913 Headinginfo = LocMap->FindL(_L8("Heading") ,Heading) ; |
1903 |
1914 |
1904 if(Headinginfo) |
1915 if(Headinginfo) |
1905 { |
1916 { |
1906 |
1917 |
1907 |
1918 |
1908 TReal heading = Heading.AsTReal() ; |
1919 TReal heading = Heading.AsTReal() ; |
1909 data.Num(heading , format); |
1920 data.Num(heading , format); |
1910 |
1921 |
1911 LogFile.Write(_L8("\ncompass information")) ; |
1922 LogFile.Write(_L8("\ncompass information")) ; |
1912 |
1923 |
1913 LogFile.Write(_L8("\nHeading")) ; |
1924 LogFile.Write(_L8("\nHeading")) ; |
1914 LogFile.Write(data) ; |
1925 LogFile.Write(data) ; |
1915 } |
1926 } |
1916 |
1927 |
1917 |
1928 |
1918 if(Headinginfo) |
1929 if(Headinginfo) |
1919 { |
1930 { |
1920 TLiwVariant HeadingError ; |
1931 TLiwVariant HeadingError ; |
1921 index = LocMap->FindL( _L8("HeadingError") , HeadingError ) ; |
1932 index = LocMap->FindL( _L8("HeadingError") , HeadingError ) ; |
1922 |
1933 |
1923 if(index) |
1934 if(index) |
1924 { |
1935 { |
1925 |
1936 |
1926 |
1937 |
1927 TReal heading = HeadingError.AsTReal() ; |
1938 TReal heading = HeadingError.AsTReal() ; |
1928 data.Num(heading , format); |
1939 data.Num(heading , format); |
1929 |
1940 |
1930 LogFile.Write(_L8("\ncompass information")) ; |
1941 LogFile.Write(_L8("\ncompass information")) ; |
1931 |
1942 |
1932 LogFile.Write(_L8("\nHeading Error")) ; |
1943 LogFile.Write(_L8("\nHeading Error")) ; |
1933 LogFile.Write(data) ; |
1944 LogFile.Write(data) ; |
1934 |
1945 |
1935 } |
1946 } |
1936 |
1947 |
1937 TLiwVariant MagneticHeading ; |
1948 TLiwVariant MagneticHeading ; |
1938 index = LocMap->FindL( _L8("MagneticHeading") , MagneticHeading) ; |
1949 index = LocMap->FindL( _L8("MagneticHeading") , MagneticHeading) ; |
1939 |
1950 |
1940 if(index) |
1951 if(index) |
1941 { |
1952 { |
1942 |
1953 |
1943 |
1954 |
1944 TReal heading = MagneticHeading.AsTReal() ; |
1955 TReal heading = MagneticHeading.AsTReal() ; |
1945 data.Num(heading , format); |
1956 data.Num(heading , format); |
1946 |
1957 |
1947 LogFile.Write(_L8("\ncompass information")) ; |
1958 LogFile.Write(_L8("\ncompass information")) ; |
1948 |
1959 |
1949 LogFile.Write(_L8("\n MagneticHeading ")) ; |
1960 LogFile.Write(_L8("\n MagneticHeading ")) ; |
1950 LogFile.Write(data) ; |
1961 LogFile.Write(data) ; |
1951 |
1962 |
1952 } |
1963 } |
1953 |
1964 |
1954 |
1965 |
1955 TLiwVariant MagneticHeadingError ; |
1966 TLiwVariant MagneticHeadingError ; |
1956 index = LocMap->FindL(_L8("MagneticHeadingError") ,MagneticHeadingError) ; |
1967 index = LocMap->FindL(_L8("MagneticHeadingError") ,MagneticHeadingError) ; |
1957 |
1968 |
1958 if(index) |
1969 if(index) |
1959 { |
1970 { |
1960 |
1971 |
1961 |
1972 |
1962 TReal heading = MagneticHeadingError.AsTReal() ; |
1973 TReal heading = MagneticHeadingError.AsTReal() ; |
1963 data.Num(heading , format); |
1974 data.Num(heading , format); |
1964 |
1975 |
1965 LogFile.Write(_L8("\ncompass information")) ; |
1976 LogFile.Write(_L8("\ncompass information")) ; |
1966 |
1977 |
1967 LogFile.Write(_L8("\nMagneticHeading Error")) ; |
1978 LogFile.Write(_L8("\nMagneticHeading Error")) ; |
1968 LogFile.Write(data) ; |
1979 LogFile.Write(data) ; |
1969 |
1980 |
1970 } |
1981 } |
1971 |
1982 |
1972 |
1983 |
1973 } //End of Heading |
1984 } //End of Heading |
1974 |
1985 |
1975 |
1986 |
1976 |
1987 |
1977 TLiwVariant TrueCourse ; |
1988 TLiwVariant TrueCourse ; |
1978 index = LocMap->FindL( _L8("TrueCourse") , TrueCourse ) ; |
1989 index = LocMap->FindL( _L8("TrueCourse") , TrueCourse ) ; |
1979 |
1990 |
1980 if( index) |
1991 if( index) |
1981 { |
1992 { |
1982 |
1993 |
1983 |
1994 |
1984 TReal heading = TrueCourse.AsTReal() ; |
1995 TReal heading = TrueCourse.AsTReal() ; |
1985 data.Num(heading , format); |
1996 data.Num(heading , format); |
1986 |
1997 |
1987 LogFile.Write(_L8("\nDirection ")) ; |
1998 LogFile.Write(_L8("\nDirection ")) ; |
1988 |
1999 |
1989 LogFile.Write(_L8("\n TrueCourse Error")) ; |
2000 LogFile.Write(_L8("\n TrueCourse Error")) ; |
1990 LogFile.Write(data) ; |
2001 LogFile.Write(data) ; |
1991 |
2002 |
1992 |
2003 |
1993 |
2004 |
1994 TLiwVariant TrueCourseError ; |
2005 TLiwVariant TrueCourseError ; |
1995 index = LocMap->FindL( _L8("TrueCourseError") , TrueCourseError ) ; |
2006 index = LocMap->FindL( _L8("TrueCourseError") , TrueCourseError ) ; |
1996 |
2007 |
1997 if( index) |
2008 if( index) |
1998 { |
2009 { |
1999 |
2010 |
2000 |
2011 |
2001 TReal heading = TrueCourseError.AsTReal() ; |
2012 TReal heading = TrueCourseError.AsTReal() ; |
2002 data.Num(heading , format); |
2013 data.Num(heading , format); |
2003 |
2014 |
2004 LogFile.Write(_L8("\ncompass information")) ; |
2015 LogFile.Write(_L8("\ncompass information")) ; |
2005 |
2016 |
2006 LogFile.Write(_L8("\nMagneticHeading Error")) ; |
2017 LogFile.Write(_L8("\nMagneticHeading Error")) ; |
2007 LogFile.Write(data) ; |
2018 LogFile.Write(data) ; |
2008 |
2019 |
2009 } |
2020 } |
2010 |
2021 |
2011 |
2022 |
2012 } |
2023 } |
2013 |
2024 |
2014 |
2025 |
2015 TLiwVariant MagneticCourse ; |
2026 TLiwVariant MagneticCourse ; |
2016 index = LocMap->FindL(_L8("MagneticCourse") , MagneticCourse ) ; |
2027 index = LocMap->FindL(_L8("MagneticCourse") , MagneticCourse ) ; |
2017 |
2028 |
2018 |
2029 |
2019 if(index) |
2030 if(index) |
2020 { |
2031 { |
2021 |
2032 |
2022 TReal heading = MagneticCourse.AsTReal() ; |
2033 TReal heading = MagneticCourse.AsTReal() ; |
2023 data.Num(heading , format); |
2034 data.Num(heading , format); |
2024 |
2035 |
2025 LogFile.Write(_L8("\ncompass information")) ; |
2036 LogFile.Write(_L8("\ncompass information")) ; |
2026 |
2037 |
2027 LogFile.Write(_L8("\nMagneticCourse ")) ; |
2038 LogFile.Write(_L8("\nMagneticCourse ")) ; |
2028 LogFile.Write(data) ; |
2039 LogFile.Write(data) ; |
2029 |
2040 |
2030 |
2041 |
2031 |
2042 |
2032 TLiwVariant MagneticCourseError ; |
2043 TLiwVariant MagneticCourseError ; |
2033 index = LocMap->FindL(_L8("MagneticCourseError") ,MagneticCourseError ) ; |
2044 index = LocMap->FindL(_L8("MagneticCourseError") ,MagneticCourseError ) ; |
2034 |
2045 |
2035 if( index) |
2046 if( index) |
2036 { |
2047 { |
2037 |
2048 |
2038 |
2049 |
2039 TReal heading = MagneticCourseError.AsTReal() ; |
2050 TReal heading = MagneticCourseError.AsTReal() ; |
2040 data.Num(heading , format); |
2051 data.Num(heading , format); |
2041 |
2052 |
2042 LogFile.Write(_L8("\ncompass information")) ; |
2053 LogFile.Write(_L8("\ncompass information")) ; |
2043 |
2054 |
2044 LogFile.Write(_L8("\n MagneticCourseError Error")) ; |
2055 LogFile.Write(_L8("\n MagneticCourseError Error")) ; |
2045 LogFile.Write(data) ; |
2056 LogFile.Write(data) ; |
2046 |
2057 |
2047 } |
2058 } |
2048 |
2059 |
2049 |
2060 |
2050 } |
2061 } |
2051 |
2062 |
2052 |
2063 |
2053 |
2064 |
2054 TLiwVariant NmeaNum ; |
2065 TLiwVariant NmeaNum ; |
2055 index = LocMap->FindL(_L8("NMEASentence") , NmeaNum ) ; |
2066 index = LocMap->FindL(_L8("NMEASentence") , NmeaNum ) ; |
2056 |
2067 |
2057 |
2068 |
2058 if(index) |
2069 if(index) |
2059 { |
2070 { |
2060 |
2071 |
2061 TInt32 NMEASentence = NmeaNum.AsTInt32() ; |
2072 TInt32 NMEASentence = NmeaNum.AsTInt32() ; |
2062 data.Num(NMEASentence , format); |
2073 data.Num(NMEASentence , format); |
2063 |
2074 |
2064 LogFile.Write(_L8("\nNMEA Information")) ; |
2075 LogFile.Write(_L8("\nNMEA Information")) ; |
2065 |
2076 |
2066 LogFile.Write(_L8("\n number of NMEA Sentences ")) ; |
2077 LogFile.Write(_L8("\n number of NMEA Sentences ")) ; |
2067 LogFile.Write(data) ; |
2078 LogFile.Write(data) ; |
2068 |
2079 |
2069 index = 0 ; |
2080 index = 0 ; |
2070 |
2081 |
2071 const TLiwGenericParam *MagneticCourseError = outputlist->FindFirst(index , _L8("NMEASentenceStart") ) ; |
2082 const TLiwGenericParam *MagneticCourseError = outputlist->FindFirst(index , _L8("NMEASentenceStart") ) ; |
2072 |
2083 |
2073 if(-1 != index) |
2084 if(-1 != index) |
2074 { |
2085 { |
2075 Variant = MagneticCourseError->Value() ; |
2086 Variant = MagneticCourseError->Value() ; |
2076 |
2087 |
2077 |
2088 |
2078 } |
2089 } |
2079 |
2090 |
2080 |
2091 |
2081 } |
2092 } |
2082 |
2093 |
2083 |
2094 |
2084 LogFile.Close() ; |
2095 LogFile.Close() ; |
2085 LogSession.Close() ; |
2096 LogSession.Close() ; |
2086 |
2097 |
2087 locinterface->Close() ; |
2098 locinterface->Close() ; |
2088 delete ServiceHandler ; |
2099 delete ServiceHandler ; |
2089 a.ResetAndDestroy() ; |
2100 a.ResetAndDestroy() ; |
2090 a.Close() ; |
2101 a.Close() ; |
2091 |
2102 |
2092 __UHEAP_MARKEND ; |
2103 __UHEAP_MARKEND ; |
2093 return KErrNone ; |
2104 return KErrNone ; |
2094 |
2105 |
2095 |
2106 |
2096 |
2107 |
2097 } |
2108 } |
2098 |
2109 |
2099 |
2110 |
2100 TInt CTestProvider :: CancelWithInvalidTransId(CStifItemParser& /*aItem*/) |
2111 TInt CTestProvider :: CancelWithInvalidTransId(CStifItemParser& /*aItem*/) |
2101 { |
2112 { |
2102 __UHEAP_MARK ; |
2113 __UHEAP_MARK ; |
2103 RFile LogFile ; |
2114 RFile LogFile ; |
2104 RFs LogSession ; |
2115 RFs LogSession ; |
2105 TBuf8<50> data ; |
2116 TBuf8<50> data ; |
2106 TRealFormat format ; |
2117 TRealFormat format ; |
2107 |
2118 |
2108 |
2119 |
2109 if(LogSession.Connect() != KErrNone) |
2120 if(LogSession.Connect() != KErrNone) |
2110 { |
2121 { |
2111 _LIT(KLog , "Failed to connect to file server") ; |
2122 _LIT(KLog , "Failed to connect to file server") ; |
2112 iLog->Log(KLog) ; |
2123 iLog->Log(KLog) ; |
2113 return KErrGeneral ; |
2124 return KErrGeneral ; |
2114 } |
2125 } |
2115 |
2126 |
2116 |
2127 |
2117 _LIT(LogFileNameCancel , "C:\\cancelinvalid.txt") ; |
2128 _LIT(LogFileNameCancel , "C:\\cancelinvalid.txt") ; |
2118 |
2129 |
2119 if(LogFile.Open(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) == KErrNotFound) |
2130 if(LogFile.Open(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) == KErrNotFound) |
2120 { |
2131 { |
2121 if(LogFile.Create(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) != KErrNone) |
2132 if(LogFile.Create(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) != KErrNone) |
2122 { |
2133 { |
2123 _LIT(KLog , "Failed to create log file\n") ; |
2134 _LIT(KLog , "Failed to create log file\n") ; |
2124 iLog->Log(KLog) ; |
2135 iLog->Log(KLog) ; |
2125 return KErrGeneral ; |
2136 return KErrGeneral ; |
2126 } |
2137 } |
2127 |
2138 |
2128 } |
2139 } |
2129 |
2140 |
2130 _LIT(KLog , "In CancelWithInvalidTransactionID\n") ; |
2141 _LIT(KLog , "In CancelWithInvalidTransactionID\n") ; |
2131 data.Copy(KLog); |
2142 data.Copy(KLog); |
2132 LogFile.Write(data) ; |
2143 LogFile.Write(data) ; |
2133 |
2144 |
2134 User::After(5000000); |
2145 User::After(5000000); |
2135 |
2146 |
2136 |
2147 |
2137 |
2148 |
2138 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
2139 |
|
2140 // Input and output parameter list |
|
2141 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
2142 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
2143 |
|
2144 |
|
2145 |
|
2146 |
|
2147 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
|
2148 |
|
2149 |
|
2150 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
2151 |
|
2152 RCriteriaArray a; |
|
2153 a.AppendL(crit); |
|
2154 |
|
2155 ServiceHandler->AttachL(a) ; |
|
2156 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
2157 |
|
2158 |
|
2159 |
|
2160 |
|
2161 TInt pos = 0; |
|
2162 |
|
2163 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
|
2164 |
|
2165 if(!errorprm) |
|
2166 { |
|
2167 |
|
2168 return KErrGeneral ; |
|
2169 } |
|
2170 |
|
2171 |
|
2172 _LIT8(KDataSource, "ILocation"); |
|
2173 |
|
2174 pos = 0 ; |
|
2175 |
|
2176 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
|
2177 |
|
2178 if(!genericparm) |
|
2179 { |
|
2180 |
|
2181 return KErrGeneral ; |
|
2182 } |
|
2183 |
|
2184 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
|
2185 |
|
2186 |
|
2187 |
|
2188 TBuf8<20>CmdBuf(KCmdGetLocation) ; |
|
2189 |
|
2190 outputlist->Reset() ; |
|
2191 inputlist->Reset() ; |
|
2192 ASyncLocCBF* callBack ; |
|
2193 |
|
2194 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous, callBack); |
|
2195 |
|
2196 pos = 0 ; |
|
2197 |
|
2198 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
2199 |
|
2200 if(!ErrorParm) |
|
2201 { |
|
2202 _LIT(Klog , "Success/Failure error code missing from outputlist\n") ; |
|
2203 data.Copy(Klog); |
|
2204 LogFile.Write(data) ; |
|
2205 |
|
2206 //LogFile.Write(Klog) ; |
|
2207 return KErrGeneral ; |
|
2208 } |
|
2209 |
|
2210 TInt reqerror = (ErrorParm->Value()).AsTInt32(); |
|
2211 _LIT(Klog , "ERRor code from getlocationasynch ") ; |
|
2212 data.Copy(Klog); |
|
2213 LogFile.Write(data) ; |
|
2214 |
|
2215 //LogFile.Write(Klog) ; |
|
2216 |
|
2217 TReal64 errordata = reqerror ; |
|
2218 data.Num(errordata , format) ; |
|
2219 |
|
2220 |
|
2221 LogFile.Write(data) ; |
|
2222 |
|
2223 |
|
2224 pos = 0; |
|
2225 |
|
2226 _LIT8(KTransactionId, "TransactionID"); |
|
2227 const TLiwGenericParam *transid = outputlist->FindFirst(pos ,KTransactionId ) ; |
|
2228 if(!transid) |
|
2229 { |
|
2230 _LIT(KTran,"Missing Transaction ID\n"); |
|
2231 data.Copy(KTran); |
|
2232 LogFile.Write(data) ; |
|
2233 //LogFile.Write(KTran); |
|
2234 return KErrGeneral; |
|
2235 } |
|
2236 TInt trid = (transid->Value()).AsTInt32(); |
|
2237 outputlist->Reset() ; |
|
2238 inputlist->Reset() ; |
|
2239 |
|
2240 |
|
2241 inputlist->AppendL(TLiwGenericParam(KTransactionId,TLiwVariant(trid-2))); |
|
2242 |
|
2243 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptCancel); |
|
2244 |
|
2245 ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
2246 |
|
2247 if(!ErrorParm) |
|
2248 { |
|
2249 _LIT(Klog , "Success/Failure error code missing from outputlist in cancel\n ") ; |
|
2250 data.Copy(Klog); |
|
2251 LogFile.Write(data) ; |
|
2252 //LogFile.Write(Klog); |
|
2253 return KErrGeneral ; |
|
2254 } |
|
2255 |
|
2256 reqerror = (ErrorParm->Value()).AsTInt32(); |
|
2257 |
|
2258 _LIT(Klog1 , "\nERRor code from cancel ") ; |
|
2259 |
|
2260 data.Copy(Klog1); |
|
2261 LogFile.Write(data) ; |
|
2262 //LogFile.Write(Klog1) ; |
|
2263 |
|
2264 errordata = reqerror ; |
|
2265 data.Num(errordata , format) ; |
|
2266 |
|
2267 |
|
2268 LogFile.Write(data) ; |
|
2269 if( SErrNotFound == reqerror ) |
|
2270 { |
|
2271 reqerror = 0; |
|
2272 } |
|
2273 |
|
2274 |
|
2275 |
|
2276 |
|
2277 |
|
2278 |
|
2279 LogFile.Close() ; |
|
2280 LogSession.Close() ; |
|
2281 |
|
2282 locinterface->Close() ; |
|
2283 delete ServiceHandler ; |
|
2284 a.ResetAndDestroy() ; |
|
2285 a.Close() ; |
|
2286 |
|
2287 __UHEAP_MARKEND ; |
|
2288 return reqerror ; |
|
2289 |
|
2290 |
|
2291 |
|
2292 } |
|
2293 |
|
2294 |
|
2295 TInt CTestProvider :: GetLocationSynchWrongUpdateMapType(CStifItemParser& /*aItem*/) |
|
2296 { |
|
2297 __UHEAP_MARK ; |
|
2298 |
|
2299 |
|
2300 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
2149 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
2301 |
2150 |
2302 // Input and output parameter list |
2151 // Input and output parameter list |
2303 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
2152 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
2304 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
2153 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
2305 |
2154 |
2306 |
2155 |
2307 |
2156 |
2308 |
2157 |
2309 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
2158 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
2310 |
2159 |
2311 |
2160 |
2312 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
2161 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
2313 |
2162 |
2314 RCriteriaArray a; |
2163 RCriteriaArray a; |
2315 a.AppendL(crit); |
2164 a.AppendL(crit); |
2316 |
2165 |
2317 ServiceHandler->AttachL(a) ; |
2166 ServiceHandler->AttachL(a) ; |
2318 |
2167 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
2319 |
2168 |
2320 |
2169 |
2321 |
2170 |
2322 |
2171 |
2323 |
2172 TInt pos = 0; |
2324 |
2173 |
2325 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
2174 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
2326 |
2175 |
2327 |
2176 if(!errorprm) |
2328 |
2177 { |
2329 |
2178 |
2330 TInt pos = 0; |
2179 return KErrGeneral ; |
2331 |
2180 } |
2332 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
2181 |
2333 |
2182 |
2334 if(!errorprm) |
2183 _LIT8(KDataSource, "ILocation"); |
2335 { |
2184 |
2336 |
2185 pos = 0 ; |
2337 return KErrGeneral ; |
2186 |
2338 } |
2187 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
2339 |
2188 |
2340 |
2189 if(!genericparm) |
2341 _LIT8(KDataSource, "ILocation"); |
2190 { |
2342 |
2191 |
2343 pos = 0 ; |
2192 return KErrGeneral ; |
2344 |
2193 } |
2345 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
2194 |
2346 |
2195 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
2347 if(!genericparm) |
2196 |
2348 { |
2197 |
2349 |
2198 |
2350 return KErrGeneral ; |
|
2351 } |
|
2352 |
|
2353 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
|
2354 |
|
2355 |
|
2356 TBuf8<20>CmdBuf(KCmdGetLocation) ; |
2199 TBuf8<20>CmdBuf(KCmdGetLocation) ; |
2357 |
2200 |
|
2201 outputlist->Reset() ; |
|
2202 inputlist->Reset() ; |
|
2203 ASyncLocCBF* callBack ; |
|
2204 |
|
2205 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous, callBack); |
|
2206 |
|
2207 pos = 0 ; |
|
2208 |
|
2209 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
2210 |
|
2211 if(!ErrorParm) |
|
2212 { |
|
2213 _LIT(Klog , "Success/Failure error code missing from outputlist\n") ; |
|
2214 data.Copy(Klog); |
|
2215 LogFile.Write(data) ; |
|
2216 |
|
2217 //LogFile.Write(Klog) ; |
|
2218 return KErrGeneral ; |
|
2219 } |
|
2220 |
|
2221 TInt reqerror = (ErrorParm->Value()).AsTInt32(); |
|
2222 _LIT(Klog , "ERRor code from getlocationasynch ") ; |
|
2223 data.Copy(Klog); |
|
2224 LogFile.Write(data) ; |
|
2225 |
|
2226 //LogFile.Write(Klog) ; |
|
2227 |
|
2228 TReal64 errordata = reqerror ; |
|
2229 data.Num(errordata , format) ; |
|
2230 |
|
2231 |
|
2232 LogFile.Write(data) ; |
|
2233 |
|
2234 |
|
2235 pos = 0; |
|
2236 |
|
2237 _LIT8(KTransactionId, "TransactionID"); |
|
2238 const TLiwGenericParam *transid = outputlist->FindFirst(pos ,KTransactionId ) ; |
|
2239 if(!transid) |
|
2240 { |
|
2241 _LIT(KTran,"Missing Transaction ID\n"); |
|
2242 data.Copy(KTran); |
|
2243 LogFile.Write(data) ; |
|
2244 //LogFile.Write(KTran); |
|
2245 return KErrGeneral; |
|
2246 } |
|
2247 TInt trid = (transid->Value()).AsTInt32(); |
|
2248 outputlist->Reset() ; |
|
2249 inputlist->Reset() ; |
|
2250 |
|
2251 |
|
2252 inputlist->AppendL(TLiwGenericParam(KTransactionId,TLiwVariant(trid-2))); |
|
2253 |
|
2254 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptCancel); |
|
2255 |
|
2256 ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
2257 |
|
2258 if(!ErrorParm) |
|
2259 { |
|
2260 _LIT(Klog , "Success/Failure error code missing from outputlist in cancel\n ") ; |
|
2261 data.Copy(Klog); |
|
2262 LogFile.Write(data) ; |
|
2263 //LogFile.Write(Klog); |
|
2264 return KErrGeneral ; |
|
2265 } |
|
2266 |
|
2267 reqerror = (ErrorParm->Value()).AsTInt32(); |
|
2268 |
|
2269 _LIT(Klog1 , "\nERRor code from cancel ") ; |
|
2270 |
|
2271 data.Copy(Klog1); |
|
2272 LogFile.Write(data) ; |
|
2273 //LogFile.Write(Klog1) ; |
|
2274 |
|
2275 errordata = reqerror ; |
|
2276 data.Num(errordata , format) ; |
|
2277 |
|
2278 |
|
2279 LogFile.Write(data) ; |
|
2280 if( SErrNotFound == reqerror ) |
|
2281 { |
|
2282 reqerror = 0; |
|
2283 } |
|
2284 |
|
2285 |
|
2286 |
|
2287 |
|
2288 |
|
2289 |
|
2290 LogFile.Close() ; |
|
2291 LogSession.Close() ; |
|
2292 |
|
2293 locinterface->Close() ; |
|
2294 delete ServiceHandler ; |
|
2295 a.ResetAndDestroy() ; |
|
2296 a.Close() ; |
|
2297 |
|
2298 __UHEAP_MARKEND ; |
|
2299 return reqerror ; |
|
2300 |
|
2301 |
|
2302 |
|
2303 } |
|
2304 |
|
2305 |
|
2306 TInt CTestProvider :: GetLocationSynchWrongUpdateMapType(CStifItemParser& /*aItem*/) |
|
2307 { |
|
2308 __UHEAP_MARK ; |
|
2309 |
|
2310 |
|
2311 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
2312 |
|
2313 // Input and output parameter list |
|
2314 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
2315 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
2316 |
|
2317 |
|
2318 |
|
2319 |
|
2320 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
|
2321 |
|
2322 |
|
2323 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
2324 |
|
2325 RCriteriaArray a; |
|
2326 a.AppendL(crit); |
|
2327 |
|
2328 ServiceHandler->AttachL(a) ; |
|
2329 |
|
2330 |
|
2331 |
|
2332 |
|
2333 |
|
2334 |
|
2335 |
|
2336 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
2337 |
|
2338 |
|
2339 |
|
2340 |
|
2341 TInt pos = 0; |
|
2342 |
|
2343 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
|
2344 |
|
2345 if(!errorprm) |
|
2346 { |
|
2347 |
|
2348 return KErrGeneral ; |
|
2349 } |
|
2350 |
|
2351 |
|
2352 _LIT8(KDataSource, "ILocation"); |
|
2353 |
|
2354 pos = 0 ; |
|
2355 |
|
2356 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
|
2357 |
|
2358 if(!genericparm) |
|
2359 { |
|
2360 |
|
2361 return KErrGeneral ; |
|
2362 } |
|
2363 |
|
2364 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
|
2365 |
|
2366 |
|
2367 TBuf8<20>CmdBuf(KCmdGetLocation) ; |
|
2368 |
2358 outputlist->Reset() ; |
2369 outputlist->Reset() ; |
2359 inputlist->Reset() ; |
2370 inputlist->Reset() ; |
2360 _LIT8(KLocCategory,"LocationInformationClass"); |
2371 _LIT8(KLocCategory,"LocationInformationClass"); |
2361 _LIT16(KBasic,"BasicLocationInformation"); |
2372 _LIT16(KBasic,"BasicLocationInformation"); |
2362 inputlist->AppendL(TLiwGenericParam(KLocCategory,TLiwVariant(KBasic))); |
2373 inputlist->AppendL(TLiwGenericParam(KLocCategory,TLiwVariant(KBasic))); |
2363 |
2374 |
2364 |
2375 |
2365 |
2376 |
2366 _LIT8(KUpdate,"Updateoptions"); |
2377 _LIT8(KUpdate,"Updateoptions"); |
2367 inputlist->AppendL(TLiwGenericParam(KUpdate,TLiwVariant(30))); |
2378 inputlist->AppendL(TLiwGenericParam(KUpdate,TLiwVariant(30))); |
2368 |
2379 |
2369 |
2380 |
2370 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); |
2381 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); |
2371 |
2382 |
2372 pos = 0 ; |
2383 pos = 0 ; |
2373 |
2384 |
2374 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
2385 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
2375 |
2386 |
2376 |
2387 |
2377 if(!ErrorParm) |
2388 if(!ErrorParm) |
2378 { |
2389 { |
2379 locinterface->Close() ; |
2390 locinterface->Close() ; |
2380 delete ServiceHandler ; |
2391 delete ServiceHandler ; |
2381 a.ResetAndDestroy() ; |
2392 a.ResetAndDestroy() ; |
2382 a.Close() ; |
2393 a.Close() ; |
2383 return KErrGeneral ; |
2394 return KErrGeneral ; |
2384 } |
2395 } |
2385 |
2396 |
2386 TInt err = (ErrorParm->Value()).AsTInt32(); |
2397 TInt err = (ErrorParm->Value()).AsTInt32(); |
2387 |
2398 |
2388 if( SErrBadArgumentType == err ) |
2399 if( SErrBadArgumentType == err ) |
2389 { |
2400 { |
2390 _LIT8(KErrorMessage,"ErrorMessage"); |
2401 _LIT8(KErrorMessage,"ErrorMessage"); |
2391 _LIT(KNone,"Error"); |
2402 _LIT(KNone,"Error"); |
2392 |
2403 |
2393 TPtrC errorstring(KNone); |
2404 TPtrC errorstring(KNone); |
2394 pos = 0; |
2405 pos = 0; |
2395 const TLiwGenericParam *ErrorParmstring = outputlist->FindFirst(pos ,KErrorMessage ) ; |
2406 const TLiwGenericParam *ErrorParmstring = outputlist->FindFirst(pos ,KErrorMessage ) ; |
2396 TLiwVariant variant = ErrorParmstring->Value(); |
2407 TLiwVariant variant = ErrorParmstring->Value(); |
2397 errorstring.Set( variant.AsDes() ); |
2408 errorstring.Set( variant.AsDes() ); |
2398 |
2409 |
2399 locinterface->Close() ; |
2410 locinterface->Close() ; |
2400 delete ServiceHandler ; |
2411 delete ServiceHandler ; |
2401 a.ResetAndDestroy() ; |
2412 a.ResetAndDestroy() ; |
2402 a.Close() ; |
2413 a.Close() ; |
2403 __UHEAP_MARKEND ; |
2414 __UHEAP_MARKEND ; |
2404 return KErrNone; |
2415 return KErrNone; |
2405 } |
2416 } |
2406 |
2417 |
2407 |
2418 |
2408 |
2419 |
2409 |
2420 |
2410 |
2421 |
2411 |
2422 |
2412 |
2423 |
2413 locinterface->Close() ; |
2424 locinterface->Close() ; |
2414 delete ServiceHandler ; |
2425 delete ServiceHandler ; |
2415 a.ResetAndDestroy() ; |
2426 a.ResetAndDestroy() ; |
2416 a.Close() ; |
2427 a.Close() ; |
2417 |
2428 |
2418 __UHEAP_MARKEND ; |
2429 __UHEAP_MARKEND ; |
2419 return err ; |
2430 return err ; |
2420 |
2431 |
2421 |
2432 |
2422 |
2433 |
2423 } |
2434 } |
2424 |
2435 |
2425 |
2436 |
2426 TInt CTestProvider :: CTestGetLocation() |
2437 TInt CTestProvider :: CTestGetLocation() |
2427 { |
2438 { |
2428 __UHEAP_MARK ; |
2439 __UHEAP_MARK ; |
2429 RFile LogFile ; |
2440 RFile LogFile ; |
2430 RFs LogSession ; |
2441 RFs LogSession ; |
2431 TBuf8<50> data ; |
2442 TBuf8<50> data ; |
2432 TRealFormat format ; |
2443 TRealFormat format ; |
2433 |
2444 |
2434 |
2445 |
2435 if(LogSession.Connect() != KErrNone) |
2446 if(LogSession.Connect() != KErrNone) |
2436 { |
2447 { |
2437 _LIT(KLog , "Failed to connect to file server") ; |
2448 _LIT(KLog , "Failed to connect to file server") ; |
2438 iLog->Log(KLog) ; |
2449 iLog->Log(KLog) ; |
2439 return KErrGeneral ; |
2450 return KErrGeneral ; |
2440 } |
2451 } |
2441 |
2452 |
2442 |
2453 |
2443 |
2454 |
2444 |
2455 |
2445 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
2456 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
2446 { |
2457 { |
2447 if(LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) != KErrNone) |
2458 if(LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) != KErrNone) |
2448 { |
2459 { |
2449 _LIT(KLog , "Failed to create notifications log file") ; |
2460 _LIT(KLog , "Failed to create notifications log file") ; |
2450 iLog->Log(KLog) ; |
2461 iLog->Log(KLog) ; |
2451 return KErrGeneral ; |
2462 return KErrGeneral ; |
2452 } |
2463 } |
2453 |
2464 |
2454 } |
2465 } |
2455 |
2466 |
2456 _LIT(KLog , "In CTGetLocation") ; |
2467 _LIT(KLog , "In CTGetLocation") ; |
2457 iLog->Log(KLog) ; |
2468 iLog->Log(KLog) ; |
2458 |
2469 |
2459 |
2470 |
2460 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
2471 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
2461 |
2472 |
2462 // Input and output parameter list |
2473 // Input and output parameter list |
2463 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
2474 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
2464 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
2475 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
2465 |
2476 |
2466 |
2477 |
2467 |
2478 |
2468 |
2479 |
2469 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
2480 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
2470 |
2481 |
2471 |
2482 |
2472 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
2483 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
2473 |
2484 |
2474 RCriteriaArray a; |
2485 RCriteriaArray a; |
2475 a.AppendL(crit); |
2486 a.AppendL(crit); |
2476 |
2487 |
2477 ServiceHandler->AttachL(a) ; |
2488 ServiceHandler->AttachL(a) ; |
2478 |
2489 |
2479 |
2490 |
2480 |
2491 |
2481 |
2492 |
2482 |
2493 |
2483 |
2494 |
2484 |
2495 |
2485 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
2496 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
2486 |
2497 |
2487 |
2498 |
2488 |
2499 |
2489 |
2500 |
2490 TInt pos = 0; |
2501 TInt pos = 0; |
2491 |
2502 |
2492 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
2503 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
2493 |
2504 |
2494 if(!errorprm) |
2505 if(!errorprm) |
2495 { |
2506 { |
2496 _LIT(Klog , "Success/Failure error code missing from outputlist") ; |
2507 _LIT(Klog , "Success/Failure error code missing from outputlist") ; |
2497 iLog->Log(Klog) ; |
2508 iLog->Log(Klog) ; |
2498 return KErrGeneral ; |
2509 return KErrGeneral ; |
2499 } |
2510 } |
2500 |
2511 |
2501 |
2512 |
2502 _LIT8(KDataSource, "ILocation"); |
2513 _LIT8(KDataSource, "ILocation"); |
2503 |
2514 |
2504 pos = 0 ; |
2515 pos = 0 ; |
2505 |
2516 |
2506 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
2517 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
2507 |
2518 |
2508 if(!genericparm) |
2519 if(!genericparm) |
2509 { |
2520 { |
2510 _LIT(KLog , "Interface not found"); |
2521 _LIT(KLog , "Interface not found"); |
2511 iLog->Log(KLog) ; |
2522 iLog->Log(KLog) ; |
2512 return KErrGeneral ; |
2523 return KErrGeneral ; |
2513 } |
2524 } |
2514 |
2525 |
2515 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
2526 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
2516 |
2527 |
2517 |
2528 |
2518 |
2529 |
2519 TBuf8<20>CmdBuf(KCmdGetLocation) ; |
2530 TBuf8<20>CmdBuf(KCmdGetLocation) ; |
2520 |
2531 |
2521 outputlist->Reset() ; |
2532 outputlist->Reset() ; |
2522 inputlist->Reset() ; |
2533 inputlist->Reset() ; |
2523 |
2534 |
2524 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); |
2535 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); |
2525 |
2536 |
2526 pos = 0 ; |
2537 pos = 0 ; |
2527 |
2538 |
2528 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
2539 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
2529 |
2540 |
2530 if(!ErrorParm) |
2541 if(!ErrorParm) |
2531 { |
2542 { |
2532 _LIT(Klog, "Success/Failure state not known") ; |
2543 _LIT(Klog, "Success/Failure state not known") ; |
2533 iLog->Log(Klog) ; |
2544 iLog->Log(Klog) ; |
2534 return KErrGeneral ; |
2545 return KErrGeneral ; |
2535 } |
2546 } |
2536 |
2547 |
2537 if((ErrorParm->Value()).AsTInt32() ) |
2548 if((ErrorParm->Value()).AsTInt32() ) |
2538 { |
2549 { |
2539 _LIT(KLog , "ExecutecmdL failed "); |
2550 _LIT(KLog , "ExecutecmdL failed "); |
2540 iLog->Log(KLog) ; |
2551 iLog->Log(KLog) ; |
2541 return (ErrorParm->Value()).AsTInt32() ; |
2552 return (ErrorParm->Value()).AsTInt32() ; |
2542 } |
2553 } |
2543 |
2554 |
2544 |
2555 |
2545 |
2556 |
2546 TInt index = 0 ; |
2557 TInt index = 0 ; |
2547 |
2558 |
2548 const TLiwGenericParam *GenericParam = outputlist->FindFirst(index , KLocationMap); |
2559 const TLiwGenericParam *GenericParam = outputlist->FindFirst(index , KLocationMap); |
2549 |
2560 |
2550 |
2561 |
2551 if(!GenericParam) |
2562 if(!GenericParam) |
2552 { |
2563 { |
2553 _LIT(Klog, "Out Param not found") ; |
2564 _LIT(Klog, "Out Param not found") ; |
2554 iLog->Log(Klog) ; |
2565 iLog->Log(Klog) ; |
2555 return KErrGeneral ; //Param Error |
2566 return KErrGeneral ; //Param Error |
2556 } |
2567 } |
2557 |
2568 |
2558 TLiwVariant Variant ; |
2569 TLiwVariant Variant ; |
2559 |
2570 |
2560 Variant = GenericParam->Value() ; |
2571 Variant = GenericParam->Value() ; |
2561 const CLiwMap *LocMap = Variant.AsMap() ; |
2572 const CLiwMap *LocMap = Variant.AsMap() ; |
2562 |
2573 |
2563 TLiwVariant PosVariant ; |
2574 TLiwVariant PosVariant ; |
2564 |
2575 |
2565 LocMap->FindL(KLongitudeKey , PosVariant) ; |
2576 LocMap->FindL(KLongitudeKey , PosVariant) ; |
2566 TReal64 LongData = (TReal64)PosVariant.AsTReal() ; //Longitude |
2577 TReal64 LongData = (TReal64)PosVariant.AsTReal() ; //Longitude |
2567 data.Num(LongData , format) ; |
2578 data.Num(LongData , format) ; |
2568 LogFile.Write(_L8("\n")) ; |
2579 LogFile.Write(_L8("\n")) ; |
2569 LogFile.Write(_L8("Logitude = ")) ; |
2580 LogFile.Write(_L8("Logitude = ")) ; |
2570 LogFile.Write(data) ; |
2581 LogFile.Write(data) ; |
2571 |
2582 |
2572 LocMap->FindL(KLatitudeKey ,PosVariant) ; //Latitude |
2583 LocMap->FindL(KLatitudeKey ,PosVariant) ; //Latitude |
2573 |
2584 |
2574 TReal64 LatData = (TReal64)PosVariant.AsTReal() ; |
2585 TReal64 LatData = (TReal64)PosVariant.AsTReal() ; |
2575 data.Num(LatData , format) ; |
2586 data.Num(LatData , format) ; |
2576 LogFile.Write(_L8(" Latitude = ")) ; |
2587 LogFile.Write(_L8(" Latitude = ")) ; |
2577 LogFile.Write(data) ; |
2588 LogFile.Write(data) ; |
2578 |
2589 |
2579 LocMap->FindL(KAltitudeKey , PosVariant) ; //Altitude |
2590 LocMap->FindL(KAltitudeKey , PosVariant) ; //Altitude |
2580 TReal32 AltData = PosVariant.AsTReal() ; |
2591 TReal32 AltData = PosVariant.AsTReal() ; |
2581 data.Num(AltData , format) ; |
2592 data.Num(AltData , format) ; |
2582 |
2593 |
2583 LogFile.Write(_L8(" Altitude = ")) ; |
2594 LogFile.Write(_L8(" Altitude = ")) ; |
2584 LogFile.Write(data) ; |
2595 LogFile.Write(data) ; |
2585 |
2596 |
2586 |
2597 TLiwVariant Accuracy; |
2587 TLiwVariant Speed ; |
2598 index = LocMap->FindL(_L8("HorizontalAccuracy"),Accuracy); |
2588 |
2599 |
2589 index = LocMap->FindL(_L8("HorizontalSpeed") , Speed ) ; |
2600 if(index) |
2590 |
2601 { |
2591 if(index ) |
2602 TReal32 AccuracyVal = Accuracy.AsTReal(); |
2592 { |
2603 data.Num(AccuracyVal , format) ; |
2593 |
2604 |
2594 TReal speed = Speed.AsTReal() ; |
2605 LogFile.Write(_L8("Horizontal Acc = ")) ; |
2595 |
2606 LogFile.Write(data) ; |
2596 data.Num(speed , format) ; |
2607 } |
2597 |
2608 |
2598 LogFile.Write(_L8("Speed = ")) ; |
2609 Accuracy.Reset(); |
2599 LogFile.Write(data) ; |
2610 index = LocMap->FindL(_L8("VerticalAccuracy"),Accuracy); |
2600 |
2611 |
2601 } |
2612 if(index) |
2602 |
2613 { |
2603 |
2614 TReal32 AccuracyVal = Accuracy.AsTReal(); |
2604 TLiwVariant SpeedError ; |
2615 data.Num(AccuracyVal , format) ; |
2605 index = LocMap->FindL( _L8("HorizontalSpeedError") , SpeedError) ; |
2616 |
2606 |
2617 LogFile.Write(_L8("Vertical Acc = ")) ; |
2607 |
2618 LogFile.Write(data) ; |
2608 if(index ) |
2619 } |
2609 { |
2620 TLiwVariant Speed ; |
2610 |
2621 |
2611 TReal speed = SpeedError.AsTReal() ; |
2622 index = LocMap->FindL(_L8("HorizontalSpeed") , Speed ) ; |
2612 |
2623 |
2613 data.Num(speed , format) ; |
2624 if(index ) |
2614 |
2625 { |
2615 LogFile.Write(_L8("Speed = ")) ; |
2626 |
2616 LogFile.Write(data) ; |
2627 TReal speed = Speed.AsTReal() ; |
2617 |
2628 |
2618 } |
2629 data.Num(speed , format) ; |
2619 |
2630 |
2620 index = 0 ; |
2631 LogFile.Write(_L8("Speed = ")) ; |
2621 |
2632 LogFile.Write(data) ; |
2622 TLiwVariant SatInfo ; |
2633 |
2623 |
2634 } |
2624 index = LocMap->FindL(_L8("SatelliteNumView") , SatInfo) ; |
2635 |
2625 |
2636 |
2626 if(index ) |
2637 TLiwVariant SpeedError ; |
2627 { |
2638 index = LocMap->FindL( _L8("HorizontalSpeedError") , SpeedError) ; |
2628 |
2639 |
2629 TInt satnumView = SatInfo.AsTInt32() ; |
2640 |
2630 data.Num(satnumView , format); |
2641 if(index ) |
2631 |
2642 { |
2632 LogFile.Write(_L8("Satellite information")) ; |
2643 |
2633 |
2644 TReal speed = SpeedError.AsTReal() ; |
2634 LogFile.Write(_L8("Number of visible satellites ")) ; |
2645 |
2635 LogFile.Write(data) ; |
2646 data.Num(speed , format) ; |
2636 } |
2647 |
2637 |
2648 LogFile.Write(_L8("Speed = ")) ; |
2638 index = 0 ; |
2649 LogFile.Write(data) ; |
2639 |
2650 |
2640 TLiwVariant SatInfoview ; |
2651 } |
2641 |
2652 |
2642 index = LocMap->FindL( _L8("SatelliteNumViewUsed") , SatInfoview) ; |
2653 index = 0 ; |
2643 if(index ) |
2654 |
2644 { |
2655 TLiwVariant SatInfo ; |
2645 |
2656 |
2646 |
2657 index = LocMap->FindL(_L8("SatelliteNumView") , SatInfo) ; |
2647 TInt satnumViewUsed = SatInfoview.AsTInt32() ; |
2658 |
2648 data.Num(satnumViewUsed , format); |
2659 if(index ) |
2649 |
2660 { |
2650 LogFile.Write(_L8("\nSatellite information")) ; |
2661 |
2651 |
2662 TInt satnumView = SatInfo.AsTInt32() ; |
2652 LogFile.Write(_L8("\nSatelliteNumViewUsed")) ; |
2663 data.Num(satnumView , format); |
2653 LogFile.Write(data) ; |
2664 |
2654 } |
2665 LogFile.Write(_L8("Satellite information")) ; |
2655 |
2666 |
2656 index = 0 ; |
2667 LogFile.Write(_L8("Number of visible satellites ")) ; |
2657 |
2668 LogFile.Write(data) ; |
2658 TInt Headinginfo = 0 ; |
2669 } |
2659 |
2670 |
2660 TLiwVariant Heading ; |
2671 index = 0 ; |
2661 Headinginfo = LocMap->FindL(_L8("Heading") ,Heading) ; |
2672 |
2662 |
2673 TLiwVariant SatInfoview ; |
2663 if(Headinginfo) |
2674 |
2664 { |
2675 index = LocMap->FindL( _L8("SatelliteNumViewUsed") , SatInfoview) ; |
2665 |
2676 if(index ) |
2666 |
2677 { |
2667 TReal heading = Heading.AsTReal() ; |
2678 |
2668 data.Num(heading , format); |
2679 |
2669 |
2680 TInt satnumViewUsed = SatInfoview.AsTInt32() ; |
2670 LogFile.Write(_L8("\ncompass information")) ; |
2681 data.Num(satnumViewUsed , format); |
2671 |
2682 |
2672 LogFile.Write(_L8("\nHeading")) ; |
2683 LogFile.Write(_L8("\nSatellite information")) ; |
2673 LogFile.Write(data) ; |
2684 |
2674 } |
2685 LogFile.Write(_L8("\nSatelliteNumViewUsed")) ; |
2675 |
2686 LogFile.Write(data) ; |
2676 |
2687 } |
2677 if(Headinginfo) |
2688 |
2678 { |
2689 index = 0 ; |
2679 TLiwVariant HeadingError ; |
2690 |
2680 index = LocMap->FindL( _L8("HeadingError") , HeadingError ) ; |
2691 TInt Headinginfo = 0 ; |
2681 |
2692 |
2682 if(index) |
2693 TLiwVariant Heading ; |
2683 { |
2694 Headinginfo = LocMap->FindL(_L8("Heading") ,Heading) ; |
2684 |
2695 |
2685 |
2696 if(Headinginfo) |
2686 TReal heading = HeadingError.AsTReal() ; |
2697 { |
2687 data.Num(heading , format); |
2698 |
2688 |
2699 |
2689 LogFile.Write(_L8("\ncompass information")) ; |
2700 TReal heading = Heading.AsTReal() ; |
2690 |
2701 data.Num(heading , format); |
2691 LogFile.Write(_L8("\nHeading Error")) ; |
2702 |
2692 LogFile.Write(data) ; |
2703 LogFile.Write(_L8("\ncompass information")) ; |
2693 |
2704 |
2694 } |
2705 LogFile.Write(_L8("\nHeading")) ; |
2695 |
2706 LogFile.Write(data) ; |
2696 TLiwVariant MagneticHeading ; |
2707 } |
2697 index = LocMap->FindL( _L8("MagneticHeading") , MagneticHeading) ; |
2708 |
2698 |
2709 |
2699 if(index) |
2710 if(Headinginfo) |
2700 { |
2711 { |
2701 |
2712 TLiwVariant HeadingError ; |
2702 |
2713 index = LocMap->FindL( _L8("HeadingError") , HeadingError ) ; |
2703 TReal heading = MagneticHeading.AsTReal() ; |
2714 |
2704 data.Num(heading , format); |
2715 if(index) |
2705 |
2716 { |
2706 LogFile.Write(_L8("\ncompass information")) ; |
2717 |
2707 |
2718 |
2708 LogFile.Write(_L8("\n MagneticHeading ")) ; |
2719 TReal heading = HeadingError.AsTReal() ; |
2709 LogFile.Write(data) ; |
2720 data.Num(heading , format); |
2710 |
2721 |
2711 } |
2722 LogFile.Write(_L8("\ncompass information")) ; |
2712 |
2723 |
2713 |
2724 LogFile.Write(_L8("\nHeading Error")) ; |
2714 TLiwVariant MagneticHeadingError ; |
2725 LogFile.Write(data) ; |
2715 index = LocMap->FindL(_L8("MagneticHeadingError") ,MagneticHeadingError) ; |
2726 |
2716 |
2727 } |
2717 if(index) |
2728 |
2718 { |
2729 TLiwVariant MagneticHeading ; |
2719 |
2730 index = LocMap->FindL( _L8("MagneticHeading") , MagneticHeading) ; |
2720 |
2731 |
2721 TReal heading = MagneticHeadingError.AsTReal() ; |
2732 if(index) |
2722 data.Num(heading , format); |
2733 { |
2723 |
2734 |
2724 LogFile.Write(_L8("\ncompass information")) ; |
2735 |
2725 |
2736 TReal heading = MagneticHeading.AsTReal() ; |
2726 LogFile.Write(_L8("\nMagneticHeading Error")) ; |
2737 data.Num(heading , format); |
2727 LogFile.Write(data) ; |
2738 |
2728 |
2739 LogFile.Write(_L8("\ncompass information")) ; |
2729 } |
2740 |
2730 |
2741 LogFile.Write(_L8("\n MagneticHeading ")) ; |
2731 |
2742 LogFile.Write(data) ; |
2732 } //End of Heading |
2743 |
2733 |
2744 } |
2734 |
2745 |
2735 |
2746 |
2736 TLiwVariant TrueCourse ; |
2747 TLiwVariant MagneticHeadingError ; |
2737 index = LocMap->FindL( _L8("TrueCourse") , TrueCourse ) ; |
2748 index = LocMap->FindL(_L8("MagneticHeadingError") ,MagneticHeadingError) ; |
2738 |
2749 |
2739 if( index) |
2750 if(index) |
2740 { |
2751 { |
2741 |
2752 |
2742 |
2753 |
2743 TReal heading = TrueCourse.AsTReal() ; |
2754 TReal heading = MagneticHeadingError.AsTReal() ; |
2744 data.Num(heading , format); |
2755 data.Num(heading , format); |
2745 |
2756 |
2746 LogFile.Write(_L8("\nDirection ")) ; |
2757 LogFile.Write(_L8("\ncompass information")) ; |
2747 |
2758 |
2748 LogFile.Write(_L8("\n TrueCourse Error")) ; |
2759 LogFile.Write(_L8("\nMagneticHeading Error")) ; |
2749 LogFile.Write(data) ; |
2760 LogFile.Write(data) ; |
2750 |
2761 |
2751 |
2762 } |
2752 |
2763 |
2753 TLiwVariant TrueCourseError ; |
2764 |
2754 index = LocMap->FindL( _L8("TrueCourseError") , TrueCourseError ) ; |
2765 } //End of Heading |
2755 |
2766 |
2756 if( index) |
2767 |
2757 { |
2768 |
2758 |
2769 TLiwVariant TrueCourse ; |
2759 |
2770 index = LocMap->FindL( _L8("TrueCourse") , TrueCourse ) ; |
2760 TReal heading = TrueCourseError.AsTReal() ; |
2771 |
2761 data.Num(heading , format); |
2772 if( index) |
2762 |
2773 { |
2763 LogFile.Write(_L8("\ncompass information")) ; |
2774 |
2764 |
2775 |
2765 LogFile.Write(_L8("\nMagneticHeading Error")) ; |
2776 TReal heading = TrueCourse.AsTReal() ; |
2766 LogFile.Write(data) ; |
2777 data.Num(heading , format); |
2767 |
2778 |
2768 } |
2779 LogFile.Write(_L8("\nDirection ")) ; |
2769 |
2780 |
2770 |
2781 LogFile.Write(_L8("\n TrueCourse Error")) ; |
2771 } |
2782 LogFile.Write(data) ; |
2772 |
2783 |
2773 |
2784 |
2774 TLiwVariant MagneticCourse ; |
2785 |
2775 index = LocMap->FindL(_L8("MagneticCourse") , MagneticCourse ) ; |
2786 TLiwVariant TrueCourseError ; |
2776 |
2787 index = LocMap->FindL( _L8("TrueCourseError") , TrueCourseError ) ; |
2777 |
2788 |
2778 if(index) |
2789 if( index) |
2779 { |
2790 { |
2780 |
2791 |
2781 TReal heading = MagneticCourse.AsTReal() ; |
2792 |
2782 data.Num(heading , format); |
2793 TReal heading = TrueCourseError.AsTReal() ; |
2783 |
2794 data.Num(heading , format); |
2784 LogFile.Write(_L8("\ncompass information")) ; |
2795 |
2785 |
2796 LogFile.Write(_L8("\ncompass information")) ; |
2786 LogFile.Write(_L8("\nMagneticCourse ")) ; |
2797 |
2787 LogFile.Write(data) ; |
2798 LogFile.Write(_L8("\nMagneticHeading Error")) ; |
2788 |
2799 LogFile.Write(data) ; |
2789 |
2800 |
2790 |
2801 } |
2791 TLiwVariant MagneticCourseError ; |
2802 |
2792 index = LocMap->FindL(_L8("MagneticCourseError") ,MagneticCourseError ) ; |
2803 |
2793 |
2804 } |
2794 if( index) |
2805 |
2795 { |
2806 |
2796 |
2807 TLiwVariant MagneticCourse ; |
2797 |
2808 index = LocMap->FindL(_L8("MagneticCourse") , MagneticCourse ) ; |
2798 TReal heading = MagneticCourseError.AsTReal() ; |
2809 |
2799 data.Num(heading , format); |
2810 |
2800 |
2811 if(index) |
2801 LogFile.Write(_L8("\ncompass information")) ; |
2812 { |
2802 |
2813 |
2803 LogFile.Write(_L8("\n MagneticCourseError Error")) ; |
2814 TReal heading = MagneticCourse.AsTReal() ; |
2804 LogFile.Write(data) ; |
2815 data.Num(heading , format); |
2805 |
2816 |
2806 } |
2817 LogFile.Write(_L8("\ncompass information")) ; |
2807 |
2818 |
2808 |
2819 LogFile.Write(_L8("\nMagneticCourse ")) ; |
2809 } |
2820 LogFile.Write(data) ; |
2810 |
2821 |
2811 |
2822 |
2812 |
2823 |
2813 TLiwVariant NmeaNum ; |
2824 TLiwVariant MagneticCourseError ; |
2814 index = LocMap->FindL(_L8("NMEASentence") , NmeaNum ) ; |
2825 index = LocMap->FindL(_L8("MagneticCourseError") ,MagneticCourseError ) ; |
2815 |
2826 |
2816 |
2827 if( index) |
2817 if(index) |
2828 { |
2818 { |
2829 |
2819 |
2830 |
2820 TInt32 NMEASentence = NmeaNum.AsTInt32() ; |
2831 TReal heading = MagneticCourseError.AsTReal() ; |
2821 data.Num(NMEASentence , format); |
2832 data.Num(heading , format); |
2822 |
2833 |
2823 LogFile.Write(_L8("\nNMEA Information")) ; |
2834 LogFile.Write(_L8("\ncompass information")) ; |
2824 |
2835 |
2825 LogFile.Write(_L8("\n number of NMEA Sentences ")) ; |
2836 LogFile.Write(_L8("\n MagneticCourseError Error")) ; |
2826 LogFile.Write(data) ; |
2837 LogFile.Write(data) ; |
2827 |
2838 |
2828 index = 0 ; |
2839 } |
2829 |
2840 |
2830 const TLiwGenericParam *MagneticCourseError = outputlist->FindFirst(index , _L8("NMEASentenceStart") ) ; |
2841 |
2831 |
2842 } |
2832 if(-1 != index) |
2843 |
2833 { |
2844 |
2834 Variant = MagneticCourseError->Value() ; |
2845 |
2835 |
2846 TLiwVariant NmeaNum ; |
2836 |
2847 index = LocMap->FindL(_L8("NMEASentence") , NmeaNum ) ; |
2837 } |
2848 |
2838 |
2849 |
2839 |
2850 if(index) |
2840 } |
2851 { |
2841 |
2852 |
2842 |
2853 TInt32 NMEASentence = NmeaNum.AsTInt32() ; |
2843 LogFile.Close() ; |
2854 data.Num(NMEASentence , format); |
2844 LogSession.Close() ; |
2855 |
2845 |
2856 LogFile.Write(_L8("\nNMEA Information")) ; |
2846 locinterface->Close() ; |
2857 |
2847 delete ServiceHandler ; |
2858 LogFile.Write(_L8("\n number of NMEA Sentences ")) ; |
2848 a.ResetAndDestroy() ; |
2859 LogFile.Write(data) ; |
2849 a.Close() ; |
2860 |
2850 |
2861 index = 0 ; |
2851 __UHEAP_MARKEND ; |
2862 |
2852 return KErrNone ; |
2863 const TLiwGenericParam *MagneticCourseError = outputlist->FindFirst(index , _L8("NMEASentenceStart") ) ; |
2853 |
2864 |
2854 |
2865 if(-1 != index) |
2855 |
2866 { |
2856 } |
2867 Variant = MagneticCourseError->Value() ; |
|
2868 |
|
2869 |
|
2870 } |
|
2871 |
|
2872 |
|
2873 } |
|
2874 |
|
2875 |
|
2876 LogFile.Close() ; |
|
2877 LogSession.Close() ; |
|
2878 |
|
2879 locinterface->Close() ; |
|
2880 delete ServiceHandler ; |
|
2881 a.ResetAndDestroy() ; |
|
2882 a.Close() ; |
|
2883 |
|
2884 __UHEAP_MARKEND ; |
|
2885 return KErrNone ; |
|
2886 |
|
2887 |
|
2888 |
|
2889 } |
2857 |
2890 |
2858 |
2891 |
2859 TInt CTestProvider :: GetLocation(CStifItemParser & /*aItem */) |
2892 TInt CTestProvider :: GetLocation(CStifItemParser & /*aItem */) |
2860 { |
2893 { |
2861 __UHEAP_MARK ; |
2894 __UHEAP_MARK ; |
2862 TInt ret = CTestGetLocation() ; |
2895 TInt ret = CTestGetLocation() ; |
2863 __UHEAP_MARKEND ; |
2896 __UHEAP_MARKEND ; |
2864 return ret ; |
2897 return ret ; |
2865 |
2898 |
2866 } |
2899 } |
2867 |
2900 |
2868 |
2901 |
2869 TInt CTestProvider :: LocationUpdates(CStifItemParser& /*aItem*/) |
2902 TInt CTestProvider :: LocationUpdates(CStifItemParser& /*aItem*/) |
2870 { |
2903 { |
2871 _LIT(KTLocTest ,"TLocTest"); |
2904 _LIT(KTLocTest ,"TLocTest"); |
2872 iLog->Log(KTLocTest) ; |
2905 iLog->Log(KTLocTest) ; |
2873 |
2906 |
2874 TRequestStatus Status = KRequestPending ; |
2907 TRequestStatus Status = KRequestPending ; |
2875 RThread FunctionThread ; |
2908 RThread FunctionThread ; |
2876 |
2909 |
2877 TInt ret = FunctionThread.Create(_L(" LocationUpdates Thread") , GetLocUpdates ,KDefaultStackSize , |
2910 TInt ret = FunctionThread.Create(_L(" LocationUpdates Thread") , GetLocUpdates ,KDefaultStackSize , |
2878 KMinHeapSize , 0x5000 ,(TAny *) NULL); |
2911 KMinHeapSize , 0x5000 ,(TAny *) NULL); |
2879 |
2912 |
2880 if(!ret) |
2913 if(!ret) |
2881 { |
2914 { |
2882 FunctionThread.Logon(Status) ; |
2915 FunctionThread.Logon(Status) ; |
2883 FunctionThread.Resume() ; |
2916 FunctionThread.Resume() ; |
2884 |
2917 |
2885 User :: WaitForRequest (Status) ; |
2918 User :: WaitForRequest (Status) ; |
2886 FunctionThread.Close(); |
2919 FunctionThread.Close(); |
2887 |
2920 |
2888 ret = Status.Int() ; |
2921 ret = Status.Int() ; |
2889 } |
2922 } |
2890 return ret; |
2923 return ret; |
2891 } |
2924 } |
2892 #if 0 |
2925 #if 0 |
2893 TInt CTestProvider :: LastKnownLoc(CStifItemParser& /*aItem*/) |
2926 TInt CTestProvider :: LastKnownLoc(CStifItemParser& /*aItem*/) |
2894 { |
2927 { |
2895 return KErrNone ; |
2928 return KErrNone ; |
2896 } |
2929 } |
2897 #endif |
2930 #endif |
2898 |
2931 |
2899 TInt CTestProvider ::GetLocationAsynch(CStifItemParser& /*aItem*/) |
2932 TInt CTestProvider ::GetLocationAsynch(CStifItemParser& /*aItem*/) |
2900 { |
2933 { |
2901 |
2934 |
2902 |
2935 |
2903 TRequestStatus Status = KRequestPending ; |
2936 TRequestStatus Status = KRequestPending ; |
2904 RThread FunctionThread ; |
2937 RThread FunctionThread ; |
2905 |
2938 |
2906 FunctionThread.Create(_L("GetLocationAsynch Thread") , FindLocationAsynch ,KDefaultStackSize , |
2939 FunctionThread.Create(_L("GetLocationAsynch Thread") , FindLocationAsynch ,KDefaultStackSize , |
2907 KMinHeapSize , 0x5000 ,(TAny *) NULL); |
2940 KMinHeapSize , 0x5000 ,(TAny *) NULL); |
2908 |
2941 |
2909 FunctionThread.Logon(Status) ; |
2942 FunctionThread.Logon(Status) ; |
2910 FunctionThread.Resume() ; |
2943 FunctionThread.Resume() ; |
2911 |
2944 |
2912 User :: WaitForRequest (Status) ; |
2945 User :: WaitForRequest (Status) ; |
2913 FunctionThread.Close(); |
2946 FunctionThread.Close(); |
2914 |
2947 |
2915 return Status.Int() ; |
2948 return Status.Int() ; |
2916 |
2949 |
2917 |
2950 |
2918 } |
2951 } |
2919 |
2952 |
2920 |
2953 |
2921 TInt CTestProvider ::ServiceNotAvailable(CStifItemParser& /*aItem*/) |
2954 TInt CTestProvider ::ServiceNotAvailable(CStifItemParser& /*aItem*/) |
2922 { |
2955 { |
2923 |
2956 |
2924 |
2957 __UHEAP_MARK ; |
2925 |
2958 |
2926 _LIT8(KService, "Service.Location"); |
2959 _LIT8(KService, "Service.Location"); |
2927 _LIT8(KIDataSource,"ILocation"); |
2960 _LIT8(KIDataSource,"ILocation"); |
2928 |
2961 |
2929 return KErrNone ; //Manual test case |
2962 return KErrNone ; //Manual test case |
2930 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
2963 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
2931 |
2964 |
2932 // Input and output parameter list |
2965 // Input and output parameter list |
2933 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
2966 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
2934 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
2967 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
2935 |
2968 |
2936 |
2969 |
2937 |
2970 |
2938 |
2971 |
2939 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KService, KIDataSource); |
2972 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KService, KIDataSource); |
2940 |
2973 |
2941 |
2974 |
2942 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
2975 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
2943 |
2976 |
2944 RCriteriaArray a; |
2977 RCriteriaArray a; |
2945 a.AppendL(crit); |
2978 a.AppendL(crit); |
2946 |
2979 |
2947 ServiceHandler->AttachL(a) ; |
2980 ServiceHandler->AttachL(a) ; |
2948 |
2981 |
2949 |
2982 |
2950 |
2983 |
2951 |
2984 |
2952 |
2985 |
2953 TInt pos = 0; |
2986 TInt pos = 0; |
2954 |
2987 |
2955 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
2988 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
2956 |
2989 |
2957 if(!errorprm) |
2990 if(!errorprm) |
2958 { |
2991 { |
2959 _LIT(Klog , "Success/Failure error code missing from outputlist") ; |
2992 _LIT(Klog , "Success/Failure error code missing from outputlist") ; |
2960 iLog->Log(Klog) ; |
2993 iLog->Log(Klog) ; |
2961 return KErrGeneral ; |
2994 return KErrGeneral ; |
2962 } |
2995 } |
2963 |
2996 |
2964 |
2997 |
2965 _LIT8(KDataSource, "ILocation"); |
2998 _LIT8(KDataSource, "ILocation"); |
2966 |
2999 |
2967 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); |
3000 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); |
2968 |
3001 |
2969 if(!genericparm) |
3002 if(!genericparm) |
2970 { |
3003 { |
2971 _LIT(KLog , "Interface not found"); |
3004 _LIT(KLog , "Interface not found"); |
2972 iLog->Log(KLog) ; |
3005 iLog->Log(KLog) ; |
2973 return KErrGeneral ; |
3006 return KErrGeneral ; |
2974 } |
3007 } |
2975 |
3008 |
2976 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
3009 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
2977 |
3010 |
2978 |
3011 |
2979 TInt result = KErrGeneral ; |
3012 TInt result = KErrGeneral ; |
2980 TInt error ; |
3013 TInt error ; |
2981 TInt index = 0; |
3014 TInt index = 0; |
2982 |
3015 |
2983 |
3016 |
2984 // CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; |
3017 // CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; |
2985 TBuf8<20>CmdBuf(KCmdGetLocation) ; |
3018 TBuf8<20>CmdBuf(KCmdGetLocation) ; |
2986 CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; |
3019 CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; |
2987 |
3020 |
2988 locinterface->ExecuteCmdL(CmdBuf , *InputList , *InputList ); |
3021 locinterface->ExecuteCmdL(CmdBuf , *InputList , *InputList ); |
2989 const TLiwGenericParam *GenericParam = InputList->FindFirst(index , KErrorCode ) ; |
3022 const TLiwGenericParam *GenericParam = InputList->FindFirst(index , KErrorCode ) ; |
2990 |
3023 |
2991 if(GenericParam) |
3024 if(GenericParam) |
2992 { |
3025 { |
2993 TLiwVariant ErrorVariant = GenericParam->Value() ; |
3026 TLiwVariant ErrorVariant = GenericParam->Value() ; |
2994 |
3027 |
2995 error = ErrorVariant.AsTInt32(); |
3028 error = ErrorVariant.AsTInt32(); |
2996 } |
3029 } |
2997 |
3030 |
2998 if((error == KErrNotFound ) || (error == KPositionQualityLoss)) |
3031 if((error == KErrNotFound ) || (error == KPositionQualityLoss)) |
2999 { |
3032 { |
3000 _LIT(KLog , "positioning technology not available") ; |
3033 _LIT(KLog , "positioning technology not available") ; |
3001 iLog->Log(KLog) ; |
3034 iLog->Log(KLog) ; |
3002 result = KErrNone ; |
3035 result = KErrNone ; |
3003 } |
3036 } |
3004 |
3037 |
3005 |
3038 |
3006 locinterface->Close() ; |
3039 locinterface->Close() ; |
3007 delete InputList ; |
3040 delete InputList ; |
3008 delete ServiceHandler ; |
3041 delete ServiceHandler ; |
3009 |
3042 |
3010 a.ResetAndDestroy() ; |
3043 a.ResetAndDestroy() ; |
3011 // delete OutParmList ; |
3044 // delete OutParmList ; |
3012 |
3045 __UHEAP_MARKEND ; |
3013 return result ; |
3046 return result ; |
3014 |
3047 |
3015 } |
3048 } |
3016 |
3049 |
3017 |
3050 |
3018 |
3051 |
3019 /* |
3052 /* |
3020 * This is a manual test case were the service was available when the |
3053 * This is a manual test case were the service was available when the |
3021 * request was made and then Lost the service (Contact to location servier lost |
3054 * request was made and then Lost the service (Contact to location servier lost |
3022 */ |
3055 */ |
3023 |
3056 |
3024 |
3057 |
3025 TInt CTestProvider :: ServiceFailed(CStifItemParser& /*aItem*/) |
3058 TInt CTestProvider :: ServiceFailed(CStifItemParser& /*aItem*/) |
3026 { |
3059 { |
3027 _LIT(KTLocTest ,"TLocTest"); |
3060 _LIT(KTLocTest ,"TLocTest"); |
3028 iLog->Log(KTLocTest) ; |
3061 iLog->Log(KTLocTest) ; |
3029 _LIT(KLog , "In service failed test ") ; |
3062 _LIT(KLog , "In service failed test ") ; |
3030 iLog->Log(KTLocTest) ; |
3063 iLog->Log(KTLocTest) ; |
3031 |
3064 |
3032 return KErrNone ; //Manual test case |
3065 return KErrNone ; //Manual test case |
3033 TRequestStatus Status = KRequestPending ; |
3066 TRequestStatus Status = KRequestPending ; |
3034 RThread FunctionThread ; |
3067 RThread FunctionThread ; |
3035 |
3068 |
3036 TInt ret = FunctionThread.Create(_L("ServiceFailed Thread") , ServiceFailedTest ,KDefaultStackSize , |
3069 TInt ret = FunctionThread.Create(_L("ServiceFailed Thread") , ServiceFailedTest ,KDefaultStackSize , |
3037 KMinHeapSize , 0x5000 ,(TAny *) NULL);; |
3070 KMinHeapSize , 0x5000 ,(TAny *) NULL);; |
3038 |
3071 |
3039 if(!ret) |
3072 if(!ret) |
3040 { |
3073 { |
3041 |
3074 |
3042 _LIT(Klog , "Created the thread ") ; |
3075 _LIT(Klog , "Created the thread ") ; |
3043 iLog->Log(Klog) ; |
3076 iLog->Log(Klog) ; |
3044 FunctionThread.Logon(Status) ; |
3077 FunctionThread.Logon(Status) ; |
3045 FunctionThread.Resume() ; |
3078 FunctionThread.Resume() ; |
3046 |
3079 |
3047 User :: WaitForRequest (Status) ; |
3080 User :: WaitForRequest (Status) ; |
3048 FunctionThread.Close(); |
3081 FunctionThread.Close(); |
3049 |
3082 |
3050 ret = Status.Int() ; |
3083 ret = Status.Int() ; |
3051 } |
3084 } |
3052 |
3085 |
3053 |
3086 |
3054 if((ret == KErrNotFound ) || (ret == KPositionQualityLoss)) |
3087 if((ret == KErrNotFound ) || (ret == KPositionQualityLoss)) |
3055 { |
3088 { |
3056 _LIT(KLog , "Service provider crashed or went dowm") ; |
3089 _LIT(KLog , "Service provider crashed or went dowm") ; |
3057 iLog->Log(KLog) ; |
3090 iLog->Log(KLog) ; |
3058 } |
3091 } |
3059 |
3092 |
3060 |
3093 |
3061 return ret; |
3094 return ret; |
3062 } |
3095 } |
3063 |
3096 |
3064 |
3097 |
3065 |
3098 |
3066 /** |
3099 /** |
3067 *Stray signal test, tests for any unhandled events from location server |
3100 *Stray signal test, tests for any unhandled events from location server |
3068 */ |
3101 */ |
3069 |
3102 |
3070 TInt CTestProvider :: StraySignal(CStifItemParser& /*aItem*/) |
3103 TInt CTestProvider :: StraySignal(CStifItemParser& /*aItem*/) |
3071 { |
3104 { |
3072 _LIT(KTLocTest ,"TLocTest"); |
3105 _LIT(KTLocTest ,"TLocTest"); |
3073 iLog->Log(KTLocTest) ; |
3106 iLog->Log(KTLocTest) ; |
3074 _LIT(KLog , "StraySignalTest ") ; |
3107 _LIT(KLog , "StraySignalTest ") ; |
3075 iLog->Log(KTLocTest) ; |
3108 iLog->Log(KTLocTest) ; |
3076 |
3109 |
3077 TRequestStatus Status = KRequestPending ; |
3110 TRequestStatus Status = KRequestPending ; |
3078 RThread FunctionThread ; |
3111 RThread FunctionThread ; |
3079 |
3112 |
3080 TInt ret = FunctionThread.Create(_L("stray signal") , StrayTest ,KDefaultStackSize , |
3113 TInt ret = FunctionThread.Create(_L("stray signal") , StrayTest ,KDefaultStackSize , |
3081 KMinHeapSize , 0x5000 ,(TAny *) NULL);; |
3114 KMinHeapSize , 0x5000 ,(TAny *) NULL);; |
3082 |
3115 |
3083 if(!ret) |
3116 if(!ret) |
3084 { |
3117 { |
3085 |
3118 |
3086 _LIT(Klog , "Created the thread ") ; |
3119 _LIT(Klog , "Created the thread ") ; |
3087 iLog->Log(Klog) ; |
3120 iLog->Log(Klog) ; |
3088 FunctionThread.Logon(Status) ; |
3121 FunctionThread.Logon(Status) ; |
3089 FunctionThread.Resume() ; |
3122 FunctionThread.Resume() ; |
3090 |
3123 |
3091 User :: WaitForRequest (Status) ; |
3124 User :: WaitForRequest (Status) ; |
3092 FunctionThread.Close(); |
3125 FunctionThread.Close(); |
3093 |
3126 |
3094 ret = Status.Int() ; |
3127 ret = Status.Int() ; |
3095 } |
3128 } |
3096 |
3129 |
3097 return ret; |
3130 return ret; |
3098 } |
3131 } |
3099 |
3132 |
3100 |
3133 |
3101 |
3134 |
3102 TInt CTestProvider :: StraySignalGetLoc(CStifItemParser& /*aItem*/) |
3135 TInt CTestProvider :: StraySignalGetLoc(CStifItemParser& /*aItem*/) |
3103 { |
3136 { |
3104 _LIT(KTLocTest ,"TLocTest"); |
3137 _LIT(KTLocTest ,"TLocTest"); |
3105 iLog->Log(KTLocTest) ; |
3138 iLog->Log(KTLocTest) ; |
3106 _LIT(KLog , "StraySignalTestGetLoc ") ; |
3139 _LIT(KLog , "StraySignalTestGetLoc ") ; |
3107 iLog->Log(KTLocTest) ; |
3140 iLog->Log(KTLocTest) ; |
3108 |
3141 |
3109 TRequestStatus Status = KRequestPending ; |
3142 TRequestStatus Status = KRequestPending ; |
3110 RThread FunctionThread ; |
3143 RThread FunctionThread ; |
3111 |
3144 |
3112 TInt ret = FunctionThread.Create(_L("stray signal GetLocation") , StrayTestGetLoc ,KDefaultStackSize , |
3145 TInt ret = FunctionThread.Create(_L("stray signal GetLocation") , StrayTestGetLoc ,KDefaultStackSize , |
3113 KMinHeapSize , 0x5000 ,(TAny *) NULL);; |
3146 KMinHeapSize , 0x5000 ,(TAny *) NULL);; |
3114 |
3147 |
3115 if(!ret) |
3148 if(!ret) |
3116 { |
3149 { |
3117 |
3150 |
3118 _LIT(Klog , "Created the thread ") ; |
3151 _LIT(Klog , "Created the thread ") ; |
3119 iLog->Log(Klog) ; |
3152 iLog->Log(Klog) ; |
3120 FunctionThread.Logon(Status) ; |
3153 FunctionThread.Logon(Status) ; |
3121 FunctionThread.Resume() ; |
3154 FunctionThread.Resume() ; |
3122 |
3155 |
3123 User :: WaitForRequest (Status) ; |
3156 User :: WaitForRequest (Status) ; |
3124 FunctionThread.Close(); |
3157 FunctionThread.Close(); |
3125 |
3158 |
3126 ret = Status.Int() ; |
3159 ret = Status.Int() ; |
3127 } |
3160 } |
3128 |
3161 |
3129 |
3162 |
3130 return ret; |
3163 return ret; |
3131 } |
3164 } |
3132 |
3165 |
3133 TInt CTestProvider :: ConcurrentCallsGetLoc (CStifItemParser& /*aItem*/) |
3166 TInt CTestProvider :: ConcurrentCallsGetLoc (CStifItemParser& /*aItem*/) |
3134 { |
3167 { |
3135 _LIT(KTLocTest ,"TLocTest"); |
3168 _LIT(KTLocTest ,"TLocTest"); |
3136 iLog->Log(KTLocTest) ; |
3169 iLog->Log(KTLocTest) ; |
3137 |
3170 |
3138 TRequestStatus Status = KRequestPending ; |
3171 TRequestStatus Status = KRequestPending ; |
3139 RThread FunctionThread ; |
3172 RThread FunctionThread ; |
3140 |
3173 |
3141 TInt ret = FunctionThread.Create(_L(" ConcurrentCallsGetLoc Thread") , ConcurrentGetLocationCalls ,KDefaultStackSize , |
3174 TInt ret = FunctionThread.Create(_L(" ConcurrentCallsGetLoc Thread") , ConcurrentGetLocationCalls ,KDefaultStackSize , |
3142 KMinHeapSize , 0x5000 ,(TAny *) NULL); |
3175 KMinHeapSize , 0x5000 ,(TAny *) NULL); |
3143 |
3176 |
3144 if(ret == KErrNone) |
3177 if(ret == KErrNone) |
3145 { |
3178 { |
3146 FunctionThread.Logon(Status) ; |
3179 FunctionThread.Logon(Status) ; |
3147 FunctionThread.Resume() ; |
3180 FunctionThread.Resume() ; |
3148 |
3181 |
3149 User :: WaitForRequest (Status) ; |
3182 User :: WaitForRequest (Status) ; |
3150 |
3183 |
3151 |
3184 |
3152 ret = Status.Int() ; |
3185 ret = Status.Int() ; |
3153 } |
3186 } |
3154 FunctionThread.Close(); |
3187 FunctionThread.Close(); |
3155 |
3188 |
3156 if(ret == SErrServiceInUse) |
3189 if(ret == SErrServiceInUse) |
3157 return KErrNone ; |
3190 return KErrGeneral ; |
3158 |
3191 |
3159 return KErrGeneral; |
3192 return KErrNone; |
3160 } |
3193 } |
3161 |
3194 |
3162 |
3195 |
3163 TInt CTestProvider :: ConcurrentCallsTrace (CStifItemParser& /*aItem*/) |
3196 TInt CTestProvider :: ConcurrentCallsTrace (CStifItemParser& /*aItem*/) |
3164 { |
3197 { |
3165 _LIT(KTLocTest ,"TLocTest"); |
3198 _LIT(KTLocTest ,"TLocTest"); |
3166 iLog->Log(KTLocTest) ; |
3199 iLog->Log(KTLocTest) ; |
3167 |
3200 |
3168 TRequestStatus Status = KRequestPending ; |
3201 TRequestStatus Status = KRequestPending ; |
3169 RThread FunctionThread ; |
3202 RThread FunctionThread ; |
3170 |
3203 |
3171 TInt ret = FunctionThread.Create(_L(" ConcurrentCallsGetLoc Thread") , TraceConcurrent ,KDefaultStackSize , |
3204 TInt ret = FunctionThread.Create(_L(" ConcurrentCallsGetLoc Thread") , TraceConcurrent ,KDefaultStackSize , |
3172 KMinHeapSize , 0x5000 ,(TAny *) NULL); |
3205 KMinHeapSize , 0x5000 ,(TAny *) NULL); |
3173 |
3206 |
3174 if(ret == KErrNone) |
3207 if(ret == KErrNone) |
3175 { |
3208 { |
3176 FunctionThread.Logon(Status) ; |
3209 FunctionThread.Logon(Status) ; |
3177 FunctionThread.Resume() ; |
3210 FunctionThread.Resume() ; |
3178 |
3211 |
3179 User :: WaitForRequest (Status) ; |
3212 User :: WaitForRequest (Status) ; |
3180 |
3213 |
3181 |
3214 |
3182 ret = Status.Int() ; |
3215 ret = Status.Int() ; |
3183 } |
3216 } |
3184 FunctionThread.Close(); |
3217 FunctionThread.Close(); |
3185 |
3218 |
3186 if(ret == SErrServiceInUse) |
3219 if(ret == SErrServiceInUse) |
3187 { |
3220 { |
3188 _LIT(KLog , "Return Type is valid"); |
3221 _LIT(KLog , "Return Type is valid"); |
3189 iLog->Log(KLog); |
3222 iLog->Log(KLog); |
3190 } |
3223 } |
3191 |
3224 |
3192 else |
3225 else |
3193 { |
3226 { |
3194 _LIT(KLog , "Return type is not valid\n") ; |
3227 _LIT(KLog , "Return type is not valid\n") ; |
3195 iLog->Log(KLog) ; |
3228 iLog->Log(KLog) ; |
3196 } |
3229 } |
3197 return KErrNone ; |
3230 return KErrNone ; |
3198 |
3231 |
3199 return KErrGeneral; |
3232 return KErrGeneral; |
3200 } |
3233 } |
3201 |
3234 |
3202 |
3235 |
3203 /** |
3236 /** |
3204 *Cancel test, to test cancel functionality |
3237 *Cancel test, to test cancel functionality |
3205 */ |
3238 */ |
3206 TInt CTestProvider :: EmptyCancelTraceTest(CStifItemParser& /*aItem*/) |
3239 TInt CTestProvider :: EmptyCancelTraceTest(CStifItemParser& /*aItem*/) |
3207 { |
3240 { |
3208 __UHEAP_MARK ; |
3241 __UHEAP_MARK ; |
3209 _LIT(KLog , "CancellTest") ; |
3242 _LIT(KLog , "CancellTest") ; |
3210 |
3243 |
3211 |
3244 |
3212 iLog->Log(KLog) ; |
3245 iLog->Log(KLog) ; |
3213 |
3246 |
3214 |
3247 |
3215 |
3248 |
3216 |
3249 |
3217 |
3250 |
3218 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
3251 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
3219 |
3252 |
3220 // Input and output parameter list |
3253 // Input and output parameter list |
3221 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
3254 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
3222 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
3255 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
3223 |
3256 |
3224 |
3257 |
3225 |
3258 |
3226 |
3259 |
3227 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); |
3260 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); |
3228 |
3261 |
3229 |
3262 |
3230 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
3263 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
3231 |
3264 |
3232 RCriteriaArray a; |
3265 RCriteriaArray a; |
3233 a.AppendL(crit); |
3266 a.AppendL(crit); |
3234 |
3267 |
3235 ServiceHandler->AttachL(a) ; |
3268 ServiceHandler->AttachL(a) ; |
3236 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
3269 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
3237 |
3270 |
3238 |
3271 |
3239 |
3272 |
3240 |
3273 |
3241 TInt pos = 0; |
3274 TInt pos = 0; |
3242 |
3275 |
3243 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
3276 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
3244 |
3277 |
3245 if(!errorprm) |
3278 if(!errorprm) |
3246 { |
3279 { |
3247 return KErrGeneral ; |
3280 return KErrGeneral ; |
3248 } |
3281 } |
3249 |
3282 |
3250 pos = 0 ; |
3283 pos = 0 ; |
3251 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); |
3284 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); |
3252 |
3285 |
3253 if(!genericparm) |
3286 if(!genericparm) |
3254 { |
3287 { |
3255 |
3288 |
3256 return KErrGeneral ; |
3289 return KErrGeneral ; |
3257 } |
3290 } |
3258 |
3291 |
3259 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
3292 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
3260 |
3293 |
3261 _LIT8(KCancell , "CancelNotification") ; |
3294 _LIT8(KCancell , "CancelNotification") ; |
3262 _LIT8( KType ,"CancelRequestType") ; |
3295 _LIT8( KType ,"CancelRequestType") ; |
3263 _LIT8( KTraceCancel ,"TraceCancel") ; |
3296 _LIT8( KTraceCancel ,"TraceCancel") ; |
3264 inputlist->AppendL(TLiwGenericParam (KType , TLiwVariant (KTraceCancel))) ; |
3297 inputlist->AppendL(TLiwGenericParam (KType , TLiwVariant (KTraceCancel))) ; |
3265 |
3298 |
3266 locinterface->ExecuteCmdL(KCancell , *inputlist , *outputlist) ; |
3299 locinterface->ExecuteCmdL(KCancell , *inputlist , *outputlist) ; |
3267 |
3300 |
3268 pos = 0 ; |
3301 pos = 0 ; |
3269 const TLiwGenericParam *errprm = outputlist->FindFirst(pos , KErrCode) ; |
3302 const TLiwGenericParam *errprm = outputlist->FindFirst(pos , KErrCode) ; |
3270 |
3303 |
3271 if(!errprm) |
3304 if(!errprm) |
3272 { |
3305 { |
3273 _LIT(Kerr, "Success/Failure code missing from outputlist") ; |
3306 _LIT(Kerr, "Success/Failure code missing from outputlist") ; |
3274 iLog->Log(Kerr) ; |
3307 iLog->Log(Kerr) ; |
3275 } |
3308 } |
3276 |
3309 |
3277 |
3310 |
3278 TInt ret = KErrGeneral ; //Return Code |
3311 TInt ret = KErrGeneral ; //Return Code |
3279 TLiwVariant var = errprm->Value() ; |
3312 TLiwVariant var = errprm->Value() ; |
3280 |
3313 |
3281 if(var.AsTInt32() == SErrBadArgumentType ) |
3314 if(var.AsTInt32() == SErrBadArgumentType ) |
3282 { |
3315 { |
3283 ret= KErrNone ; |
3316 ret= KErrNone ; |
3284 } |
3317 } |
3285 else |
3318 else |
3286 { |
3319 { |
3287 _LIT(KDebugMsg , "Return and expected values are different") ; |
3320 _LIT(KDebugMsg , "Return and expected values are different") ; |
3288 iLog->Log(KDebugMsg) ; |
3321 iLog->Log(KDebugMsg) ; |
3289 } |
3322 } |
3290 |
3323 |
3291 locinterface->Close() ; |
3324 locinterface->Close() ; |
3292 delete ServiceHandler ; |
3325 delete ServiceHandler ; |
3293 a.ResetAndDestroy() ; |
3326 a.ResetAndDestroy() ; |
3294 a.Close() ; |
3327 a.Close() ; |
3295 |
3328 |
3296 __UHEAP_MARKEND ; |
3329 __UHEAP_MARKEND ; |
3297 |
3330 |
3298 |
3331 |
3299 |
3332 |
3300 |
3333 |
3301 return ret ; |
3334 return ret ; |
3302 |
3335 |
3303 } |
3336 } |
3304 |
3337 |
3305 /** |
3338 /** |
3306 *Cancel test, to test cancel functionality |
3339 *Cancel test, to test cancel functionality |
3307 */ |
3340 */ |
3308 TInt CTestProvider :: EmptyCancelGetLocTest(CStifItemParser& /*aItem*/) |
3341 TInt CTestProvider :: EmptyCancelGetLocTest(CStifItemParser& /*aItem*/) |
3309 { |
3342 { |
3310 _LIT(KLog , "CancellTest") ; |
3343 _LIT(KLog , "CancellTest") ; |
3311 iLog->Log(KLog) ; |
3344 iLog->Log(KLog) ; |
3312 |
3345 |
3313 __UHEAP_MARK ; |
3346 __UHEAP_MARK ; |
3314 |
3347 |
3315 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
3348 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
3316 |
3349 |
3317 // Input and output parameter list |
3350 // Input and output parameter list |
3318 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
3351 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
3319 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
3352 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
3320 |
3353 |
3321 |
3354 |
3322 |
3355 |
3323 |
3356 |
3324 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); |
3357 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); |
3325 |
3358 |
3326 |
3359 |
3327 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
3360 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
3328 |
3361 |
3329 RCriteriaArray a; |
3362 RCriteriaArray a; |
3330 a.AppendL(crit); |
3363 a.AppendL(crit); |
3331 |
3364 |
3332 ServiceHandler->AttachL(a) ; |
3365 ServiceHandler->AttachL(a) ; |
3333 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
3366 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
3334 |
3367 |
3335 |
3368 |
3336 |
3369 |
3337 |
3370 |
3338 TInt pos = 0; |
3371 TInt pos = 0; |
3339 |
3372 |
3340 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
3373 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
3341 |
3374 |
3342 if(!errorprm) |
3375 if(!errorprm) |
3343 { |
3376 { |
3344 return KErrGeneral ; |
3377 return KErrGeneral ; |
3345 } |
3378 } |
3346 |
3379 |
3347 pos = 0 ; |
3380 pos = 0 ; |
3348 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); |
3381 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); |
3349 |
3382 |
3350 if(!genericparm) |
3383 if(!genericparm) |
3351 { |
3384 { |
3352 |
3385 |
3353 return KErrGeneral ; |
3386 return KErrGeneral ; |
3354 } |
3387 } |
3355 |
3388 |
3356 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
3389 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
3357 |
3390 |
3358 |
3391 |
3359 |
3392 |
3360 |
3393 |
3361 _LIT8(KCancell , "CancelNotification") ; |
3394 _LIT8(KCancell , "CancelNotification") ; |
3362 _LIT8( KType ,"CancelRequestType") ; |
3395 _LIT8( KType ,"CancelRequestType") ; |
3363 _LIT8( KGetLocCancel ,"GetLocCancel") ; |
3396 _LIT8( KGetLocCancel ,"GetLocCancel") ; |
3364 inputlist->AppendL(TLiwGenericParam (KType , TLiwVariant (KGetLocCancel))) ; |
3397 inputlist->AppendL(TLiwGenericParam (KType , TLiwVariant (KGetLocCancel))) ; |
3365 |
3398 |
3366 locinterface->ExecuteCmdL(KCancell , *inputlist , *outputlist) ; |
3399 locinterface->ExecuteCmdL(KCancell , *inputlist , *outputlist) ; |
3367 |
3400 |
3368 pos = 0 ; |
3401 pos = 0 ; |
3369 const TLiwGenericParam *errprm = outputlist->FindFirst(pos , KErrCode) ; |
3402 const TLiwGenericParam *errprm = outputlist->FindFirst(pos , KErrCode) ; |
3370 |
3403 |
3371 if(!errprm) |
3404 if(!errprm) |
3372 { |
3405 { |
3373 _LIT(Kerr, "Success/Failure code missing from outputlist") ; |
3406 _LIT(Kerr, "Success/Failure code missing from outputlist") ; |
3374 iLog->Log(Kerr) ; |
3407 iLog->Log(Kerr) ; |
3375 } |
3408 } |
3376 |
3409 |
3377 |
3410 |
3378 TInt ret = KErrGeneral ; |
3411 TInt ret = KErrGeneral ; |
3379 |
3412 |
3380 if((errprm->Value()).AsTInt32() == SErrBadArgumentType) |
3413 if((errprm->Value()).AsTInt32() == SErrBadArgumentType) |
3381 { |
3414 { |
3382 ret = KErrNone ; |
3415 ret = KErrNone ; |
3383 } |
3416 } |
3384 |
3417 |
3385 locinterface->Close() ; |
3418 locinterface->Close() ; |
3386 |
3419 |
3387 //delete inlist ; |
3420 //delete inlist ; |
3388 //Sdelete outlist ; |
3421 //Sdelete outlist ; |
3389 delete ServiceHandler ; |
3422 delete ServiceHandler ; |
3390 a.ResetAndDestroy() ; |
3423 a.ResetAndDestroy() ; |
3391 a.Close() ; |
3424 a.Close() ; |
3392 __UHEAP_MARKEND ; |
3425 __UHEAP_MARKEND ; |
3393 |
3426 |
3394 return ret ; |
3427 return ret ; |
3395 |
3428 |
3396 } |
3429 } |
3397 |
3430 |
3398 /** |
3431 /** |
3399 *Cancel test, with wrong notification |
3432 *Cancel test, with wrong notification |
3400 */ |
3433 */ |
3401 TInt CTestProvider :: CancelWrongNotification1(CStifItemParser& /*aItem*/) |
3434 TInt CTestProvider :: CancelWrongNotification1(CStifItemParser& /*aItem*/) |
3402 { |
3435 { |
3403 |
3436 |
3404 |
3437 |
3405 _LIT(KTLocTest ,"TLocTest"); |
3438 _LIT(KTLocTest ,"TLocTest"); |
3406 iLog->Log(KTLocTest) ; |
3439 iLog->Log(KTLocTest) ; |
3407 _LIT(KLog , "StraySignalTest ") ; |
3440 _LIT(KLog , "StraySignalTest ") ; |
3408 iLog->Log(KTLocTest) ; |
3441 iLog->Log(KTLocTest) ; |
3409 |
3442 |
3410 TRequestStatus Status = KRequestPending ; |
3443 TRequestStatus Status = KRequestPending ; |
3411 RThread FunctionThread ; |
3444 RThread FunctionThread ; |
3412 |
3445 |
3413 TInt ret = FunctionThread.Create(_L("Wrong Notification GetLoc cancel") , GetLocWrongCancel ,KDefaultStackSize , |
3446 TInt ret = FunctionThread.Create(_L("Wrong Notification GetLoc cancel") , GetLocWrongCancel ,KDefaultStackSize , |
3414 KMinHeapSize , 0x5000 ,(TAny *) NULL);; |
3447 KMinHeapSize , 0x5000 ,(TAny *) NULL);; |
3415 |
3448 |
3416 if(!ret) |
3449 if(!ret) |
3417 { |
3450 { |
3418 |
3451 |
3419 _LIT(Klog , "Created the thread ") ; |
3452 _LIT(Klog , "Created the thread ") ; |
3420 iLog->Log(Klog) ; |
3453 iLog->Log(Klog) ; |
3421 FunctionThread.Logon(Status) ; |
3454 FunctionThread.Logon(Status) ; |
3422 FunctionThread.Resume() ; |
3455 FunctionThread.Resume() ; |
3423 |
3456 |
3424 User :: WaitForRequest (Status) ; |
3457 User :: WaitForRequest (Status) ; |
3425 FunctionThread.Close(); |
3458 FunctionThread.Close(); |
3426 |
3459 |
3427 ret = Status.Int() ; |
3460 ret = Status.Int() ; |
3428 } |
3461 } |
3429 else |
3462 else |
3430 { |
3463 { |
3431 return ret ; |
3464 return ret ; |
3432 } |
3465 } |
3433 |
3466 |
3434 if(ret == SErrBadArgumentType) |
3467 if(ret == SErrBadArgumentType) |
3435 { |
3468 { |
3436 ret = KErrNone ; |
3469 ret = KErrNone ; |
3437 } |
3470 } |
3438 /*else |
3471 /*else |
3439 { |
3472 { |
3440 ret = KErrGeneral ; |
3473 ret = KErrGeneral ; |
3441 } */ |
3474 } */ |
3442 return ret; |
3475 return ret; |
3443 } |
3476 } |
3444 |
3477 |
3445 |
3478 |
3446 |
3479 |
3447 /** |
3480 /** |
3448 *Cancel test, with wrong notification issues a Trace request and then calls for getlocation |
3481 *Cancel test, with wrong notification issues a Trace request and then calls for getlocation |
3449 * cancellation |
3482 * cancellation |
3450 */ |
3483 */ |
3451 TInt CTestProvider :: CancelWrongNotification2(CStifItemParser& /*aItem*/) |
3484 TInt CTestProvider :: CancelWrongNotification2(CStifItemParser& /*aItem*/) |
3452 { |
3485 { |
3453 |
3486 |
3454 |
3487 |
3455 _LIT(KTLocTest ,"TLocTest"); |
3488 _LIT(KTLocTest ,"TLocTest"); |
3456 iLog->Log(KTLocTest) ; |
3489 iLog->Log(KTLocTest) ; |
3457 _LIT(KLog , "CancelWrongNotification2 ") ; |
3490 _LIT(KLog , "CancelWrongNotification2 ") ; |
3458 iLog->Log(KTLocTest) ; |
3491 iLog->Log(KTLocTest) ; |
3459 |
3492 |
3460 TRequestStatus Status = KRequestPending ; |
3493 TRequestStatus Status = KRequestPending ; |
3461 RThread FunctionThread ; |
3494 RThread FunctionThread ; |
3462 |
3495 |
3463 TInt ret = FunctionThread.Create(_L("Wrong Notification Trace cancel") , TraceLocWrongCancel ,KDefaultStackSize , |
3496 TInt ret = FunctionThread.Create(_L("Wrong Notification Trace cancel") , TraceLocWrongCancel ,KDefaultStackSize , |
3464 KMinHeapSize , 0x5000 ,(TAny *) NULL);; |
3497 KMinHeapSize , 0x5000 ,(TAny *) NULL);; |
3465 |
3498 |
3466 if(!ret) |
3499 if(!ret) |
3467 { |
3500 { |
3468 |
3501 |
3469 _LIT(Klog , "Created the thread ") ; |
3502 _LIT(Klog , "Created the thread ") ; |
3470 iLog->Log(Klog) ; |
3503 iLog->Log(Klog) ; |
3471 FunctionThread.Logon(Status) ; |
3504 FunctionThread.Logon(Status) ; |
3472 FunctionThread.Resume() ; |
3505 FunctionThread.Resume() ; |
3473 |
3506 |
3474 User :: WaitForRequest (Status) ; |
3507 User :: WaitForRequest (Status) ; |
3475 FunctionThread.Close(); |
3508 FunctionThread.Close(); |
3476 |
3509 |
3477 ret = Status.Int() ; |
3510 ret = Status.Int() ; |
3478 } |
3511 } |
3479 else |
3512 else |
3480 { |
3513 { |
3481 return ret ; |
3514 return ret ; |
3482 } |
3515 } |
3483 |
3516 |
3484 if(ret == SErrBadArgumentType) |
3517 if(ret == SErrBadArgumentType) |
3485 { |
3518 { |
3486 ret = KErrNone ; |
3519 ret = KErrNone ; |
3487 } |
3520 } |
3488 |
3521 |
3489 return ret; |
3522 return ret; |
3490 } |
3523 } |
3491 |
3524 |
3492 |
3525 |
3493 /** |
3526 /** |
3494 *Cancel test, Normal cancel test for getlocation |
3527 *Cancel test, Normal cancel test for getlocation |
3495 */ |
3528 */ |
3496 TInt CTestProvider :: GetLocationCancel(CStifItemParser& /*aItem*/) |
3529 TInt CTestProvider :: GetLocationCancel(CStifItemParser& /*aItem*/) |
3497 { |
3530 { |
3498 |
3531 |
3499 |
3532 |
3500 _LIT(KTLocTest ,"TLocTest"); |
3533 _LIT(KTLocTest ,"TLocTest"); |
3501 iLog->Log(KTLocTest) ; |
3534 iLog->Log(KTLocTest) ; |
3502 _LIT(KLog , "Getlocationcancel ") ; |
3535 _LIT(KLog , "Getlocationcancel ") ; |
3503 iLog->Log(KTLocTest) ; |
3536 iLog->Log(KTLocTest) ; |
3504 |
3537 |
3505 TRequestStatus Status = KRequestPending ; |
3538 TRequestStatus Status = KRequestPending ; |
3506 RThread FunctionThread ; |
3539 RThread FunctionThread ; |
3507 |
3540 |
3508 TInt ret = FunctionThread.Create(_L("Getlocationcancel ") , GetLocCancel ,KDefaultStackSize , |
3541 TInt ret = FunctionThread.Create(_L("Getlocationcancel ") , GetLocCancel ,KDefaultStackSize , |
3509 KMinHeapSize , 0x5000 ,(TAny *) NULL);; |
3542 KMinHeapSize , 0x5000 ,(TAny *) NULL);; |
3510 |
3543 |
3511 if(!ret) |
3544 if(!ret) |
3512 { |
3545 { |
3513 |
3546 |
3514 _LIT(Klog , "Created the thread ") ; |
3547 _LIT(Klog , "Created the thread ") ; |
3515 iLog->Log(Klog) ; |
3548 iLog->Log(Klog) ; |
3516 FunctionThread.Logon(Status) ; |
3549 FunctionThread.Logon(Status) ; |
3517 FunctionThread.Resume() ; |
3550 FunctionThread.Resume() ; |
3518 |
3551 |
3519 User :: WaitForRequest (Status) ; |
3552 User :: WaitForRequest (Status) ; |
3520 FunctionThread.Close(); |
3553 FunctionThread.Close(); |
3521 |
3554 |
3522 ret = Status.Int() ; |
3555 ret = Status.Int() ; |
3523 } |
3556 } |
3524 else |
3557 else |
3525 { |
3558 { |
3526 return ret ; |
3559 return ret ; |
3527 } |
3560 } |
3528 |
3561 |
3529 |
3562 |
3530 return ret; |
3563 return ret; |
3531 } |
3564 } |
3532 |
3565 |
3533 /** |
3566 /** |
3534 * GetLocation Timeout |
3567 * GetLocation Timeout |
3535 */ |
3568 */ |
3536 TInt CTestProvider :: GetLocationTimedOut(CStifItemParser& /*aItem*/) |
3569 TInt CTestProvider :: GetLocationTimedOut(CStifItemParser& /*aItem*/) |
3537 { |
3570 { |
|
3571 __UHEAP_MARK ; |
3538 _LIT(KTLocTest ,"TLocTest"); |
3572 _LIT(KTLocTest ,"TLocTest"); |
3539 iLog->Log(KTLocTest) ; |
3573 iLog->Log(KTLocTest) ; |
3540 _LIT(KLog , "GetLocationTimedOut ") ; |
3574 _LIT(KLog , "GetLocationTimedOut ") ; |
3541 iLog->Log(KTLocTest) ; |
3575 iLog->Log(KTLocTest) ; |
3542 |
3576 |
3543 return KErrNone ; //This is a manul test case |
3577 return KErrNone ; //This is a manul test case |
3544 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
3578 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
3545 |
3579 |
3546 // Input and output parameter list |
3580 // Input and output parameter list |
3547 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
3581 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
3548 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
3582 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
3549 |
3583 |
3550 |
3584 |
3551 |
3585 |
3552 |
3586 |
3553 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); |
3587 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); |
3554 |
3588 |
3555 |
3589 |
3556 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
3590 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
3557 |
3591 |
3558 RCriteriaArray a; |
3592 RCriteriaArray a; |
3559 a.AppendL(crit); |
3593 a.AppendL(crit); |
3560 |
3594 |
3561 ServiceHandler->AttachL(a) ; |
3595 ServiceHandler->AttachL(a) ; |
3562 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
3596 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
3563 |
3597 |
3564 |
3598 |
3565 |
3599 |
3566 |
3600 |
3567 TInt pos = 0; |
3601 TInt pos = 0; |
3568 |
3602 |
3569 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
3603 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
3570 |
3604 |
3571 if(!errorprm) |
3605 if(!errorprm) |
3572 { |
3606 { |
3573 return KErrGeneral ; |
3607 return KErrGeneral ; |
3574 } |
3608 } |
3575 |
3609 |
3576 pos = 0 ; |
3610 pos = 0 ; |
3577 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); |
3611 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); |
3578 |
3612 |
3579 if(!genericparm) |
3613 if(!genericparm) |
3580 { |
3614 { |
3581 |
3615 |
3582 return KErrGeneral ; |
3616 return KErrGeneral ; |
3583 } |
3617 } |
3584 |
3618 |
3585 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
3619 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
3586 inputlist->Reset(); |
3620 inputlist->Reset(); |
3587 outputlist->Reset(); |
3621 outputlist->Reset(); |
3588 const TInt Ksecond = 1000000; |
3622 const TInt Ksecond = 1000000; |
3589 const TInt KUpdatetimeOut = 100 ; //*Ksecond ; |
3623 const TInt KUpdatetimeOut = 100 ; //*Ksecond ; |
4326 |
4361 |
4327 return KErrGeneral ; |
4362 return KErrGeneral ; |
4328 } |
4363 } |
4329 |
4364 |
4330 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
4365 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
4331 |
4366 |
4332 TBuf8<20>CmdBuf(KRequestCalculate) ; |
4367 TBuf8<20>CmdBuf(KRequestCalculate) ; |
4333 outputlist->Reset() ; |
4368 outputlist->Reset() ; |
4334 inputlist->Reset() ; |
4369 inputlist->Reset() ; |
4335 |
4370 |
4336 |
4371 |
4337 CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; |
4372 CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; |
4338 |
4373 |
4339 TLiwGenericParam requesttype(KMathRequest , TLiwVariant(KRequestMove)) ; |
4374 TLiwGenericParam requesttype(KMathRequest , TLiwVariant(KRequestMove)) ; |
4340 InputList->AppendL(requesttype) ; |
4375 InputList->AppendL(requesttype) ; |
4341 |
4376 |
4342 |
4377 |
4343 //Inserting first input param |
4378 //Inserting first input param |
4344 CLiwMap* SourceCoordinate = CLiwDefaultMap::NewL(); |
4379 CLiwMap* SourceCoordinate = CLiwDefaultMap::NewL(); |
4345 TReal64 slongitude = 22; |
4380 TReal64 slongitude = 22; |
4346 SourceCoordinate->InsertL(KLongitudeKey,TLiwVariant(slongitude)); |
4381 SourceCoordinate->InsertL(KLongitudeKey,TLiwVariant(slongitude)); |
4347 TReal64 slatitude = 88; |
4382 TReal64 slatitude = 88; |
4348 SourceCoordinate->InsertL(KLatitudeKey,TLiwVariant(slatitude)); |
4383 SourceCoordinate->InsertL(KLatitudeKey,TLiwVariant(slatitude)); |
4349 |
4384 |
4350 TReal64 saltitude = 1; |
4385 TReal64 saltitude = 1; |
4351 SourceCoordinate->InsertL(KAltitudeKey,TLiwVariant(saltitude)); |
4386 SourceCoordinate->InsertL(KAltitudeKey,TLiwVariant(saltitude)); |
4352 |
4387 |
4353 |
4388 |
4354 |
4389 |
4355 TLiwGenericParam scoordinate(KDistanceParmSource,TLiwVariant(SourceCoordinate)); |
4390 TLiwGenericParam scoordinate(KDistanceParmSource,TLiwVariant(SourceCoordinate)); |
4356 InputList->AppendL(scoordinate) ; |
4391 InputList->AppendL(scoordinate) ; |
4357 SourceCoordinate->DecRef() ; |
4392 SourceCoordinate->DecRef() ; |
4358 |
4393 |
4359 |
4394 |
4360 |
4395 |
4361 TReal32 distanceToMove = 345; |
4396 TReal32 distanceToMove = 345; |
4362 TReal32 bearingToMove = 45; |
4397 TReal32 bearingToMove = 45; |
4363 |
4398 |
4364 |
4399 |
4365 //Inserting distance by which coordinate should be moved |
4400 //Inserting distance by which coordinate should be moved |
4366 TLiwVariant distanceVal((TReal)distanceToMove); |
4401 TLiwVariant distanceVal((TReal)distanceToMove); |
4367 TLiwGenericParam distanceParam(KDistanceMove,distanceVal); |
4402 TLiwGenericParam distanceParam(KDistanceMove,distanceVal); |
4368 InputList->AppendL(distanceParam); |
4403 InputList->AppendL(distanceParam); |
4369 |
4404 |
4370 //Inserting bearing by which coordinate should be moved |
4405 //Inserting bearing by which coordinate should be moved |
4371 TLiwVariant bearingVal((TReal)bearingToMove); |
4406 TLiwVariant bearingVal((TReal)bearingToMove); |
4372 TLiwGenericParam bearingParam(KBearingMove,bearingVal); |
4407 TLiwGenericParam bearingParam(KBearingMove,bearingVal); |
4373 InputList->AppendL(bearingParam); |
4408 InputList->AppendL(bearingParam); |
4374 |
4409 |
4375 |
4410 |
4376 |
4411 |
4377 |
4412 |
4378 |
4413 |
4379 CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; |
4414 CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; |
4380 |
4415 |
4381 |
4416 |
4382 |
4417 |
4383 |
4418 |
4384 locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList); |
4419 locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList); |
4385 |
4420 |
4386 |
4421 |
4387 |
4422 |
4388 |
4423 |
4389 |
4424 |
4390 TInt mathindex = 0; |
4425 TInt mathindex = 0; |
4391 |
4426 |
4392 // calculation |
4427 // calculation |
4393 const TLiwGenericParam *smapparam = OutParmList->FindFirst(mathindex , KLocationMap) ; |
4428 const TLiwGenericParam *smapparam = OutParmList->FindFirst(mathindex , KLocationMap) ; |
4394 TLiwVariant mapVariant= smapparam->Value() ; |
4429 TLiwVariant mapVariant= smapparam->Value() ; |
4395 const CLiwMap *map = mapVariant.AsMap() ; |
4430 const CLiwMap *map = mapVariant.AsMap() ; |
4396 TCoordinate source ; |
4431 TCoordinate source ; |
4397 |
4432 |
4398 FillCoordinatesL(source , map) ; |
4433 FillCoordinatesL(source , map) ; |
4399 |
4434 |
4400 TReal64 longitudeInputVal = source.Longitude(); |
4435 TReal64 longitudeInputVal = source.Longitude(); |
4401 TReal64 latitudeInputVal = source.Latitude(); |
4436 TReal64 latitudeInputVal = source.Latitude(); |
4402 TReal64 altitudeInputVal = source.Altitude(); |
4437 TReal64 altitudeInputVal = source.Altitude(); |
4403 |
4438 |
4404 |
4439 |
4405 //Logging result into a file |
4440 //Logging result into a file |
4406 RFile LogFile ; |
4441 RFile LogFile ; |
4407 RFs LogSession ; |
4442 RFs LogSession ; |
4408 TBuf8<50> Buffer(_L8("Longitude = ")) ; |
4443 TBuf8<50> Buffer(_L8("Longitude = ")) ; |
4409 LogSession.Connect() ; |
4444 LogSession.Connect() ; |
4410 |
4445 |
4411 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
4446 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
4412 { |
4447 { |
4413 LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; |
4448 LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; |
4414 |
4449 |
4415 } |
4450 } |
4416 |
4451 |
4417 TInt End = 0 ; |
4452 TInt End = 0 ; |
4418 |
4453 |
4419 LogFile.Seek(ESeekEnd , End) ; //Seek to end of the file before writing |
4454 LogFile.Seek(ESeekEnd , End) ; //Seek to end of the file before writing |
4420 |
4455 |
4421 TBuf8<50> num ; |
4456 TBuf8<50> num ; |
4422 TRealFormat format ; |
4457 TRealFormat format ; |
4423 |
4458 |
4424 num.Num(longitudeInputVal, format) ; |
4459 num.Num(longitudeInputVal, format) ; |
4425 |
4460 |
4426 //Logging |
4461 //Logging |
4427 LogFile.Write(_L8("Longitude = ")); |
4462 LogFile.Write(_L8("Longitude = ")); |
4428 LogFile.Write(num) ; |
4463 LogFile.Write(num) ; |
4429 LogFile.Write(_L8("\n")) ; |
4464 LogFile.Write(_L8("\n")) ; |
4430 //LogFile.Seek(ESeekEnd , End) ; |
4465 //LogFile.Seek(ESeekEnd , End) ; |
4431 num.Num(latitudeInputVal, format) ; |
4466 num.Num(latitudeInputVal, format) ; |
4432 LogFile.Write(_L8("Latitude = ")); |
4467 LogFile.Write(_L8("Latitude = ")); |
4433 LogFile.Write(num) ; |
4468 LogFile.Write(num) ; |
4434 LogFile.Write(_L8("\n")) ; |
4469 LogFile.Write(_L8("\n")) ; |
4435 num.Num(altitudeInputVal, format) ; |
4470 num.Num(altitudeInputVal, format) ; |
4436 LogFile.Write(_L8("altitude = ")); |
4471 LogFile.Write(_L8("altitude = ")); |
4437 LogFile.Write(num) ; |
4472 LogFile.Write(num) ; |
4438 LogFile.Write(_L8("\n")) ; |
4473 LogFile.Write(_L8("\n")) ; |
4439 LogFile.Close() ; |
4474 LogFile.Close() ; |
4440 LogSession.Close() ; |
4475 LogSession.Close() ; |
4441 |
4476 |
4442 delete OutParmList ; |
4477 delete OutParmList ; |
4443 delete InputList ; |
4478 delete InputList ; |
4444 locinterface->Close() ; |
4479 locinterface->Close() ; |
4445 delete ServiceHandler ; |
4480 delete ServiceHandler ; |
4446 a.ResetAndDestroy() ; |
4481 a.ResetAndDestroy() ; |
4447 a.Close() ; |
4482 a.Close() ; |
4448 __UHEAP_MARKEND ; |
4483 __UHEAP_MARKEND ; |
4449 return KErrNone ; |
4484 return KErrNone ; |
4450 } |
4485 } |
4451 |
4486 |
4452 |
4487 |
4453 |
4488 |
4454 |
4489 |
4455 |
4490 |
4456 |
4491 |
|
4492 TInt CTestProvider :: GetLastLocation(CStifItemParser& /*aItem*/) |
|
4493 { |
|
4494 __UHEAP_MARK ; |
|
4495 RFile LogFile ; |
|
4496 RFs LogSession ; |
|
4497 TBuf8<50> data ; |
|
4498 TRealFormat format ; |
|
4499 |
|
4500 |
|
4501 if(LogSession.Connect() != KErrNone) |
|
4502 { |
|
4503 _LIT(KLog , "Failed to connect to file server") ; |
|
4504 iLog->Log(KLog) ; |
|
4505 return KErrGeneral ; |
|
4506 } |
|
4507 |
|
4508 |
|
4509 |
|
4510 |
|
4511 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
|
4512 { |
|
4513 if(LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) != KErrNone) |
|
4514 { |
|
4515 _LIT(KLog , "Failed to create notifications log file") ; |
|
4516 iLog->Log(KLog) ; |
|
4517 return KErrGeneral ; |
|
4518 } |
|
4519 |
|
4520 } |
|
4521 |
|
4522 _LIT(KLog , "In CTGetLocation") ; |
|
4523 iLog->Log(KLog) ; |
|
4524 |
|
4525 |
|
4526 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
4527 |
|
4528 // Input and output parameter list |
|
4529 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
4530 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
4531 |
|
4532 |
|
4533 |
|
4534 |
|
4535 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
|
4536 |
|
4537 |
|
4538 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
4539 |
|
4540 RCriteriaArray a; |
|
4541 a.AppendL(crit); |
|
4542 |
|
4543 ServiceHandler->AttachL(a) ; |
|
4544 |
|
4545 |
|
4546 |
|
4547 |
|
4548 |
|
4549 |
|
4550 |
|
4551 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
4552 |
|
4553 |
|
4554 |
|
4555 |
|
4556 TInt pos = 0; |
|
4557 |
|
4558 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
|
4559 |
|
4560 if(!errorprm) |
|
4561 { |
|
4562 _LIT(Klog , "Success/Failure error code missing from outputlist") ; |
|
4563 iLog->Log(Klog) ; |
|
4564 return KErrGeneral ; |
|
4565 } |
|
4566 |
|
4567 |
|
4568 _LIT8(KDataSource, "ILocation"); |
|
4569 |
|
4570 pos = 0 ; |
|
4571 |
|
4572 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
|
4573 |
|
4574 if(!genericparm) |
|
4575 { |
|
4576 _LIT(KLog , "Interface not found"); |
|
4577 iLog->Log(KLog) ; |
|
4578 return KErrGeneral ; |
|
4579 } |
|
4580 |
|
4581 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
|
4582 |
|
4583 |
|
4584 |
|
4585 //TBuf8<20>CmdBuf(KCmdGetLocation) ; |
|
4586 TBuf8<20>CmdBuf(_L8("GetLastPosition")); |
|
4587 outputlist->Reset() ; |
|
4588 inputlist->Reset() ; |
|
4589 |
|
4590 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); |
|
4591 |
|
4592 pos = 0 ; |
|
4593 |
|
4594 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
4595 |
|
4596 if(!ErrorParm) |
|
4597 { |
|
4598 _LIT(Klog, "Success/Failure state not known") ; |
|
4599 iLog->Log(Klog) ; |
|
4600 return KErrGeneral ; |
|
4601 } |
|
4602 |
|
4603 if((ErrorParm->Value()).AsTInt32() ) |
|
4604 { |
|
4605 _LIT(KLog , "ExecutecmdL failed "); |
|
4606 iLog->Log(KLog) ; |
|
4607 return (ErrorParm->Value()).AsTInt32() ; |
|
4608 } |
|
4609 |
|
4610 |
|
4611 |
|
4612 TInt index = 0 ; |
|
4613 |
|
4614 const TLiwGenericParam *GenericParam = outputlist->FindFirst(index , KLocationMap); |
|
4615 |
|
4616 |
|
4617 if(!GenericParam) |
|
4618 { |
|
4619 _LIT(Klog, "Out Param not found") ; |
|
4620 iLog->Log(Klog) ; |
|
4621 return KErrGeneral ; //Param Error |
|
4622 } |
|
4623 |
|
4624 TLiwVariant Variant ; |
|
4625 |
|
4626 Variant = GenericParam->Value() ; |
|
4627 const CLiwMap *LocMap = Variant.AsMap() ; |
|
4628 |
|
4629 TLiwVariant PosVariant ; |
|
4630 |
|
4631 LocMap->FindL(KLongitudeKey , PosVariant) ; |
|
4632 TReal64 LongData = (TReal64)PosVariant.AsTReal() ; //Longitude |
|
4633 data.Num(LongData , format) ; |
|
4634 LogFile.Write(_L8("\n")) ; |
|
4635 LogFile.Write(_L8("Logitude = ")) ; |
|
4636 LogFile.Write(data) ; |
|
4637 |
|
4638 LocMap->FindL(KLatitudeKey ,PosVariant) ; //Latitude |
|
4639 |
|
4640 TReal64 LatData = (TReal64)PosVariant.AsTReal() ; |
|
4641 data.Num(LatData , format) ; |
|
4642 LogFile.Write(_L8(" Latitude = ")) ; |
|
4643 LogFile.Write(data) ; |
|
4644 |
|
4645 LocMap->FindL(KAltitudeKey , PosVariant) ; //Altitude |
|
4646 TReal32 AltData = PosVariant.AsTReal() ; |
|
4647 data.Num(AltData , format) ; |
|
4648 |
|
4649 LogFile.Write(_L8(" Altitude = ")) ; |
|
4650 LogFile.Write(data) ; |
|
4651 |
|
4652 |
|
4653 TLiwVariant Speed ; |
|
4654 |
|
4655 index = LocMap->FindL(_L8("HorizontalSpeed") , Speed ) ; |
|
4656 |
|
4657 if(index ) |
|
4658 { |
|
4659 |
|
4660 TReal speed = Speed.AsTReal() ; |
|
4661 |
|
4662 data.Num(speed , format) ; |
|
4663 |
|
4664 LogFile.Write(_L8("Speed = ")) ; |
|
4665 LogFile.Write(data) ; |
|
4666 |
|
4667 } |
|
4668 TLiwVariant Accuracy; |
|
4669 index = LocMap->FindL(_L8("HorizontalAccuracy"),Accuracy); |
|
4670 |
|
4671 if(index) |
|
4672 { |
|
4673 TReal32 AccuracyVal = Accuracy.AsTReal(); |
|
4674 data.Num(AccuracyVal , format) ; |
|
4675 |
|
4676 LogFile.Write(_L8("Horizontal Acc = ")) ; |
|
4677 LogFile.Write(data) ; |
|
4678 } |
|
4679 |
|
4680 Accuracy.Reset(); |
|
4681 index = LocMap->FindL(_L8("VerticalAccuracy"),Accuracy); |
|
4682 |
|
4683 if(index) |
|
4684 { |
|
4685 TReal32 AccuracyVal = Accuracy.AsTReal(); |
|
4686 data.Num(AccuracyVal , format) ; |
|
4687 |
|
4688 LogFile.Write(_L8("Vertical Acc = ")) ; |
|
4689 LogFile.Write(data) ; |
|
4690 } |
|
4691 |
|
4692 TLiwVariant SpeedError ; |
|
4693 index = LocMap->FindL( _L8("HorizontalSpeedError") , SpeedError) ; |
|
4694 |
|
4695 |
|
4696 if(index ) |
|
4697 { |
|
4698 |
|
4699 TReal speed = SpeedError.AsTReal() ; |
|
4700 |
|
4701 data.Num(speed , format) ; |
|
4702 |
|
4703 LogFile.Write(_L8("Speed = ")) ; |
|
4704 LogFile.Write(data) ; |
|
4705 |
|
4706 } |
|
4707 |
|
4708 index = 0 ; |
|
4709 |
|
4710 TLiwVariant SatInfo ; |
|
4711 |
|
4712 index = LocMap->FindL(_L8("SatelliteNumView") , SatInfo) ; |
|
4713 |
|
4714 if(index ) |
|
4715 { |
|
4716 |
|
4717 TInt satnumView = SatInfo.AsTInt32() ; |
|
4718 data.Num(satnumView , format); |
|
4719 |
|
4720 LogFile.Write(_L8("Satellite information")) ; |
|
4721 |
|
4722 LogFile.Write(_L8("Number of visible satellites ")) ; |
|
4723 LogFile.Write(data) ; |
|
4724 } |
|
4725 |
|
4726 index = 0 ; |
|
4727 |
|
4728 TLiwVariant SatInfoview ; |
|
4729 |
|
4730 index = LocMap->FindL( _L8("SatelliteNumViewUsed") , SatInfoview) ; |
|
4731 if(index ) |
|
4732 { |
|
4733 |
|
4734 |
|
4735 TInt satnumViewUsed = SatInfoview.AsTInt32() ; |
|
4736 data.Num(satnumViewUsed , format); |
|
4737 |
|
4738 LogFile.Write(_L8("\nSatellite information")) ; |
|
4739 |
|
4740 LogFile.Write(_L8("\nSatelliteNumViewUsed")) ; |
|
4741 LogFile.Write(data) ; |
|
4742 } |
|
4743 |
|
4744 index = 0 ; |
|
4745 |
|
4746 TInt Headinginfo = 0 ; |
|
4747 |
|
4748 TLiwVariant Heading ; |
|
4749 Headinginfo = LocMap->FindL(_L8("Heading") ,Heading) ; |
|
4750 |
|
4751 if(Headinginfo) |
|
4752 { |
|
4753 |
|
4754 |
|
4755 TReal heading = Heading.AsTReal() ; |
|
4756 data.Num(heading , format); |
|
4757 |
|
4758 LogFile.Write(_L8("\ncompass information")) ; |
|
4759 |
|
4760 LogFile.Write(_L8("\nHeading")) ; |
|
4761 LogFile.Write(data) ; |
|
4762 } |
|
4763 |
|
4764 |
|
4765 if(Headinginfo) |
|
4766 { |
|
4767 TLiwVariant HeadingError ; |
|
4768 index = LocMap->FindL( _L8("HeadingError") , HeadingError ) ; |
|
4769 |
|
4770 if(index) |
|
4771 { |
|
4772 |
|
4773 |
|
4774 TReal heading = HeadingError.AsTReal() ; |
|
4775 data.Num(heading , format); |
|
4776 |
|
4777 LogFile.Write(_L8("\ncompass information")) ; |
|
4778 |
|
4779 LogFile.Write(_L8("\nHeading Error")) ; |
|
4780 LogFile.Write(data) ; |
|
4781 |
|
4782 } |
|
4783 |
|
4784 TLiwVariant MagneticHeading ; |
|
4785 index = LocMap->FindL( _L8("MagneticHeading") , MagneticHeading) ; |
|
4786 |
|
4787 if(index) |
|
4788 { |
|
4789 |
|
4790 |
|
4791 TReal heading = MagneticHeading.AsTReal() ; |
|
4792 data.Num(heading , format); |
|
4793 |
|
4794 LogFile.Write(_L8("\ncompass information")) ; |
|
4795 |
|
4796 LogFile.Write(_L8("\n MagneticHeading ")) ; |
|
4797 LogFile.Write(data) ; |
|
4798 |
|
4799 } |
|
4800 |
|
4801 |
|
4802 TLiwVariant MagneticHeadingError ; |
|
4803 index = LocMap->FindL(_L8("MagneticHeadingError") ,MagneticHeadingError) ; |
|
4804 |
|
4805 if(index) |
|
4806 { |
|
4807 |
|
4808 |
|
4809 TReal heading = MagneticHeadingError.AsTReal() ; |
|
4810 data.Num(heading , format); |
|
4811 |
|
4812 LogFile.Write(_L8("\ncompass information")) ; |
|
4813 |
|
4814 LogFile.Write(_L8("\nMagneticHeading Error")) ; |
|
4815 LogFile.Write(data) ; |
|
4816 |
|
4817 } |
|
4818 |
|
4819 |
|
4820 } //End of Heading |
|
4821 |
|
4822 |
|
4823 |
|
4824 TLiwVariant TrueCourse ; |
|
4825 index = LocMap->FindL( _L8("TrueCourse") , TrueCourse ) ; |
|
4826 |
|
4827 if( index) |
|
4828 { |
|
4829 |
|
4830 |
|
4831 TReal heading = TrueCourse.AsTReal() ; |
|
4832 data.Num(heading , format); |
|
4833 |
|
4834 LogFile.Write(_L8("\nDirection ")) ; |
|
4835 |
|
4836 LogFile.Write(_L8("\n TrueCourse Error")) ; |
|
4837 LogFile.Write(data) ; |
|
4838 |
|
4839 |
|
4840 |
|
4841 TLiwVariant TrueCourseError ; |
|
4842 index = LocMap->FindL( _L8("TrueCourseError") , TrueCourseError ) ; |
|
4843 |
|
4844 if( index) |
|
4845 { |
|
4846 |
|
4847 |
|
4848 TReal heading = TrueCourseError.AsTReal() ; |
|
4849 data.Num(heading , format); |
|
4850 |
|
4851 LogFile.Write(_L8("\ncompass information")) ; |
|
4852 |
|
4853 LogFile.Write(_L8("\nMagneticHeading Error")) ; |
|
4854 LogFile.Write(data) ; |
|
4855 |
|
4856 } |
|
4857 |
|
4858 |
|
4859 } |
|
4860 |
|
4861 |
|
4862 TLiwVariant MagneticCourse ; |
|
4863 index = LocMap->FindL(_L8("MagneticCourse") , MagneticCourse ) ; |
|
4864 |
|
4865 |
|
4866 if(index) |
|
4867 { |
|
4868 |
|
4869 TReal heading = MagneticCourse.AsTReal() ; |
|
4870 data.Num(heading , format); |
|
4871 |
|
4872 LogFile.Write(_L8("\ncompass information")) ; |
|
4873 |
|
4874 LogFile.Write(_L8("\nMagneticCourse ")) ; |
|
4875 LogFile.Write(data) ; |
|
4876 |
|
4877 |
|
4878 |
|
4879 TLiwVariant MagneticCourseError ; |
|
4880 index = LocMap->FindL(_L8("MagneticCourseError") ,MagneticCourseError ) ; |
|
4881 |
|
4882 if( index) |
|
4883 { |
|
4884 |
|
4885 |
|
4886 TReal heading = MagneticCourseError.AsTReal() ; |
|
4887 data.Num(heading , format); |
|
4888 |
|
4889 LogFile.Write(_L8("\ncompass information")) ; |
|
4890 |
|
4891 LogFile.Write(_L8("\n MagneticCourseError Error")) ; |
|
4892 LogFile.Write(data) ; |
|
4893 |
|
4894 } |
|
4895 |
|
4896 |
|
4897 } |
|
4898 |
|
4899 |
|
4900 |
|
4901 TLiwVariant NmeaNum ; |
|
4902 index = LocMap->FindL(_L8("NMEASentence") , NmeaNum ) ; |
|
4903 |
|
4904 |
|
4905 if(index) |
|
4906 { |
|
4907 |
|
4908 TInt32 NMEASentence = NmeaNum.AsTInt32() ; |
|
4909 data.Num(NMEASentence , format); |
|
4910 |
|
4911 LogFile.Write(_L8("\nNMEA Information")) ; |
|
4912 |
|
4913 LogFile.Write(_L8("\n number of NMEA Sentences ")) ; |
|
4914 LogFile.Write(data) ; |
|
4915 |
|
4916 index = 0 ; |
|
4917 |
|
4918 const TLiwGenericParam *MagneticCourseError = outputlist->FindFirst(index , _L8("NMEASentenceStart") ) ; |
|
4919 |
|
4920 if(-1 != index) |
|
4921 { |
|
4922 Variant = MagneticCourseError->Value() ; |
|
4923 |
|
4924 |
|
4925 } |
|
4926 |
|
4927 |
|
4928 } |
|
4929 |
|
4930 |
|
4931 LogFile.Close() ; |
|
4932 LogSession.Close() ; |
|
4933 |
|
4934 locinterface->Close() ; |
|
4935 delete ServiceHandler ; |
|
4936 a.ResetAndDestroy() ; |
|
4937 a.Close() ; |
|
4938 |
|
4939 __UHEAP_MARKEND ; |
|
4940 return KErrNone ; |
|
4941 |
|
4942 |
|
4943 |
|
4944 } |
|
4945 |
|
4946 |
|
4947 TInt CTestProvider ::GetLocationMultiple(CStifItemParser& /*aItem*/) |
|
4948 { |
|
4949 |
|
4950 |
|
4951 __UHEAP_MARK ; |
|
4952 RFile LogFile ; |
|
4953 RFs LogSession ; |
|
4954 TBuf8<50> data ; |
|
4955 TRealFormat format ; |
|
4956 |
|
4957 |
|
4958 if(LogSession.Connect() != KErrNone) |
|
4959 { |
|
4960 _LIT(KLog , "Failed to connect to file server") ; |
|
4961 iLog->Log(KLog) ; |
|
4962 return KErrGeneral ; |
|
4963 } |
|
4964 |
|
4965 |
|
4966 _LIT(LogFileNameCancel , "C:\\cancelinvalid.txt") ; |
|
4967 |
|
4968 if(LogFile.Open(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) == KErrNotFound) |
|
4969 { |
|
4970 if(LogFile.Create(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) != KErrNone) |
|
4971 { |
|
4972 _LIT(KLog , "Failed to create log file\n") ; |
|
4973 iLog->Log(KLog) ; |
|
4974 return KErrGeneral ; |
|
4975 } |
|
4976 |
|
4977 } |
|
4978 |
|
4979 _LIT(KLog , "In CancelWithInvalidTransactionID\n") ; |
|
4980 data.Copy(KLog); |
|
4981 LogFile.Write(data) ; |
|
4982 |
|
4983 |
|
4984 |
|
4985 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
4986 |
|
4987 // Input and output parameter list |
|
4988 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
4989 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
4990 |
|
4991 |
|
4992 |
|
4993 |
|
4994 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
|
4995 |
|
4996 |
|
4997 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
4998 |
|
4999 RCriteriaArray a; |
|
5000 a.AppendL(crit); |
|
5001 |
|
5002 ServiceHandler->AttachL(a) ; |
|
5003 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
5004 |
|
5005 |
|
5006 |
|
5007 |
|
5008 TInt pos = 0; |
|
5009 |
|
5010 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
|
5011 |
|
5012 if(!errorprm) |
|
5013 { |
|
5014 |
|
5015 return KErrGeneral ; |
|
5016 } |
|
5017 |
|
5018 |
|
5019 _LIT8(KDataSource, "ILocation"); |
|
5020 |
|
5021 pos = 0 ; |
|
5022 |
|
5023 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
|
5024 |
|
5025 if(!genericparm) |
|
5026 { |
|
5027 |
|
5028 return KErrGeneral ; |
|
5029 } |
|
5030 |
|
5031 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
|
5032 |
|
5033 |
|
5034 |
|
5035 TBuf8<20>CmdBuf(KCmdGetLocation) ; |
|
5036 |
|
5037 outputlist->Reset() ; |
|
5038 inputlist->Reset() ; |
|
5039 ASyncLocCBF* callBack = new(ELeave) ASyncLocCBF; |
|
5040 //Make the first call |
|
5041 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous, callBack); |
|
5042 |
|
5043 pos = 0 ; |
|
5044 |
|
5045 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
5046 |
|
5047 if(!ErrorParm) |
|
5048 { |
|
5049 _LIT(Klog , "Success/Failure error code missing from outputlist\n") ; |
|
5050 data.Copy(Klog); |
|
5051 LogFile.Write(data) ; |
|
5052 |
|
5053 //LogFile.Write(Klog) ; |
|
5054 return KErrGeneral ; |
|
5055 } |
|
5056 |
|
5057 TInt reqerror = (ErrorParm->Value()).AsTInt32(); |
|
5058 _LIT(Klog , "ERRor code from getlocationasynch ") ; |
|
5059 data.Copy(Klog); |
|
5060 LogFile.Write(data) ; |
|
5061 |
|
5062 //LogFile.Write(Klog) ; |
|
5063 |
|
5064 TReal64 errordata = reqerror ; |
|
5065 data.Num(errordata , format) ; |
|
5066 |
|
5067 |
|
5068 LogFile.Write(data) ; |
|
5069 |
|
5070 |
|
5071 pos = 0; |
|
5072 |
|
5073 _LIT8(KTransactionId, "TransactionID"); |
|
5074 const TLiwGenericParam *transid = outputlist->FindFirst(pos ,KTransactionId ) ; |
|
5075 |
|
5076 |
|
5077 if(!transid) |
|
5078 { |
|
5079 _LIT(KTran,"Missing Transaction ID\n"); |
|
5080 data.Copy(KTran); |
|
5081 LogFile.Write(data) ; |
|
5082 //LogFile.Write(KTran); |
|
5083 return KErrGeneral; |
|
5084 } |
|
5085 TInt32 trid = (transid->Value()).AsTInt32(); |
|
5086 outputlist->Reset() ; |
|
5087 inputlist->Reset() ; |
|
5088 //Make second call |
|
5089 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous, callBack); |
|
5090 pos = 0 ; |
|
5091 |
|
5092 const TLiwGenericParam *ErrorParm1 = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
5093 |
|
5094 if(!ErrorParm1) |
|
5095 { |
|
5096 _LIT(Klog , "Success/Failure error code missing from outputlist\n") ; |
|
5097 data.Copy(Klog); |
|
5098 LogFile.Write(data) ; |
|
5099 |
|
5100 //LogFile.Write(Klog) ; |
|
5101 return KErrGeneral ; |
|
5102 } |
|
5103 |
|
5104 TInt reqerror1 = (ErrorParm1->Value()).AsTInt32(); |
|
5105 _LIT(Klog1 , "ERRor code from getlocationasynch ") ; |
|
5106 data.Copy(Klog1); |
|
5107 LogFile.Write(data) ; |
|
5108 |
|
5109 //LogFile.Write(Klog) ; |
|
5110 |
|
5111 TReal64 errordata1 = reqerror1 ; |
|
5112 data.Num(errordata1 , format) ; |
|
5113 |
|
5114 |
|
5115 LogFile.Write(data) ; |
|
5116 |
|
5117 |
|
5118 pos = 0; |
|
5119 |
|
5120 |
|
5121 const TLiwGenericParam *transid1 = outputlist->FindFirst(pos ,KTransactionId ) ; |
|
5122 |
|
5123 |
|
5124 if(!transid1) |
|
5125 { |
|
5126 _LIT(KTran,"Missing Transaction ID\n"); |
|
5127 data.Copy(KTran); |
|
5128 LogFile.Write(data) ; |
|
5129 //LogFile.Write(KTran); |
|
5130 return KErrGeneral; |
|
5131 } |
|
5132 TInt32 trid1 = (transid1->Value()).AsTInt32(); |
|
5133 outputlist->Reset() ; |
|
5134 inputlist->Reset() ; |
|
5135 |
|
5136 ///////////////Cancel first call |
|
5137 |
|
5138 inputlist->AppendL(TLiwGenericParam(KTransactionId,TLiwVariant(trid))); |
|
5139 |
|
5140 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptCancel); |
|
5141 |
|
5142 ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
5143 |
|
5144 if(!ErrorParm) |
|
5145 { |
|
5146 _LIT(Klog , "Success/Failure error code missing from outputlist in cancel\n ") ; |
|
5147 data.Copy(Klog); |
|
5148 LogFile.Write(data) ; |
|
5149 //LogFile.Write(Klog); |
|
5150 return KErrGeneral ; |
|
5151 } |
|
5152 |
|
5153 reqerror = (ErrorParm->Value()).AsTInt32(); |
|
5154 |
|
5155 _LIT(Klog2 , "\nERRor code from cancel ") ; |
|
5156 |
|
5157 data.Copy(Klog2); |
|
5158 LogFile.Write(data) ; |
|
5159 //LogFile.Write(Klog1) ; |
|
5160 |
|
5161 errordata = reqerror ; |
|
5162 data.Num(errordata , format) ; |
|
5163 |
|
5164 |
|
5165 LogFile.Write(data) ; |
|
5166 if( KErrNone != reqerror ) |
|
5167 { |
|
5168 User::Leave(reqerror); |
|
5169 } |
|
5170 //Cancel the second call |
|
5171 inputlist->Reset(); |
|
5172 inputlist->AppendL(TLiwGenericParam(KTransactionId,TLiwVariant(trid1))); |
|
5173 |
|
5174 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptCancel); |
|
5175 |
|
5176 ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
5177 |
|
5178 if(!ErrorParm) |
|
5179 { |
|
5180 _LIT(Klog , "Success/Failure error code missing from outputlist in cancel\n ") ; |
|
5181 data.Copy(Klog); |
|
5182 LogFile.Write(data) ; |
|
5183 //LogFile.Write(Klog); |
|
5184 return KErrGeneral ; |
|
5185 } |
|
5186 |
|
5187 reqerror = (ErrorParm->Value()).AsTInt32(); |
|
5188 |
|
5189 _LIT(Klog3 , "\nERRor code from cancel ") ; |
|
5190 |
|
5191 data.Copy(Klog3); |
|
5192 LogFile.Write(data) ; |
|
5193 //LogFile.Write(Klog1) ; |
|
5194 |
|
5195 errordata = reqerror ; |
|
5196 data.Num(errordata , format) ; |
|
5197 |
|
5198 |
|
5199 LogFile.Write(data) ; |
|
5200 |
|
5201 if( KErrNone != reqerror ) |
|
5202 { |
|
5203 LogFile.Close() ; |
|
5204 LogSession.Close() ; |
|
5205 |
|
5206 locinterface->Close() ; |
|
5207 delete callBack; |
|
5208 delete crit; |
|
5209 //a.ResetAndDestroy() ; |
|
5210 a.Close() ; |
|
5211 delete ServiceHandler ; |
|
5212 |
|
5213 __UHEAP_MARKEND ; |
|
5214 return reqerror ; |
|
5215 } |
|
5216 |
|
5217 |
|
5218 LogFile.Close() ; |
|
5219 LogSession.Close() ; |
|
5220 |
|
5221 locinterface->Close() ; |
|
5222 delete callBack; |
|
5223 delete crit; |
|
5224 //a.ResetAndDestroy() ; |
|
5225 a.Close() ; |
|
5226 delete ServiceHandler ; |
|
5227 |
|
5228 __UHEAP_MARKEND ; |
|
5229 return reqerror ; |
|
5230 |
|
5231 |
|
5232 |
|
5233 |
|
5234 |
|
5235 } |
|
5236 |
|
5237 |
|
5238 |
|
5239 TInt CTestProvider ::TraceMultiple(CStifItemParser& /*aItem*/) |
|
5240 { |
|
5241 |
|
5242 |
|
5243 __UHEAP_MARK ; |
|
5244 RFile LogFile ; |
|
5245 RFs LogSession ; |
|
5246 TBuf8<50> data ; |
|
5247 TRealFormat format ; |
|
5248 |
|
5249 |
|
5250 if(LogSession.Connect() != KErrNone) |
|
5251 { |
|
5252 _LIT(KLog , "Failed to connect to file server") ; |
|
5253 iLog->Log(KLog) ; |
|
5254 return KErrGeneral ; |
|
5255 } |
|
5256 |
|
5257 |
|
5258 _LIT(LogFileNameCancel , "C:\\cancelinvalid.txt") ; |
|
5259 |
|
5260 if(LogFile.Open(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) == KErrNotFound) |
|
5261 { |
|
5262 if(LogFile.Create(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) != KErrNone) |
|
5263 { |
|
5264 _LIT(KLog , "Failed to create log file\n") ; |
|
5265 iLog->Log(KLog) ; |
|
5266 return KErrGeneral ; |
|
5267 } |
|
5268 |
|
5269 } |
|
5270 |
|
5271 _LIT(KLog , "In CancelWithInvalidTransactionID\n") ; |
|
5272 data.Copy(KLog); |
|
5273 LogFile.Write(data) ; |
|
5274 |
|
5275 |
|
5276 |
|
5277 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
5278 |
|
5279 // Input and output parameter list |
|
5280 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
5281 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
5282 |
|
5283 |
|
5284 |
|
5285 |
|
5286 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
|
5287 |
|
5288 |
|
5289 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
5290 |
|
5291 RCriteriaArray a; |
|
5292 a.AppendL(crit); |
|
5293 |
|
5294 ServiceHandler->AttachL(a) ; |
|
5295 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
5296 |
|
5297 |
|
5298 |
|
5299 |
|
5300 TInt pos = 0; |
|
5301 |
|
5302 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
|
5303 |
|
5304 if(!errorprm) |
|
5305 { |
|
5306 |
|
5307 return KErrGeneral ; |
|
5308 } |
|
5309 |
|
5310 |
|
5311 _LIT8(KDataSource, "ILocation"); |
|
5312 |
|
5313 pos = 0 ; |
|
5314 |
|
5315 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
|
5316 |
|
5317 if(!genericparm) |
|
5318 { |
|
5319 |
|
5320 return KErrGeneral ; |
|
5321 } |
|
5322 |
|
5323 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
|
5324 |
|
5325 |
|
5326 |
|
5327 TBuf8<20>CmdBuf(KTraceLocation) ; |
|
5328 |
|
5329 outputlist->Reset() ; |
|
5330 inputlist->Reset() ; |
|
5331 ASyncLocCBF* callBack = new(ELeave) ASyncLocCBF; |
|
5332 //Make the first call |
|
5333 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous, callBack); |
|
5334 |
|
5335 pos = 0 ; |
|
5336 |
|
5337 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
5338 |
|
5339 if(!ErrorParm) |
|
5340 { |
|
5341 _LIT(Klog , "Success/Failure error code missing from outputlist\n") ; |
|
5342 data.Copy(Klog); |
|
5343 LogFile.Write(data) ; |
|
5344 |
|
5345 //LogFile.Write(Klog) ; |
|
5346 return KErrGeneral ; |
|
5347 } |
|
5348 |
|
5349 TInt reqerror = (ErrorParm->Value()).AsTInt32(); |
|
5350 _LIT(Klog , "ERRor code from getlocationasynch ") ; |
|
5351 data.Copy(Klog); |
|
5352 LogFile.Write(data) ; |
|
5353 |
|
5354 //LogFile.Write(Klog) ; |
|
5355 |
|
5356 TReal64 errordata = reqerror ; |
|
5357 data.Num(errordata , format) ; |
|
5358 |
|
5359 |
|
5360 LogFile.Write(data) ; |
|
5361 |
|
5362 |
|
5363 pos = 0; |
|
5364 |
|
5365 _LIT8(KTransactionId, "TransactionID"); |
|
5366 const TLiwGenericParam *transid = outputlist->FindFirst(pos ,KTransactionId ) ; |
|
5367 |
|
5368 |
|
5369 if(!transid) |
|
5370 { |
|
5371 _LIT(KTran,"Missing Transaction ID\n"); |
|
5372 data.Copy(KTran); |
|
5373 LogFile.Write(data) ; |
|
5374 //LogFile.Write(KTran); |
|
5375 return KErrGeneral; |
|
5376 } |
|
5377 TInt32 trid = (transid->Value()).AsTInt32(); |
|
5378 outputlist->Reset() ; |
|
5379 inputlist->Reset() ; |
|
5380 //Make second call |
|
5381 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous, callBack); |
|
5382 pos = 0 ; |
|
5383 |
|
5384 const TLiwGenericParam *ErrorParm1 = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
5385 |
|
5386 if(!ErrorParm1) |
|
5387 { |
|
5388 _LIT(Klog , "Success/Failure error code missing from outputlist\n") ; |
|
5389 data.Copy(Klog); |
|
5390 LogFile.Write(data) ; |
|
5391 |
|
5392 //LogFile.Write(Klog) ; |
|
5393 return KErrGeneral ; |
|
5394 } |
|
5395 |
|
5396 TInt reqerror1 = (ErrorParm1->Value()).AsTInt32(); |
|
5397 _LIT(Klog1 , "ERRor code from getlocationasynch ") ; |
|
5398 data.Copy(Klog1); |
|
5399 LogFile.Write(data) ; |
|
5400 |
|
5401 //LogFile.Write(Klog) ; |
|
5402 |
|
5403 TReal64 errordata1 = reqerror1 ; |
|
5404 data.Num(errordata1 , format) ; |
|
5405 |
|
5406 |
|
5407 LogFile.Write(data) ; |
|
5408 |
|
5409 |
|
5410 pos = 0; |
|
5411 |
|
5412 |
|
5413 const TLiwGenericParam *transid1 = outputlist->FindFirst(pos ,KTransactionId ) ; |
|
5414 |
|
5415 |
|
5416 if(!transid1) |
|
5417 { |
|
5418 _LIT(KTran,"Missing Transaction ID\n"); |
|
5419 data.Copy(KTran); |
|
5420 LogFile.Write(data) ; |
|
5421 //LogFile.Write(KTran); |
|
5422 return KErrGeneral; |
|
5423 } |
|
5424 TInt32 trid1 = (transid1->Value()).AsTInt32(); |
|
5425 outputlist->Reset() ; |
|
5426 inputlist->Reset() ; |
|
5427 |
|
5428 ///////////////Cancel first call |
|
5429 |
|
5430 inputlist->AppendL(TLiwGenericParam(KTransactionId,TLiwVariant(trid))); |
|
5431 |
|
5432 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptCancel); |
|
5433 |
|
5434 ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
5435 |
|
5436 if(!ErrorParm) |
|
5437 { |
|
5438 _LIT(Klog , "Success/Failure error code missing from outputlist in cancel\n ") ; |
|
5439 data.Copy(Klog); |
|
5440 LogFile.Write(data) ; |
|
5441 //LogFile.Write(Klog); |
|
5442 return KErrGeneral ; |
|
5443 } |
|
5444 |
|
5445 reqerror = (ErrorParm->Value()).AsTInt32(); |
|
5446 |
|
5447 _LIT(Klog2 , "\nERRor code from cancel ") ; |
|
5448 |
|
5449 data.Copy(Klog2); |
|
5450 LogFile.Write(data) ; |
|
5451 //LogFile.Write(Klog1) ; |
|
5452 |
|
5453 errordata = reqerror ; |
|
5454 data.Num(errordata , format) ; |
|
5455 |
|
5456 |
|
5457 LogFile.Write(data) ; |
|
5458 if( KErrNone != reqerror ) |
|
5459 { |
|
5460 User::Leave(reqerror); |
|
5461 } |
|
5462 //Cancel the second call |
|
5463 inputlist->Reset(); |
|
5464 inputlist->AppendL(TLiwGenericParam(KTransactionId,TLiwVariant(trid1))); |
|
5465 |
|
5466 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptCancel); |
|
5467 |
|
5468 ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
5469 |
|
5470 if(!ErrorParm) |
|
5471 { |
|
5472 _LIT(Klog , "Success/Failure error code missing from outputlist in cancel\n ") ; |
|
5473 data.Copy(Klog); |
|
5474 LogFile.Write(data) ; |
|
5475 //LogFile.Write(Klog); |
|
5476 return KErrGeneral ; |
|
5477 } |
|
5478 |
|
5479 reqerror = (ErrorParm->Value()).AsTInt32(); |
|
5480 |
|
5481 _LIT(Klog3 , "\nERRor code from cancel ") ; |
|
5482 |
|
5483 data.Copy(Klog3); |
|
5484 LogFile.Write(data) ; |
|
5485 //LogFile.Write(Klog1) ; |
|
5486 |
|
5487 errordata = reqerror ; |
|
5488 data.Num(errordata , format) ; |
|
5489 |
|
5490 |
|
5491 LogFile.Write(data) ; |
|
5492 |
|
5493 if( KErrNone != reqerror ) |
|
5494 { |
|
5495 LogFile.Close() ; |
|
5496 LogSession.Close() ; |
|
5497 |
|
5498 locinterface->Close() ; |
|
5499 delete callBack; |
|
5500 delete crit; |
|
5501 //a.ResetAndDestroy() ; |
|
5502 a.Close() ; |
|
5503 delete ServiceHandler ; |
|
5504 |
|
5505 __UHEAP_MARKEND ; |
|
5506 return reqerror ; |
|
5507 } |
|
5508 |
|
5509 |
|
5510 LogFile.Close() ; |
|
5511 LogSession.Close() ; |
|
5512 |
|
5513 locinterface->Close() ; |
|
5514 delete callBack; |
|
5515 delete crit; |
|
5516 //a.ResetAndDestroy() ; |
|
5517 a.Close() ; |
|
5518 delete ServiceHandler ; |
|
5519 |
|
5520 __UHEAP_MARKEND ; |
|
5521 return reqerror ; |
|
5522 |
|
5523 |
|
5524 |
|
5525 |
|
5526 |
|
5527 } |
|
5528 |
|
5529 |
|
5530 |
|
5531 |
|
5532 TInt CTestProvider ::TraceTimeOut(CStifItemParser& /*aItem*/) |
|
5533 { |
|
5534 //return KErrGeneral; |
|
5535 _LIT(KTLocTest ,"TraceTimeOut"); |
|
5536 iLog->Log(KTLocTest) ; |
|
5537 |
|
5538 TRequestStatus Status = KRequestPending ; |
|
5539 RThread FunctionThread ; |
|
5540 |
|
5541 TInt ret = FunctionThread.Create(_L(" Timeouttrace Thread") , TraceTO ,KDefaultStackSize , |
|
5542 KMinHeapSize , 0x5000 ,(TAny *) NULL); |
|
5543 |
|
5544 if(ret == KErrNone) |
|
5545 { |
|
5546 FunctionThread.Logon(Status) ; |
|
5547 FunctionThread.Resume() ; |
|
5548 |
|
5549 User :: WaitForRequest (Status) ; |
|
5550 |
|
5551 |
|
5552 ret = Status.Int() ; |
|
5553 } |
|
5554 FunctionThread.Close(); |
|
5555 |
|
5556 if(ret == SErrServiceInUse) |
|
5557 { |
|
5558 _LIT(KLog , "Return Type is valid"); |
|
5559 iLog->Log(KLog); |
|
5560 } |
|
5561 |
|
5562 else |
|
5563 { |
|
5564 _LIT(KLog , "Return type is not valid\n") ; |
|
5565 iLog->Log(KLog) ; |
|
5566 } |
|
5567 return KErrNone ; |
|
5568 |
|
5569 } |
|
5570 |
|
5571 TInt CTestProvider ::TraceMultipleWrongCancel(CStifItemParser& /*aItem*/) |
|
5572 { |
|
5573 __UHEAP_MARK ; |
|
5574 RFile LogFile ; |
|
5575 RFs LogSession ; |
|
5576 TBuf8<50> data ; |
|
5577 TRealFormat format ; |
|
5578 |
|
5579 |
|
5580 if(LogSession.Connect() != KErrNone) |
|
5581 { |
|
5582 _LIT(KLog , "Failed to connect to file server") ; |
|
5583 iLog->Log(KLog) ; |
|
5584 return KErrGeneral ; |
|
5585 } |
|
5586 |
|
5587 |
|
5588 _LIT(LogFileNameCancel , "C:\\cancelinvalid.txt") ; |
|
5589 |
|
5590 if(LogFile.Open(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) == KErrNotFound) |
|
5591 { |
|
5592 if(LogFile.Create(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) != KErrNone) |
|
5593 { |
|
5594 _LIT(KLog , "Failed to create log file\n") ; |
|
5595 iLog->Log(KLog) ; |
|
5596 return KErrGeneral ; |
|
5597 } |
|
5598 |
|
5599 } |
|
5600 |
|
5601 _LIT(KLog , "In CancelWithInvalidTransactionID\n") ; |
|
5602 data.Copy(KLog); |
|
5603 LogFile.Write(data) ; |
|
5604 |
|
5605 |
|
5606 |
|
5607 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
5608 |
|
5609 // Input and output parameter list |
|
5610 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
5611 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
5612 |
|
5613 |
|
5614 |
|
5615 |
|
5616 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
|
5617 |
|
5618 |
|
5619 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
5620 |
|
5621 RCriteriaArray a; |
|
5622 a.AppendL(crit); |
|
5623 |
|
5624 ServiceHandler->AttachL(a) ; |
|
5625 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
5626 |
|
5627 |
|
5628 |
|
5629 |
|
5630 TInt pos = 0; |
|
5631 |
|
5632 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
|
5633 |
|
5634 if(!errorprm) |
|
5635 { |
|
5636 |
|
5637 return KErrGeneral ; |
|
5638 } |
|
5639 |
|
5640 |
|
5641 _LIT8(KDataSource, "ILocation"); |
|
5642 |
|
5643 pos = 0 ; |
|
5644 |
|
5645 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
|
5646 |
|
5647 if(!genericparm) |
|
5648 { |
|
5649 |
|
5650 return KErrGeneral ; |
|
5651 } |
|
5652 |
|
5653 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
|
5654 |
|
5655 |
|
5656 |
|
5657 TBuf8<20>CmdBuf(KTraceLocation) ; |
|
5658 |
|
5659 outputlist->Reset() ; |
|
5660 inputlist->Reset() ; |
|
5661 ASyncLocCBF* callBack = new(ELeave) ASyncLocCBF; |
|
5662 //Make the first call |
|
5663 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous, callBack); |
|
5664 |
|
5665 pos = 0 ; |
|
5666 |
|
5667 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
5668 |
|
5669 if(!ErrorParm) |
|
5670 { |
|
5671 _LIT(Klog , "Success/Failure error code missing from outputlist\n") ; |
|
5672 data.Copy(Klog); |
|
5673 LogFile.Write(data) ; |
|
5674 |
|
5675 //LogFile.Write(Klog) ; |
|
5676 return KErrGeneral ; |
|
5677 } |
|
5678 |
|
5679 TInt reqerror = (ErrorParm->Value()).AsTInt32(); |
|
5680 _LIT(Klog , "ERRor code from getlocationasynch ") ; |
|
5681 data.Copy(Klog); |
|
5682 LogFile.Write(data) ; |
|
5683 |
|
5684 //LogFile.Write(Klog) ; |
|
5685 |
|
5686 TReal64 errordata = reqerror ; |
|
5687 data.Num(errordata , format) ; |
|
5688 |
|
5689 |
|
5690 LogFile.Write(data) ; |
|
5691 |
|
5692 |
|
5693 pos = 0; |
|
5694 |
|
5695 _LIT8(KTransactionId, "TransactionID"); |
|
5696 const TLiwGenericParam *transid = outputlist->FindFirst(pos ,KTransactionId ) ; |
|
5697 |
|
5698 |
|
5699 if(!transid) |
|
5700 { |
|
5701 _LIT(KTran,"Missing Transaction ID\n"); |
|
5702 data.Copy(KTran); |
|
5703 LogFile.Write(data) ; |
|
5704 //LogFile.Write(KTran); |
|
5705 return KErrGeneral; |
|
5706 } |
|
5707 TInt32 trid = (transid->Value()).AsTInt32(); |
|
5708 outputlist->Reset() ; |
|
5709 inputlist->Reset() ; |
|
5710 //Make second call |
|
5711 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous, callBack); |
|
5712 pos = 0 ; |
|
5713 |
|
5714 const TLiwGenericParam *ErrorParm1 = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
5715 |
|
5716 if(!ErrorParm1) |
|
5717 { |
|
5718 _LIT(Klog , "Success/Failure error code missing from outputlist\n") ; |
|
5719 data.Copy(Klog); |
|
5720 LogFile.Write(data) ; |
|
5721 |
|
5722 //LogFile.Write(Klog) ; |
|
5723 return KErrGeneral ; |
|
5724 } |
|
5725 |
|
5726 TInt reqerror1 = (ErrorParm1->Value()).AsTInt32(); |
|
5727 _LIT(Klog1 , "ERRor code from getlocationasynch ") ; |
|
5728 data.Copy(Klog1); |
|
5729 LogFile.Write(data) ; |
|
5730 |
|
5731 //LogFile.Write(Klog) ; |
|
5732 |
|
5733 TReal64 errordata1 = reqerror1 ; |
|
5734 data.Num(errordata1 , format) ; |
|
5735 |
|
5736 |
|
5737 LogFile.Write(data) ; |
|
5738 |
|
5739 |
|
5740 pos = 0; |
|
5741 |
|
5742 |
|
5743 const TLiwGenericParam *transid1 = outputlist->FindFirst(pos ,KTransactionId ) ; |
|
5744 |
|
5745 |
|
5746 if(!transid1) |
|
5747 { |
|
5748 _LIT(KTran,"Missing Transaction ID\n"); |
|
5749 data.Copy(KTran); |
|
5750 LogFile.Write(data) ; |
|
5751 //LogFile.Write(KTran); |
|
5752 return KErrGeneral; |
|
5753 } |
|
5754 TInt32 trid1 = (transid1->Value()).AsTInt32(); |
|
5755 outputlist->Reset() ; |
|
5756 inputlist->Reset() ; |
|
5757 |
|
5758 ///////////////Cancel first call by using CancelNotification |
|
5759 _LIT8(KCancel , "CancelNotification") ; |
|
5760 _LIT8( KType ,"CancelRequestType") ; |
|
5761 _LIT( KTraceCancel ,"TraceCancel") ; |
|
5762 inputlist->AppendL(TLiwGenericParam (KType , TLiwVariant (KTraceCancel))) ; |
|
5763 |
|
5764 locinterface->ExecuteCmdL(KCancel , *inputlist , *outputlist) ; |
|
5765 |
|
5766 pos = 0 ; |
|
5767 const TLiwGenericParam *errprm = outputlist->FindFirst(pos , KErrCode) ; |
|
5768 |
|
5769 if(!errprm) |
|
5770 { |
|
5771 _LIT(Kerr, "Success/Failure code missing from outputlist") ; |
|
5772 iLog->Log(Kerr) ; |
|
5773 } |
|
5774 |
|
5775 |
|
5776 |
|
5777 TLiwVariant var = errprm->Value() ; |
|
5778 |
|
5779 |
|
5780 |
|
5781 |
|
5782 //Cancel the second call the usual way |
|
5783 inputlist->Reset(); |
|
5784 inputlist->AppendL(TLiwGenericParam(KTransactionId,TLiwVariant(trid1))); |
|
5785 |
|
5786 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptCancel); |
|
5787 |
|
5788 ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
5789 |
|
5790 if(!ErrorParm) |
|
5791 { |
|
5792 _LIT(Klog , "Success/Failure error code missing from outputlist in cancel\n ") ; |
|
5793 data.Copy(Klog); |
|
5794 LogFile.Write(data) ; |
|
5795 //LogFile.Write(Klog); |
|
5796 return KErrGeneral ; |
|
5797 } |
|
5798 |
|
5799 reqerror = (ErrorParm->Value()).AsTInt32(); |
|
5800 |
|
5801 _LIT(Klog3 , "\nERRor code from cancel ") ; |
|
5802 |
|
5803 data.Copy(Klog3); |
|
5804 LogFile.Write(data) ; |
|
5805 //LogFile.Write(Klog1) ; |
|
5806 |
|
5807 errordata = reqerror ; |
|
5808 data.Num(errordata , format) ; |
|
5809 |
|
5810 |
|
5811 LogFile.Write(data) ; |
|
5812 |
|
5813 if( KErrNone != reqerror || var.AsTInt32() != KErrNone) |
|
5814 { |
|
5815 LogFile.Close() ; |
|
5816 LogSession.Close() ; |
|
5817 |
|
5818 locinterface->Close() ; |
|
5819 delete callBack; |
|
5820 delete crit; |
|
5821 //a.ResetAndDestroy() ; |
|
5822 a.Close() ; |
|
5823 delete ServiceHandler ; |
|
5824 |
|
5825 __UHEAP_MARKEND ; |
|
5826 return KErrGeneral ; |
|
5827 } |
|
5828 |
|
5829 |
|
5830 LogFile.Close() ; |
|
5831 LogSession.Close() ; |
|
5832 |
|
5833 locinterface->Close() ; |
|
5834 delete callBack; |
|
5835 delete crit; |
|
5836 //a.ResetAndDestroy() ; |
|
5837 a.Close() ; |
|
5838 delete ServiceHandler ; |
|
5839 |
|
5840 __UHEAP_MARKEND ; |
|
5841 return reqerror ; |
|
5842 |
|
5843 |
|
5844 |
|
5845 } |
|
5846 |
|
5847 |
|
5848 TInt CTestProvider ::EnableAccTrueGetLoc(CStifItemParser& /*aItem*/) |
|
5849 { |
|
5850 //return KErrGeneral; |
|
5851 _LIT(KTLocTest ,"EnableAccTrueGetLoc"); |
|
5852 iLog->Log(KTLocTest) ; |
|
5853 TInt flag = 1; |
|
5854 TInt *flagAddr = &flag; |
|
5855 TRequestStatus Status = KRequestPending ; |
|
5856 RThread FunctionThread ; |
|
5857 |
|
5858 TInt ret = FunctionThread.Create(_L(" EnableAccTrueGetLoc Thread") , EnableHighAcc ,KDefaultStackSize , |
|
5859 KMinHeapSize , 0x5000 ,(TAny *) flagAddr); |
|
5860 |
|
5861 if(ret == KErrNone) |
|
5862 { |
|
5863 FunctionThread.Logon(Status) ; |
|
5864 FunctionThread.Resume() ; |
|
5865 |
|
5866 User :: WaitForRequest (Status) ; |
|
5867 |
|
5868 |
|
5869 ret = Status.Int() ; |
|
5870 } |
|
5871 FunctionThread.Close(); |
|
5872 |
|
5873 |
|
5874 return ret ; |
|
5875 |
|
5876 } |
|
5877 |
|
5878 TInt CTestProvider ::EnableAccFalseGetLoc(CStifItemParser& /*aItem*/) |
|
5879 { |
|
5880 //return KErrGeneral; |
|
5881 _LIT(KTLocTest ,"EnableAccTrueGetLoc"); |
|
5882 iLog->Log(KTLocTest) ; |
|
5883 TInt flag = 2; |
|
5884 TInt *flagAddr = &flag; |
|
5885 TRequestStatus Status = KRequestPending ; |
|
5886 RThread FunctionThread ; |
|
5887 |
|
5888 TInt ret = FunctionThread.Create(_L(" EnableAccTrueGetLoc Thread") , EnableHighAcc ,KDefaultStackSize , |
|
5889 KMinHeapSize , 0x5000 ,(TAny *) flagAddr); |
|
5890 |
|
5891 if(ret == KErrNone) |
|
5892 { |
|
5893 FunctionThread.Logon(Status) ; |
|
5894 FunctionThread.Resume() ; |
|
5895 |
|
5896 User :: WaitForRequest (Status) ; |
|
5897 |
|
5898 |
|
5899 ret = Status.Int() ; |
|
5900 } |
|
5901 FunctionThread.Close(); |
|
5902 |
|
5903 if(ret == SErrServiceInUse) |
|
5904 { |
|
5905 _LIT(KLog , "Return Type is valid"); |
|
5906 iLog->Log(KLog); |
|
5907 } |
|
5908 |
|
5909 else |
|
5910 { |
|
5911 _LIT(KLog , "Return type is not valid\n") ; |
|
5912 iLog->Log(KLog) ; |
|
5913 } |
|
5914 return KErrNone ; |
|
5915 |
|
5916 } |
|
5917 |
|
5918 |
|
5919 |
|
5920 TInt CTestProvider ::EnableAccTrueTrace(CStifItemParser& /*aItem*/) |
|
5921 { |
|
5922 //return KErrGeneral; |
|
5923 _LIT(KTLocTest ,"EnableAccTrueGetLoc"); |
|
5924 iLog->Log(KTLocTest) ; |
|
5925 TInt flag = 3; |
|
5926 TInt *flagAddr = &flag; |
|
5927 TRequestStatus Status = KRequestPending ; |
|
5928 RThread FunctionThread ; |
|
5929 |
|
5930 TInt ret = FunctionThread.Create(_L(" EnableAccTrueGetLoc Thread") , EnableHighAcc ,KDefaultStackSize , |
|
5931 KMinHeapSize , 0x5000 ,(TAny *) flagAddr); |
|
5932 |
|
5933 if(ret == KErrNone) |
|
5934 { |
|
5935 FunctionThread.Logon(Status) ; |
|
5936 FunctionThread.Resume() ; |
|
5937 |
|
5938 User :: WaitForRequest (Status) ; |
|
5939 |
|
5940 |
|
5941 ret = Status.Int() ; |
|
5942 } |
|
5943 FunctionThread.Close(); |
|
5944 |
|
5945 if(ret == SErrServiceInUse) |
|
5946 { |
|
5947 _LIT(KLog , "Return Type is valid"); |
|
5948 iLog->Log(KLog); |
|
5949 } |
|
5950 |
|
5951 else |
|
5952 { |
|
5953 _LIT(KLog , "Return type is not valid\n") ; |
|
5954 iLog->Log(KLog) ; |
|
5955 } |
|
5956 return KErrNone ; |
|
5957 |
|
5958 } |
|
5959 |
|
5960 TInt CTestProvider ::EnableAccFalseTrace(CStifItemParser& /*aItem*/) |
|
5961 { |
|
5962 //return KErrGeneral; |
|
5963 _LIT(KTLocTest ,"EnableAccTrueGetLoc"); |
|
5964 iLog->Log(KTLocTest) ; |
|
5965 TInt flag = 4; |
|
5966 TInt *flagAddr = &flag; |
|
5967 TRequestStatus Status = KRequestPending ; |
|
5968 RThread FunctionThread ; |
|
5969 |
|
5970 TInt ret = FunctionThread.Create(_L(" EnableAccTrueGetLoc Thread") , EnableHighAcc ,KDefaultStackSize , |
|
5971 KMinHeapSize , 0x5000 ,(TAny *) flagAddr); |
|
5972 |
|
5973 if(ret == KErrNone) |
|
5974 { |
|
5975 FunctionThread.Logon(Status) ; |
|
5976 FunctionThread.Resume() ; |
|
5977 |
|
5978 User :: WaitForRequest (Status) ; |
|
5979 |
|
5980 |
|
5981 ret = Status.Int() ; |
|
5982 } |
|
5983 FunctionThread.Close(); |
|
5984 |
|
5985 if(ret == SErrServiceInUse) |
|
5986 { |
|
5987 _LIT(KLog , "Return Type is valid"); |
|
5988 iLog->Log(KLog); |
|
5989 } |
|
5990 |
|
5991 else |
|
5992 { |
|
5993 _LIT(KLog , "Return type is not valid\n") ; |
|
5994 iLog->Log(KLog) ; |
|
5995 } |
|
5996 return KErrNone ; |
|
5997 |
|
5998 } |
|
5999 |
|
6000 |
|
6001 TInt CTestProvider ::EnableAccPosBasedGetloc(CStifItemParser& /*aItem*/) |
|
6002 { |
|
6003 //return KErrGeneral; |
|
6004 _LIT(KTLocTest ,"EnableAccTrueGetLoc"); |
|
6005 iLog->Log(KTLocTest) ; |
|
6006 TInt flag = 1; |
|
6007 TInt *flagAddr = &flag; |
|
6008 TRequestStatus Status = KRequestPending ; |
|
6009 RThread FunctionThread ; |
|
6010 |
|
6011 TInt ret = FunctionThread.Create(_L(" EnableAccTrueGetLoc Thread") , EnableHighAcc_PosBased ,KDefaultStackSize , |
|
6012 KMinHeapSize , 0x5000 ,(TAny *) flagAddr); |
|
6013 |
|
6014 if(ret == KErrNone) |
|
6015 { |
|
6016 FunctionThread.Logon(Status) ; |
|
6017 FunctionThread.Resume() ; |
|
6018 |
|
6019 User :: WaitForRequest (Status) ; |
|
6020 |
|
6021 |
|
6022 ret = Status.Int() ; |
|
6023 } |
|
6024 FunctionThread.Close(); |
|
6025 |
|
6026 if(ret == SErrServiceInUse) |
|
6027 { |
|
6028 _LIT(KLog , "Return Type is valid"); |
|
6029 iLog->Log(KLog); |
|
6030 } |
|
6031 |
|
6032 else |
|
6033 { |
|
6034 _LIT(KLog , "Return type is not valid\n") ; |
|
6035 iLog->Log(KLog) ; |
|
6036 } |
|
6037 return KErrNone ; |
|
6038 |
|
6039 } |
|
6040 |
|
6041 |
|
6042 TInt CTestProvider ::EnableAccPosBasedWrongTypeGetloc(CStifItemParser& /*aItem*/) |
|
6043 { |
|
6044 //return KErrGeneral; |
|
6045 _LIT(KTLocTest ,"EnableAccTrueGetLoc"); |
|
6046 iLog->Log(KTLocTest) ; |
|
6047 TInt flag = 2; |
|
6048 TInt *flagAddr = &flag; |
|
6049 TRequestStatus Status = KRequestPending ; |
|
6050 RThread FunctionThread ; |
|
6051 |
|
6052 TInt ret = FunctionThread.Create(_L(" EnableAccTrueGetLoc Thread") , EnableHighAcc_PosBased ,KDefaultStackSize , |
|
6053 KMinHeapSize , 0x5000 ,(TAny *) flagAddr); |
|
6054 |
|
6055 if(ret == KErrNone) |
|
6056 { |
|
6057 FunctionThread.Logon(Status) ; |
|
6058 FunctionThread.Resume() ; |
|
6059 |
|
6060 User :: WaitForRequest (Status) ; |
|
6061 |
|
6062 |
|
6063 ret = Status.Int() ; |
|
6064 } |
|
6065 FunctionThread.Close(); |
|
6066 |
|
6067 if(ret == SErrServiceInUse) |
|
6068 { |
|
6069 _LIT(KLog , "Return Type is valid"); |
|
6070 iLog->Log(KLog); |
|
6071 } |
|
6072 |
|
6073 else |
|
6074 { |
|
6075 _LIT(KLog , "Return type is not valid\n") ; |
|
6076 iLog->Log(KLog) ; |
|
6077 } |
|
6078 return KErrNone ; |
|
6079 |
|
6080 } |
|
6081 |
|
6082 |
|
6083 TInt CTestProvider ::EnableAccPosBasedTrace(CStifItemParser& /*aItem*/) |
|
6084 { |
|
6085 //return KErrGeneral; |
|
6086 _LIT(KTLocTest ,"EnableAccTrueGetLoc"); |
|
6087 iLog->Log(KTLocTest) ; |
|
6088 TInt flag = 3; |
|
6089 TInt *flagAddr = &flag; |
|
6090 TRequestStatus Status = KRequestPending ; |
|
6091 RThread FunctionThread ; |
|
6092 |
|
6093 TInt ret = FunctionThread.Create(_L(" EnableAccTrueGetLoc Thread") , EnableHighAcc_PosBased ,KDefaultStackSize , |
|
6094 KMinHeapSize , 0x5000 ,(TAny *) flagAddr); |
|
6095 |
|
6096 if(ret == KErrNone) |
|
6097 { |
|
6098 FunctionThread.Logon(Status) ; |
|
6099 FunctionThread.Resume() ; |
|
6100 |
|
6101 User :: WaitForRequest (Status) ; |
|
6102 |
|
6103 |
|
6104 ret = Status.Int() ; |
|
6105 } |
|
6106 FunctionThread.Close(); |
|
6107 |
|
6108 if(ret == SErrServiceInUse) |
|
6109 { |
|
6110 _LIT(KLog , "Return Type is valid"); |
|
6111 iLog->Log(KLog); |
|
6112 } |
|
6113 |
|
6114 else |
|
6115 { |
|
6116 _LIT(KLog , "Return type is not valid\n") ; |
|
6117 iLog->Log(KLog) ; |
|
6118 } |
|
6119 return KErrNone ; |
|
6120 |
|
6121 } |
|
6122 |
|
6123 |
|
6124 |
|
6125 TInt CTestProvider ::EnableAccPosBasedWrongTypeTrace(CStifItemParser& /*aItem*/) |
|
6126 { |
|
6127 //return KErrGeneral; |
|
6128 _LIT(KTLocTest ,"EnableAccTrueGetLoc"); |
|
6129 iLog->Log(KTLocTest) ; |
|
6130 TInt flag = 4; |
|
6131 TInt *flagAddr = &flag; |
|
6132 TRequestStatus Status = KRequestPending ; |
|
6133 RThread FunctionThread ; |
|
6134 |
|
6135 TInt ret = FunctionThread.Create(_L(" EnableAccTrueGetLoc Thread") , EnableHighAcc_PosBased ,KDefaultStackSize , |
|
6136 KMinHeapSize , 0x5000 ,(TAny *) flagAddr); |
|
6137 |
|
6138 if(ret == KErrNone) |
|
6139 { |
|
6140 FunctionThread.Logon(Status) ; |
|
6141 FunctionThread.Resume() ; |
|
6142 |
|
6143 User :: WaitForRequest (Status) ; |
|
6144 |
|
6145 |
|
6146 ret = Status.Int() ; |
|
6147 } |
|
6148 FunctionThread.Close(); |
|
6149 |
|
6150 if(ret == SErrServiceInUse) |
|
6151 { |
|
6152 _LIT(KLog , "Return Type is valid"); |
|
6153 iLog->Log(KLog); |
|
6154 } |
|
6155 |
|
6156 else |
|
6157 { |
|
6158 _LIT(KLog , "Return type is not valid\n") ; |
|
6159 iLog->Log(KLog) ; |
|
6160 } |
|
6161 return KErrNone ; |
|
6162 |
|
6163 } |
|
6164 TInt CTestProvider::GetLocationPosBasedWrongVal(CStifItemParser& /*aItem*/) |
|
6165 { |
|
6166 |
|
6167 __UHEAP_MARK ; |
|
6168 RFile LogFile ; |
|
6169 RFs LogSession ; |
|
6170 TBuf8<50> data ; |
|
6171 TRealFormat format ; |
|
6172 |
|
6173 |
|
6174 if(LogSession.Connect() != KErrNone) |
|
6175 { |
|
6176 _LIT(KLog , "Failed to connect to file server") ; |
|
6177 iLog->Log(KLog) ; |
|
6178 return KErrGeneral ; |
|
6179 } |
|
6180 |
|
6181 |
|
6182 |
|
6183 |
|
6184 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
|
6185 { |
|
6186 if(LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) != KErrNone) |
|
6187 { |
|
6188 _LIT(KLog , "Failed to create notifications log file") ; |
|
6189 iLog->Log(KLog) ; |
|
6190 return KErrGeneral ; |
|
6191 } |
|
6192 |
|
6193 } |
|
6194 |
|
6195 _LIT(KLog , "In CTGetLocation") ; |
|
6196 iLog->Log(KLog) ; |
|
6197 |
|
6198 |
|
6199 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
6200 |
|
6201 // Input and output parameter list |
|
6202 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
6203 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
6204 |
|
6205 |
|
6206 |
|
6207 |
|
6208 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
|
6209 |
|
6210 |
|
6211 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
6212 |
|
6213 RCriteriaArray a; |
|
6214 a.AppendL(crit); |
|
6215 |
|
6216 ServiceHandler->AttachL(a) ; |
|
6217 |
|
6218 |
|
6219 |
|
6220 |
|
6221 |
|
6222 |
|
6223 |
|
6224 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
6225 |
|
6226 |
|
6227 |
|
6228 |
|
6229 TInt pos = 0; |
|
6230 |
|
6231 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
|
6232 |
|
6233 if(!errorprm) |
|
6234 { |
|
6235 _LIT(Klog , "Success/Failure error code missing from outputlist") ; |
|
6236 iLog->Log(Klog) ; |
|
6237 return KErrGeneral ; |
|
6238 } |
|
6239 |
|
6240 |
|
6241 _LIT8(KDataSource, "ILocation"); |
|
6242 |
|
6243 pos = 0 ; |
|
6244 |
|
6245 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
|
6246 |
|
6247 if(!genericparm) |
|
6248 { |
|
6249 _LIT(KLog , "Interface not found"); |
|
6250 iLog->Log(KLog) ; |
|
6251 return KErrGeneral ; |
|
6252 } |
|
6253 |
|
6254 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
|
6255 |
|
6256 |
|
6257 |
|
6258 TBuf8<20>CmdBuf(KCmdGetLocation) ; |
|
6259 |
|
6260 outputlist->Reset() ; |
|
6261 inputlist->Reset() ; |
|
6262 //_LIT(KClass,"GenericLocationInfo");//Invalid KClass value |
|
6263 TInt KClass = 12; |
|
6264 inputlist->AppendL( TLiwGenericParam( KNullDesC8,TLiwVariant( KClass ) ) ); |
|
6265 |
|
6266 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); |
|
6267 |
|
6268 pos = 0 ; |
|
6269 |
|
6270 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
6271 |
|
6272 if(!ErrorParm) |
|
6273 { |
|
6274 _LIT(Klog, "Success/Failure state not known") ; |
|
6275 iLog->Log(Klog) ; |
|
6276 return KErrGeneral ; |
|
6277 } |
|
6278 |
|
6279 if((ErrorParm->Value()).AsTInt32() != SErrBadArgumentType ) |
|
6280 { |
|
6281 _LIT(KLog , "ExecutecmdL failed "); |
|
6282 iLog->Log(KLog) ; |
|
6283 return (ErrorParm->Value()).AsTInt32() ; |
|
6284 } |
|
6285 |
|
6286 |
|
6287 |
|
6288 |
|
6289 LogFile.Close() ; |
|
6290 LogSession.Close() ; |
|
6291 |
|
6292 locinterface->Close() ; |
|
6293 delete ServiceHandler ; |
|
6294 a.ResetAndDestroy() ; |
|
6295 a.Close() ; |
|
6296 |
|
6297 __UHEAP_MARKEND ; |
|
6298 return KErrNone ; |
|
6299 |
|
6300 |
|
6301 |
|
6302 |
|
6303 } |
|
6304 |
|
6305 |
|
6306 TInt CTestProvider :: CancelTransIdPosBased(CStifItemParser& /*aItem*/) |
|
6307 { |
|
6308 |
|
6309 __UHEAP_MARK ; |
|
6310 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
6311 |
|
6312 // Input and output parameter list |
|
6313 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
6314 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
6315 |
|
6316 |
|
6317 |
|
6318 |
|
6319 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
|
6320 |
|
6321 |
|
6322 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
6323 |
|
6324 RCriteriaArray a; |
|
6325 a.AppendL(crit); |
|
6326 |
|
6327 ServiceHandler->AttachL(a) ; |
|
6328 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
6329 |
|
6330 |
|
6331 |
|
6332 |
|
6333 TInt pos = 0; |
|
6334 |
|
6335 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
|
6336 |
|
6337 if(!errorprm) |
|
6338 { |
|
6339 |
|
6340 return KErrGeneral ; |
|
6341 } |
|
6342 |
|
6343 |
|
6344 _LIT8(KDataSource, "ILocation"); |
|
6345 |
|
6346 pos = 0 ; |
|
6347 |
|
6348 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
|
6349 |
|
6350 if(!genericparm) |
|
6351 { |
|
6352 |
|
6353 return KErrGeneral ; |
|
6354 } |
|
6355 |
|
6356 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
|
6357 |
|
6358 |
|
6359 |
|
6360 TBuf8<20>CmdBuf(KCmdGetLocation) ; |
|
6361 |
|
6362 outputlist->Reset() ; |
|
6363 inputlist->Reset() ; |
|
6364 ASyncLocCBF* callBack = new(ELeave) ASyncLocCBF; |
|
6365 |
|
6366 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous, callBack); |
|
6367 |
|
6368 pos = 0 ; |
|
6369 |
|
6370 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
6371 |
|
6372 if(!ErrorParm) |
|
6373 { |
|
6374 return KErrGeneral ; |
|
6375 } |
|
6376 |
|
6377 TInt reqerror = (ErrorParm->Value()).AsTInt32(); |
|
6378 |
|
6379 pos = 0; |
|
6380 |
|
6381 _LIT8(KTransactionId, "TransactionID"); |
|
6382 const TLiwGenericParam *transid = outputlist->FindFirst(pos ,KTransactionId ) ; |
|
6383 if(!transid) |
|
6384 { |
|
6385 return KErrGeneral; |
|
6386 } |
|
6387 TInt32 trid = (transid->Value()).AsTInt32(); |
|
6388 outputlist->Reset() ; |
|
6389 inputlist->Reset() ; |
|
6390 |
|
6391 |
|
6392 //inputlist->AppendL(TLiwGenericParam(KTransactionId,TLiwVariant(trid))); |
|
6393 inputlist->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(trid))); |
|
6394 |
|
6395 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptCancel); |
|
6396 |
|
6397 ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
6398 |
|
6399 if(!ErrorParm) |
|
6400 { |
|
6401 return KErrGeneral ; |
|
6402 } |
|
6403 |
|
6404 reqerror = (ErrorParm->Value()).AsTInt32(); |
|
6405 TInt retr = KErrGeneral; |
|
6406 if( 0 == reqerror ) |
|
6407 { |
|
6408 retr = 0; |
|
6409 } |
|
6410 |
|
6411 locinterface->Close() ; |
|
6412 inputlist->Reset(); |
|
6413 outputlist->Reset(); |
|
6414 delete callBack; |
|
6415 delete ServiceHandler ; |
|
6416 a.ResetAndDestroy() ; |
|
6417 a.Close() ; |
|
6418 |
|
6419 __UHEAP_MARKEND ; |
|
6420 return reqerror ; |
|
6421 |
|
6422 |
|
6423 } |
|
6424 |
|
6425 TInt CTestProvider ::CancelWithoutTransId(CStifItemParser& /*aItem*/) |
|
6426 { |
|
6427 __UHEAP_MARK ; |
|
6428 RFile LogFile ; |
|
6429 RFs LogSession ; |
|
6430 TBuf8<50> data ; |
|
6431 TRealFormat format ; |
|
6432 |
|
6433 |
|
6434 if(LogSession.Connect() != KErrNone) |
|
6435 { |
|
6436 _LIT(KLog , "Failed to connect to file server") ; |
|
6437 iLog->Log(KLog) ; |
|
6438 return KErrGeneral ; |
|
6439 } |
|
6440 |
|
6441 |
|
6442 _LIT(LogFileNameCancel , "C:\\cancelinvalid.txt") ; |
|
6443 |
|
6444 if(LogFile.Open(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) == KErrNotFound) |
|
6445 { |
|
6446 if(LogFile.Create(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) != KErrNone) |
|
6447 { |
|
6448 _LIT(KLog , "Failed to create log file\n") ; |
|
6449 iLog->Log(KLog) ; |
|
6450 return KErrGeneral ; |
|
6451 } |
|
6452 |
|
6453 } |
|
6454 |
|
6455 _LIT(KLog , "In CancelWithInvalidTransactionID\n") ; |
|
6456 data.Copy(KLog); |
|
6457 LogFile.Write(data) ; |
|
6458 |
|
6459 |
|
6460 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
6461 |
|
6462 // Input and output parameter list |
|
6463 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
6464 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
6465 |
|
6466 |
|
6467 |
|
6468 |
|
6469 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
|
6470 |
|
6471 |
|
6472 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
6473 |
|
6474 RCriteriaArray a; |
|
6475 a.AppendL(crit); |
|
6476 |
|
6477 ServiceHandler->AttachL(a) ; |
|
6478 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
6479 |
|
6480 |
|
6481 |
|
6482 |
|
6483 TInt pos = 0; |
|
6484 |
|
6485 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
|
6486 |
|
6487 if(!errorprm) |
|
6488 { |
|
6489 |
|
6490 return KErrGeneral ; |
|
6491 } |
|
6492 |
|
6493 |
|
6494 _LIT8(KDataSource, "ILocation"); |
|
6495 |
|
6496 pos = 0 ; |
|
6497 |
|
6498 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
|
6499 |
|
6500 if(!genericparm) |
|
6501 { |
|
6502 |
|
6503 return KErrGeneral ; |
|
6504 } |
|
6505 |
|
6506 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
|
6507 |
|
6508 |
|
6509 |
|
6510 TBuf8<20>CmdBuf(KCmdGetLocation) ; |
|
6511 |
|
6512 outputlist->Reset() ; |
|
6513 inputlist->Reset() ; |
|
6514 ASyncLocCBF* callBack ; |
|
6515 |
|
6516 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous, callBack); |
|
6517 |
|
6518 pos = 0 ; |
|
6519 |
|
6520 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
6521 |
|
6522 if(!ErrorParm) |
|
6523 { |
|
6524 _LIT(Klog , "Success/Failure error code missing from outputlist\n") ; |
|
6525 data.Copy(Klog); |
|
6526 LogFile.Write(data) ; |
|
6527 |
|
6528 //LogFile.Write(Klog) ; |
|
6529 return KErrGeneral ; |
|
6530 } |
|
6531 |
|
6532 TInt reqerror = (ErrorParm->Value()).AsTInt32(); |
|
6533 _LIT(Klog , "ERRor code from getlocationasynch ") ; |
|
6534 data.Copy(Klog); |
|
6535 LogFile.Write(data) ; |
|
6536 |
|
6537 //LogFile.Write(Klog) ; |
|
6538 |
|
6539 TReal64 errordata = reqerror ; |
|
6540 data.Num(errordata , format) ; |
|
6541 |
|
6542 |
|
6543 LogFile.Write(data) ; |
|
6544 |
|
6545 |
|
6546 pos = 0; |
|
6547 |
|
6548 _LIT8(KTransactionId, "TransactionID"); |
|
6549 const TLiwGenericParam *transid = outputlist->FindFirst(pos ,KTransactionId ) ; |
|
6550 if(!transid) |
|
6551 { |
|
6552 _LIT(KTran,"Missing Transaction ID\n"); |
|
6553 data.Copy(KTran); |
|
6554 LogFile.Write(data) ; |
|
6555 //LogFile.Write(KTran); |
|
6556 return KErrGeneral; |
|
6557 } |
|
6558 TInt trid = (transid->Value()).AsTInt32(); |
|
6559 outputlist->Reset() ; |
|
6560 inputlist->Reset() ; |
|
6561 |
|
6562 |
|
6563 //No trans Id is passed |
|
6564 //inputlist->AppendL(TLiwGenericParam(KTransactionId,TLiwVariant(trid-2))); |
|
6565 |
|
6566 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptCancel); |
|
6567 |
|
6568 ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
6569 |
|
6570 if(!ErrorParm) |
|
6571 { |
|
6572 _LIT(Klog , "Success/Failure error code missing from outputlist in cancel\n ") ; |
|
6573 data.Copy(Klog); |
|
6574 LogFile.Write(data) ; |
|
6575 //LogFile.Write(Klog); |
|
6576 return KErrGeneral ; |
|
6577 } |
|
6578 |
|
6579 reqerror = (ErrorParm->Value()).AsTInt32(); |
|
6580 |
|
6581 _LIT(Klog1 , "\nERRor code from cancel ") ; |
|
6582 |
|
6583 data.Copy(Klog1); |
|
6584 LogFile.Write(data) ; |
|
6585 //LogFile.Write(Klog1) ; |
|
6586 |
|
6587 errordata = reqerror ; |
|
6588 data.Num(errordata , format) ; |
|
6589 |
|
6590 |
|
6591 LogFile.Write(data) ; |
|
6592 |
|
6593 |
|
6594 TInt retr = KErrGeneral; |
|
6595 if( 1002 == reqerror ) |
|
6596 { |
|
6597 retr = 0; |
|
6598 } |
|
6599 |
|
6600 |
|
6601 |
|
6602 |
|
6603 |
|
6604 |
|
6605 LogFile.Close() ; |
|
6606 LogSession.Close() ; |
|
6607 |
|
6608 locinterface->Close() ; |
|
6609 delete ServiceHandler ; |
|
6610 a.ResetAndDestroy() ; |
|
6611 a.Close() ; |
|
6612 |
|
6613 __UHEAP_MARKEND ; |
|
6614 return retr ; |
|
6615 |
|
6616 } |
|
6617 |
|
6618 TInt CTestProvider :: GetLocationAsyncPosBasedUpdate(CStifItemParser& /*aItem*/) |
|
6619 { |
|
6620 TRequestStatus Status = KRequestPending ; |
|
6621 RThread FunctionThread ; |
|
6622 |
|
6623 FunctionThread.Create(_L("GetLocationAsynchThread2") , GetLocAsynchPosBased ,KDefaultStackSize , |
|
6624 KMinHeapSize , 0x5000 ,(TAny *) NULL); |
|
6625 |
|
6626 FunctionThread.Logon(Status) ; |
|
6627 FunctionThread.Resume() ; |
|
6628 |
|
6629 User :: WaitForRequest (Status) ; |
|
6630 FunctionThread.Close(); |
|
6631 |
|
6632 return Status.Int() ; |
|
6633 |
|
6634 } |
|
6635 |
|
6636 TInt CTestProvider :: GetLocationAsyncWrongUpdate(CStifItemParser& /*aItem*/) |
|
6637 { |
|
6638 TRequestStatus Status = KRequestPending ; |
|
6639 RThread FunctionThread ; |
|
6640 |
|
6641 FunctionThread.Create(_L("GetLocationAsynchThread2") , GetLocAsynchWrongVal ,KDefaultStackSize , |
|
6642 KMinHeapSize , 0x5000 ,(TAny *) NULL); |
|
6643 // FunctionThread.Create(_L("GetLocationAsynchThread1") , GetLocAsynchWrongVal ,KDefaultStackSize , |
|
6644 // NULL , NULL,(TAny *) NULL); |
|
6645 |
|
6646 FunctionThread.Logon(Status) ; |
|
6647 FunctionThread.Resume() ; |
|
6648 |
|
6649 User :: WaitForRequest (Status) ; |
|
6650 FunctionThread.Close(); |
|
6651 |
|
6652 return Status.Int() ; |
|
6653 |
|
6654 } |
|
6655 |
|
6656 TInt CTestProvider::GetLocPosBasedWrongVal(CStifItemParser& /*aItem*/) |
|
6657 { |
|
6658 __UHEAP_MARK ; |
|
6659 RFile LogFile ; |
|
6660 RFs LogSession ; |
|
6661 TBuf8<50> data ; |
|
6662 TRealFormat format ; |
|
6663 |
|
6664 |
|
6665 if(LogSession.Connect() != KErrNone) |
|
6666 { |
|
6667 _LIT(KLog , "Failed to connect to file server") ; |
|
6668 iLog->Log(KLog) ; |
|
6669 return KErrGeneral ; |
|
6670 } |
|
6671 |
|
6672 |
|
6673 |
|
6674 |
|
6675 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
|
6676 { |
|
6677 if(LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) != KErrNone) |
|
6678 { |
|
6679 _LIT(KLog , "Failed to create notifications log file") ; |
|
6680 iLog->Log(KLog) ; |
|
6681 return KErrGeneral ; |
|
6682 } |
|
6683 |
|
6684 } |
|
6685 |
|
6686 _LIT(KLog , "In CTGetLocation") ; |
|
6687 iLog->Log(KLog) ; |
|
6688 |
|
6689 |
|
6690 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
6691 |
|
6692 // Input and output parameter list |
|
6693 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
6694 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
6695 |
|
6696 |
|
6697 |
|
6698 |
|
6699 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
|
6700 |
|
6701 |
|
6702 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
6703 |
|
6704 RCriteriaArray a; |
|
6705 a.AppendL(crit); |
|
6706 |
|
6707 ServiceHandler->AttachL(a) ; |
|
6708 |
|
6709 |
|
6710 |
|
6711 |
|
6712 |
|
6713 |
|
6714 |
|
6715 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
6716 |
|
6717 |
|
6718 |
|
6719 |
|
6720 TInt pos = 0; |
|
6721 |
|
6722 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
|
6723 |
|
6724 if(!errorprm) |
|
6725 { |
|
6726 _LIT(Klog , "Success/Failure error code missing from outputlist") ; |
|
6727 iLog->Log(Klog) ; |
|
6728 return KErrGeneral ; |
|
6729 } |
|
6730 |
|
6731 |
|
6732 _LIT8(KDataSource, "ILocation"); |
|
6733 |
|
6734 pos = 0 ; |
|
6735 |
|
6736 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
|
6737 |
|
6738 if(!genericparm) |
|
6739 { |
|
6740 _LIT(KLog , "Interface not found"); |
|
6741 iLog->Log(KLog) ; |
|
6742 return KErrGeneral ; |
|
6743 } |
|
6744 |
|
6745 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
|
6746 |
|
6747 |
|
6748 |
|
6749 TBuf8<20>CmdBuf(KCmdGetLocation) ; |
|
6750 |
|
6751 outputlist->Reset() ; |
|
6752 inputlist->Reset() ; |
|
6753 _LIT(KClass,"GenericLocationInfo"); |
|
6754 inputlist->AppendL( TLiwGenericParam( KNullDesC8,TLiwVariant( KClass ) ) ); |
|
6755 |
|
6756 TInt updatemap =12 ; |
|
6757 |
|
6758 inputlist->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(updatemap))); |
|
6759 |
|
6760 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); |
|
6761 |
|
6762 pos = 0 ; |
|
6763 |
|
6764 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
6765 |
|
6766 if(!ErrorParm) |
|
6767 { |
|
6768 _LIT(Klog, "Success/Failure state not known") ; |
|
6769 iLog->Log(Klog) ; |
|
6770 return KErrGeneral ; |
|
6771 } |
|
6772 |
|
6773 if((ErrorParm->Value()).AsTInt32() != 1002) |
|
6774 { |
|
6775 _LIT(KLog , "ExecutecmdL failed "); |
|
6776 iLog->Log(KLog) ; |
|
6777 return KErrGeneral; |
|
6778 } |
|
6779 |
|
6780 LogFile.Close() ; |
|
6781 LogSession.Close() ; |
|
6782 |
|
6783 locinterface->Close() ; |
|
6784 delete ServiceHandler ; |
|
6785 a.ResetAndDestroy() ; |
|
6786 a.Close() ; |
|
6787 |
|
6788 __UHEAP_MARKEND ; |
|
6789 return KErrNone ; |
|
6790 |
|
6791 |
|
6792 } |
|
6793 |
|
6794 |
|
6795 TInt CTestProvider::GetLocPosBasedWrongVal1(CStifItemParser& /*aItem*/) |
|
6796 { |
|
6797 //currently not needed |
|
6798 |
|
6799 } |
|
6800 |
|
6801 |
|
6802 TInt CTestProvider :: TracePosBasedWrongVal( CStifItemParser& /*aItem*/ ) |
|
6803 { |
|
6804 __UHEAP_MARK ; |
|
6805 TInt start = User::CountAllocCells(); |
|
6806 ASyncLocCBF callback; |
|
6807 |
|
6808 |
|
6809 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
6810 |
|
6811 // Input and output parameter list |
|
6812 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
6813 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
6814 |
|
6815 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
|
6816 |
|
6817 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
6818 |
|
6819 RCriteriaArray a; |
|
6820 a.AppendL(crit); |
|
6821 |
|
6822 ServiceHandler->AttachL(a) ; |
|
6823 |
|
6824 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
6825 |
|
6826 TInt pos = 0; |
|
6827 |
|
6828 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
|
6829 |
|
6830 if(!errorprm) |
|
6831 { |
|
6832 |
|
6833 return KErrGeneral ; |
|
6834 } |
|
6835 |
|
6836 |
|
6837 _LIT8(KDataSource, "ILocation"); |
|
6838 |
|
6839 pos = 0 ; |
|
6840 |
|
6841 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
|
6842 |
|
6843 if(!genericparm) |
|
6844 { |
|
6845 |
|
6846 return KErrGeneral ; |
|
6847 } |
|
6848 |
|
6849 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
|
6850 |
|
6851 |
|
6852 |
|
6853 TBuf8<20>CmdBuf(KCmdTraceLocation) ; |
|
6854 |
|
6855 outputlist->Reset() ; |
|
6856 inputlist->Reset() ; |
|
6857 _LIT8(KClass,"LocationInformationClass"); |
|
6858 //_LIT(KClassArg,"Invalid"); |
|
6859 TInt KClassArg = 12; |
|
6860 inputlist->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(KClassArg))); |
|
6861 |
|
6862 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous,&callback); |
|
6863 |
|
6864 pos = 0 ; |
|
6865 |
|
6866 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
6867 |
|
6868 if(!ErrorParm) |
|
6869 { |
|
6870 |
|
6871 return KErrGeneral ; |
|
6872 } |
|
6873 TInt error = (ErrorParm->Value()).AsTInt32(); |
|
6874 TInt retr = KErrGeneral; |
|
6875 if( SErrBadArgumentType == error ) |
|
6876 { |
|
6877 retr = KErrNone; |
|
6878 |
|
6879 |
|
6880 } |
|
6881 locinterface->Close() ; |
|
6882 outputlist->Reset() ; |
|
6883 inputlist->Reset() ; |
|
6884 delete ServiceHandler ; |
|
6885 a.ResetAndDestroy() ; |
|
6886 a.Close() ; |
|
6887 TInt end = User::CountAllocCells(); |
|
6888 __UHEAP_MARKEND ; |
|
6889 return retr; |
|
6890 |
|
6891 } |
|
6892 |
|
6893 TInt CTestProvider::TracePosBasedUpdateOpts(CStifItemParser& /*aItem*/) |
|
6894 { |
|
6895 __UHEAP_MARK ; |
|
6896 TInt start = User::CountAllocCells(); |
|
6897 ASyncLocCBF callback; |
|
6898 |
|
6899 |
|
6900 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
6901 |
|
6902 // Input and output parameter list |
|
6903 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
6904 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
6905 |
|
6906 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
|
6907 |
|
6908 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
6909 |
|
6910 RCriteriaArray a; |
|
6911 a.AppendL(crit); |
|
6912 |
|
6913 ServiceHandler->AttachL(a) ; |
|
6914 |
|
6915 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
6916 |
|
6917 TInt pos = 0; |
|
6918 |
|
6919 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
|
6920 |
|
6921 if(!errorprm) |
|
6922 { |
|
6923 |
|
6924 return KErrGeneral ; |
|
6925 } |
|
6926 |
|
6927 |
|
6928 _LIT8(KDataSource, "ILocation"); |
|
6929 |
|
6930 pos = 0 ; |
|
6931 |
|
6932 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
|
6933 |
|
6934 if(!genericparm) |
|
6935 { |
|
6936 |
|
6937 return KErrGeneral ; |
|
6938 } |
|
6939 |
|
6940 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
|
6941 |
|
6942 |
|
6943 |
|
6944 TBuf8<20>CmdBuf(KCmdTraceLocation) ; |
|
6945 |
|
6946 outputlist->Reset() ; |
|
6947 inputlist->Reset() ; |
|
6948 _LIT8(KClass,"LocationInformationClass"); |
|
6949 _LIT(KClassArg,"Invalid"); |
|
6950 |
|
6951 inputlist->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(KClassArg))); |
|
6952 |
|
6953 CLiwDefaultMap* updatemap = CLiwDefaultMap::NewL(); |
|
6954 |
|
6955 _LIT8(KInterval,"UpdateInterval"); |
|
6956 _LIT8(KTimeout,"UpdateTimeOut"); |
|
6957 _LIT8(KAge,"UpdateMaxAge"); |
|
6958 _LIT8(KPartial,"PartialUpdates"); |
|
6959 const TInt KTime = -1000000; // bad time |
|
6960 |
|
6961 updatemap->InsertL(KInterval , TLiwVariant(TInt32(2*KTime))); |
|
6962 updatemap->InsertL(KTimeout , TLiwVariant(TInt32(30*KTime))); |
|
6963 updatemap->InsertL(KAge , TLiwVariant(TInt32(0))); |
|
6964 updatemap->InsertL(KPartial , TLiwVariant(TBool(FALSE))); |
|
6965 |
|
6966 inputlist->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(updatemap))); |
|
6967 updatemap->DecRef(); |
|
6968 |
|
6969 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous,&callback); |
|
6970 |
|
6971 pos = 0 ; |
|
6972 |
|
6973 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
6974 |
|
6975 if(!ErrorParm) |
|
6976 { |
|
6977 |
|
6978 return KErrGeneral ; |
|
6979 } |
|
6980 TInt error = (ErrorParm->Value()).AsTInt32(); |
|
6981 TInt retr = KErrGeneral; |
|
6982 if( SErrBadArgumentType == error ) |
|
6983 { |
|
6984 retr = KErrNone; |
|
6985 |
|
6986 |
|
6987 } |
|
6988 locinterface->Close() ; |
|
6989 outputlist->Reset() ; |
|
6990 inputlist->Reset() ; |
|
6991 delete ServiceHandler ; |
|
6992 a.ResetAndDestroy() ; |
|
6993 a.Close() ; |
|
6994 TInt end = User::CountAllocCells(); |
|
6995 __UHEAP_MARKEND ; |
|
6996 return retr; |
|
6997 |
|
6998 } |
|
6999 |
|
7000 TInt CTestProvider::TracePosBasedUpdateWrongVal(CStifItemParser& /*aItem*/) |
|
7001 { |
|
7002 __UHEAP_MARK ; |
|
7003 TInt start = User::CountAllocCells(); |
|
7004 ASyncLocCBF callback; |
|
7005 |
|
7006 |
|
7007 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
7008 |
|
7009 // Input and output parameter list |
|
7010 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
7011 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
7012 |
|
7013 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); |
|
7014 |
|
7015 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
7016 |
|
7017 RCriteriaArray a; |
|
7018 a.AppendL(crit); |
|
7019 |
|
7020 ServiceHandler->AttachL(a) ; |
|
7021 |
|
7022 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
7023 |
|
7024 TInt pos = 0; |
|
7025 |
|
7026 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
|
7027 |
|
7028 if(!errorprm) |
|
7029 { |
|
7030 |
|
7031 return KErrGeneral ; |
|
7032 } |
|
7033 |
|
7034 |
|
7035 _LIT8(KDataSource, "ILocation"); |
|
7036 |
|
7037 pos = 0 ; |
|
7038 |
|
7039 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); |
|
7040 |
|
7041 if(!genericparm) |
|
7042 { |
|
7043 |
|
7044 return KErrGeneral ; |
|
7045 } |
|
7046 |
|
7047 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
|
7048 |
|
7049 |
|
7050 |
|
7051 TBuf8<20>CmdBuf(KCmdTraceLocation) ; |
|
7052 |
|
7053 outputlist->Reset() ; |
|
7054 inputlist->Reset() ; |
|
7055 _LIT8(KClass,"LocationInformationClass"); |
|
7056 _LIT(KClassArg,"Invalid"); |
|
7057 |
|
7058 inputlist->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(KClassArg))); |
|
7059 |
|
7060 TInt updatemap = 12; |
|
7061 |
|
7062 inputlist->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(updatemap))); |
|
7063 |
|
7064 |
|
7065 locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous,&callback); |
|
7066 |
|
7067 pos = 0 ; |
|
7068 |
|
7069 const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; |
|
7070 |
|
7071 if(!ErrorParm) |
|
7072 { |
|
7073 |
|
7074 return KErrGeneral ; |
|
7075 } |
|
7076 TInt error = (ErrorParm->Value()).AsTInt32(); |
|
7077 TInt retr = KErrGeneral; |
|
7078 if( SErrBadArgumentType == error ) |
|
7079 { |
|
7080 retr = KErrNone; |
|
7081 |
|
7082 |
|
7083 } |
|
7084 locinterface->Close() ; |
|
7085 outputlist->Reset() ; |
|
7086 inputlist->Reset() ; |
|
7087 delete ServiceHandler ; |
|
7088 a.ResetAndDestroy() ; |
|
7089 a.Close() ; |
|
7090 TInt end = User::CountAllocCells(); |
|
7091 __UHEAP_MARKEND ; |
|
7092 return retr; |
|
7093 |
|
7094 } |
|
7095 |
|
7096 |
|
7097 TInt CTestProvider ::FindDistancePositionBased(CStifItemParser& /*aItem*/) |
|
7098 { |
|
7099 __UHEAP_MARK ; |
|
7100 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
7101 |
|
7102 // Input and output parameter list |
|
7103 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
7104 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
7105 |
|
7106 |
|
7107 |
|
7108 |
|
7109 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); |
|
7110 |
|
7111 |
|
7112 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
7113 |
|
7114 RCriteriaArray a; |
|
7115 a.AppendL(crit); |
|
7116 |
|
7117 ServiceHandler->AttachL(a) ; |
|
7118 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
7119 |
|
7120 |
|
7121 |
|
7122 |
|
7123 TInt pos = 0; |
|
7124 |
|
7125 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
|
7126 |
|
7127 if(!errorprm) |
|
7128 { |
|
7129 return KErrGeneral ; |
|
7130 } |
|
7131 |
|
7132 pos = 0 ; |
|
7133 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); |
|
7134 |
|
7135 if(!genericparm) |
|
7136 { |
|
7137 |
|
7138 return KErrGeneral ; |
|
7139 } |
|
7140 |
|
7141 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
|
7142 //First set the identity information |
|
7143 |
|
7144 TBuf8<20>CmdBufSet(KRequestCalculate) ; |
|
7145 outputlist->Reset() ; |
|
7146 inputlist->Reset() ; |
|
7147 |
|
7148 CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; |
|
7149 |
|
7150 TLiwGenericParam requesttype(KNullDesC8 , TLiwVariant(KRequestDistance)) ; |
|
7151 InputList->AppendL(requesttype) ; |
|
7152 |
|
7153 |
|
7154 |
|
7155 //Inserting first input param |
|
7156 CLiwMap* SourceCoordinate = CLiwDefaultMap::NewL(); |
|
7157 TReal64 slongitude = 71.03; |
|
7158 SourceCoordinate->InsertL(KLongitudeKey,TLiwVariant(slongitude)); |
|
7159 TReal64 slatitude = 42.37; |
|
7160 SourceCoordinate->InsertL(KLatitudeKey,TLiwVariant(slatitude)); |
|
7161 TReal64 saltitude = 1; |
|
7162 SourceCoordinate->InsertL(KAltitudeKey,TLiwVariant(slatitude)); |
|
7163 |
|
7164 TLiwGenericParam scoordinate(KNullDesC8,TLiwVariant(SourceCoordinate)); |
|
7165 InputList->AppendL(scoordinate) ; |
|
7166 SourceCoordinate->DecRef() ; |
|
7167 |
|
7168 |
|
7169 |
|
7170 //Inserting 2nd input param |
|
7171 CLiwMap* DestCoordinate = CLiwDefaultMap::NewL(); |
|
7172 TReal64 dlongitude = 83.02; |
|
7173 DestCoordinate->InsertL(KLongitudeKey,TLiwVariant(dlongitude)); |
|
7174 TReal64 dlatitude = 42.42; |
|
7175 DestCoordinate->InsertL(KLatitudeKey,TLiwVariant(dlatitude)); |
|
7176 TReal64 daltitude = 1; |
|
7177 DestCoordinate->InsertL(KAltitudeKey,TLiwVariant(dlatitude)); |
|
7178 |
|
7179 TLiwGenericParam dcoordinate(KNullDesC8,TLiwVariant(DestCoordinate)); |
|
7180 InputList->AppendL(dcoordinate) ; |
|
7181 DestCoordinate->DecRef() ; |
|
7182 |
|
7183 CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; |
|
7184 |
|
7185 |
|
7186 CmdBufSet = KRequestCalculate ; |
|
7187 |
|
7188 locinterface->ExecuteCmdL(CmdBufSet , *InputList , *OutParmList); |
|
7189 |
|
7190 |
|
7191 pos = 0; |
|
7192 const TLiwGenericParam* param = OutParmList->FindFirst(pos, KErrorCode); |
|
7193 |
|
7194 |
|
7195 pos = 0; |
|
7196 const TLiwGenericParam* resultparam = OutParmList->FindFirst(pos, KMathOpResult); |
|
7197 TLiwVariant resultvariant = resultparam->Value(); |
|
7198 TReal64 distance = resultvariant.AsTReal(); |
|
7199 |
|
7200 |
|
7201 |
|
7202 |
|
7203 //Logging result into a file |
|
7204 RFile LogFile ; |
|
7205 RFs LogSession ; |
|
7206 TBuf8<50> Buffer(_L8("Distance = ")) ; |
|
7207 LogSession.Connect() ; |
|
7208 |
|
7209 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
|
7210 { |
|
7211 LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; |
|
7212 |
|
7213 } |
|
7214 |
|
7215 TInt End = 0 ; |
|
7216 |
|
7217 LogFile.Seek(ESeekEnd , End) ; //Seek to end of the file before writing |
|
7218 |
|
7219 TBuf8<50> num ; |
|
7220 TRealFormat format ; |
|
7221 //TReal64 Val = aPosition.Latitude() ; |
|
7222 num.Num(distance , format) ; |
|
7223 |
|
7224 //Logging Latitude |
|
7225 LogFile.Write(_L8("distance = ")); |
|
7226 LogFile.Write(num) ; |
|
7227 LogFile.Write(_L8("\n")) ; |
|
7228 LogFile.Close() ; |
|
7229 LogSession.Close() ; |
|
7230 |
|
7231 delete InputList ; |
|
7232 delete OutParmList ; |
|
7233 locinterface->Close() ; |
|
7234 delete ServiceHandler ; |
|
7235 a.ResetAndDestroy() ; |
|
7236 |
|
7237 __UHEAP_MARKEND ; |
|
7238 return KErrNone ; |
|
7239 |
|
7240 } |
|
7241 |
|
7242 |
|
7243 TInt CTestProvider::MoveCoordinatePosBased(CStifItemParser& /*aItem*/) |
|
7244 { |
|
7245 __UHEAP_MARK ; |
|
7246 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
7247 |
|
7248 // Input and output parameter list |
|
7249 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
7250 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
7251 |
|
7252 |
|
7253 |
|
7254 |
|
7255 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); |
|
7256 |
|
7257 |
|
7258 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
7259 |
|
7260 RCriteriaArray a; |
|
7261 a.AppendL(crit); |
|
7262 |
|
7263 ServiceHandler->AttachL(a) ; |
|
7264 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
7265 |
|
7266 |
|
7267 |
|
7268 |
|
7269 TInt pos = 0; |
|
7270 |
|
7271 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
|
7272 |
|
7273 if(!errorprm) |
|
7274 { |
|
7275 return KErrGeneral ; |
|
7276 } |
|
7277 |
|
7278 pos = 0 ; |
|
7279 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); |
|
7280 |
|
7281 if(!genericparm) |
|
7282 { |
|
7283 |
|
7284 return KErrGeneral ; |
|
7285 } |
|
7286 |
|
7287 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
|
7288 |
|
7289 TBuf8<20>CmdBuf(KRequestCalculate) ; |
|
7290 outputlist->Reset() ; |
|
7291 inputlist->Reset() ; |
|
7292 |
|
7293 |
|
7294 CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; |
|
7295 |
|
7296 TLiwGenericParam requesttype(KNullDesC8 , TLiwVariant(KRequestMove)) ; |
|
7297 InputList->AppendL(requesttype) ; |
|
7298 |
|
7299 |
|
7300 //Inserting first input param |
|
7301 CLiwMap* SourceCoordinate = CLiwDefaultMap::NewL(); |
|
7302 TReal64 slongitude = 22; |
|
7303 SourceCoordinate->InsertL(KLongitudeKey,TLiwVariant(slongitude)); |
|
7304 TReal64 slatitude = 88; |
|
7305 SourceCoordinate->InsertL(KLatitudeKey,TLiwVariant(slatitude)); |
|
7306 |
|
7307 TReal64 saltitude = 1; |
|
7308 SourceCoordinate->InsertL(KAltitudeKey,TLiwVariant(saltitude)); |
|
7309 |
|
7310 |
|
7311 |
|
7312 TLiwGenericParam scoordinate(KNullDesC8,TLiwVariant(SourceCoordinate)); |
|
7313 InputList->AppendL(scoordinate) ; |
|
7314 SourceCoordinate->DecRef() ; |
|
7315 |
|
7316 |
|
7317 |
|
7318 TReal32 distanceToMove = 345; |
|
7319 TReal32 bearingToMove = 45; |
|
7320 |
|
7321 |
|
7322 //Inserting distance by which coordinate should be moved |
|
7323 TLiwVariant distanceVal((TReal)distanceToMove); |
|
7324 TLiwGenericParam distanceParam(KNullDesC8,distanceVal); |
|
7325 InputList->AppendL(distanceParam); |
|
7326 |
|
7327 //Inserting bearing by which coordinate should be moved |
|
7328 TLiwVariant bearingVal((TReal)bearingToMove); |
|
7329 TLiwGenericParam bearingParam(KNullDesC8,bearingVal); |
|
7330 InputList->AppendL(bearingParam); |
|
7331 |
|
7332 |
|
7333 |
|
7334 |
|
7335 |
|
7336 CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; |
|
7337 |
|
7338 |
|
7339 |
|
7340 |
|
7341 locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList); |
|
7342 |
|
7343 |
|
7344 |
|
7345 |
|
7346 |
|
7347 TInt mathindex = 0; |
|
7348 |
|
7349 // calculation |
|
7350 const TLiwGenericParam *smapparam = OutParmList->FindFirst(mathindex , KLocationMap) ; |
|
7351 TLiwVariant mapVariant= smapparam->Value() ; |
|
7352 const CLiwMap *map = mapVariant.AsMap() ; |
|
7353 TCoordinate source ; |
|
7354 |
|
7355 FillCoordinatesL(source , map) ; |
|
7356 |
|
7357 TReal64 longitudeInputVal = source.Longitude(); |
|
7358 TReal64 latitudeInputVal = source.Latitude(); |
|
7359 TReal64 altitudeInputVal = source.Altitude(); |
|
7360 |
|
7361 |
|
7362 //Logging result into a file |
|
7363 RFile LogFile ; |
|
7364 RFs LogSession ; |
|
7365 TBuf8<50> Buffer(_L8("Longitude = ")) ; |
|
7366 LogSession.Connect() ; |
|
7367 |
|
7368 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
|
7369 { |
|
7370 LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; |
|
7371 |
|
7372 } |
|
7373 |
|
7374 TInt End = 0 ; |
|
7375 |
|
7376 LogFile.Seek(ESeekEnd , End) ; //Seek to end of the file before writing |
|
7377 |
|
7378 TBuf8<50> num ; |
|
7379 TRealFormat format ; |
|
7380 |
|
7381 num.Num(longitudeInputVal, format) ; |
|
7382 |
|
7383 //Logging |
|
7384 LogFile.Write(_L8("Longitude = ")); |
|
7385 LogFile.Write(num) ; |
|
7386 LogFile.Write(_L8("\n")) ; |
|
7387 //LogFile.Seek(ESeekEnd , End) ; |
|
7388 num.Num(latitudeInputVal, format) ; |
|
7389 LogFile.Write(_L8("Latitude = ")); |
|
7390 LogFile.Write(num) ; |
|
7391 LogFile.Write(_L8("\n")) ; |
|
7392 num.Num(altitudeInputVal, format) ; |
|
7393 LogFile.Write(_L8("altitude = ")); |
|
7394 LogFile.Write(num) ; |
|
7395 LogFile.Write(_L8("\n")) ; |
|
7396 LogFile.Close() ; |
|
7397 LogSession.Close() ; |
|
7398 |
|
7399 delete OutParmList ; |
|
7400 delete InputList ; |
|
7401 locinterface->Close() ; |
|
7402 delete ServiceHandler ; |
|
7403 a.ResetAndDestroy() ; |
|
7404 a.Close() ; |
|
7405 __UHEAP_MARKEND ; |
|
7406 return KErrNone ; |
|
7407 } |
|
7408 |
|
7409 TInt CTestProvider::FindBearingPosBased(CStifItemParser& /*aItem*/) |
|
7410 { |
|
7411 __UHEAP_MARK ; |
|
7412 |
|
7413 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
7414 |
|
7415 // Input and output parameter list |
|
7416 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
7417 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
7418 |
|
7419 |
|
7420 |
|
7421 |
|
7422 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); |
|
7423 |
|
7424 |
|
7425 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
7426 |
|
7427 RCriteriaArray a; |
|
7428 a.AppendL(crit); |
|
7429 |
|
7430 ServiceHandler->AttachL(a) ; |
|
7431 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
7432 |
|
7433 |
|
7434 |
|
7435 |
|
7436 TInt pos = 0; |
|
7437 |
|
7438 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
|
7439 |
|
7440 if(!errorprm) |
|
7441 { |
|
7442 return KErrGeneral ; |
|
7443 } |
|
7444 |
|
7445 pos = 0 ; |
|
7446 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); |
|
7447 |
|
7448 if(!genericparm) |
|
7449 { |
|
7450 |
|
7451 return KErrGeneral ; |
|
7452 } |
|
7453 |
|
7454 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
|
7455 TBuf8<20>CmdBuf(KRequestCalculate) ; |
|
7456 |
|
7457 CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; |
|
7458 |
|
7459 TLiwGenericParam requesttype(KNullDesC8 , TLiwVariant(KRequestBearingTo)) ; |
|
7460 InputList->AppendL(requesttype) ; |
|
7461 |
|
7462 //Inserting first input param |
|
7463 CLiwMap* SourceCoordinate = CLiwDefaultMap::NewL(); |
|
7464 TReal64 slongitude = 22; |
|
7465 SourceCoordinate->InsertL(KLongitudeKey,TLiwVariant(slongitude)); |
|
7466 TReal64 slatitude = 88; |
|
7467 SourceCoordinate->InsertL(KLatitudeKey,TLiwVariant(slatitude)); |
|
7468 TReal64 saltitude = 1; |
|
7469 SourceCoordinate->InsertL(KAltitudeKey,TLiwVariant(slatitude)); |
|
7470 |
|
7471 TLiwGenericParam scoordinate(KNullDesC8,TLiwVariant(SourceCoordinate)); |
|
7472 InputList->AppendL(scoordinate) ; |
|
7473 SourceCoordinate->DecRef() ; |
|
7474 |
|
7475 |
|
7476 |
|
7477 //Inserting 2nd input param |
|
7478 CLiwMap* DestCoordinate = CLiwDefaultMap::NewL(); |
|
7479 TReal64 dlongitude = 13; |
|
7480 DestCoordinate->InsertL(KLongitudeKey,TLiwVariant(dlongitude)); |
|
7481 TReal64 dlatitude = 77; |
|
7482 DestCoordinate->InsertL(KLatitudeKey,TLiwVariant(dlatitude)); |
|
7483 TReal64 daltitude = 1; |
|
7484 DestCoordinate->InsertL(KAltitudeKey,TLiwVariant(dlatitude)); |
|
7485 |
|
7486 TLiwGenericParam dcoordinate(KNullDesC8,TLiwVariant(DestCoordinate)); |
|
7487 InputList->AppendL(dcoordinate) ; |
|
7488 DestCoordinate->DecRef() ; |
|
7489 |
|
7490 |
|
7491 CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; |
|
7492 |
|
7493 |
|
7494 CmdBuf = KRequestCalculate ; |
|
7495 |
|
7496 locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList); |
|
7497 |
|
7498 |
|
7499 pos = 0; |
|
7500 const TLiwGenericParam* param = OutParmList->FindFirst(pos, KErrorCode); |
|
7501 |
|
7502 pos = 0; |
|
7503 const TLiwGenericParam* resultparam = OutParmList->FindFirst(pos, KMathOpResult); |
|
7504 TLiwVariant resultvariant = resultparam->Value(); |
|
7505 TReal32 bearingTo = resultvariant.AsTReal(); |
|
7506 |
|
7507 |
|
7508 |
|
7509 |
|
7510 //Logging result into a file |
|
7511 RFile LogFile ; |
|
7512 RFs LogSession ; |
|
7513 TBuf8<50> Buffer(_L8("BearingTo = ")) ; |
|
7514 LogSession.Connect() ; |
|
7515 |
|
7516 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
|
7517 { |
|
7518 LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; |
|
7519 } |
|
7520 |
|
7521 TInt End = 0 ; |
|
7522 |
|
7523 LogFile.Seek(ESeekEnd , End) ; //Seek to end of the file before writing |
|
7524 |
|
7525 TBuf8<50> num ; |
|
7526 TRealFormat format ; |
|
7527 |
|
7528 num.Num(bearingTo , format) ; |
|
7529 |
|
7530 |
|
7531 LogFile.Write(_L8("BearingTo= ")); |
|
7532 LogFile.Write(num) ; |
|
7533 LogFile.Write(_L8("\n")) ; |
|
7534 LogFile.Close() ; |
|
7535 LogSession.Close() ; |
|
7536 |
|
7537 delete OutParmList ; |
|
7538 dcoordinate.Reset() ; |
|
7539 scoordinate.Reset() ; |
|
7540 delete InputList ; |
|
7541 locinterface->Close() ; |
|
7542 inputlist->Reset() ; |
|
7543 outputlist->Reset() ; |
|
7544 delete ServiceHandler ; |
|
7545 a.ResetAndDestroy() ; |
|
7546 a.Close() ; |
|
7547 __UHEAP_MARKEND ; |
|
7548 return KErrNone ; |
|
7549 |
|
7550 |
|
7551 } |