smsprotocols/smsstack/gsmu/src/Gsmuelem.cpp
changeset 20 244d7c5f118e
parent 0 3553901f7fa8
child 24 6638e7f4bd8f
child 42 3adadc800673
child 65 630d2f34d719
equal deleted inserted replaced
19:1f776524b15c 20:244d7c5f118e
   680 			{
   680 			{
   681 			alphabet=ESmsAlphabetUCS2;
   681 			alphabet=ESmsAlphabetUCS2;
   682 			break;
   682 			break;
   683 			}
   683 			}
   684 		default:
   684 		default:
       
   685 		    LOGGSMU1("TSmsDataCodingScheme::Alphabet() WARNING! default case has been reached");
   685             break;
   686             break;
   686             // TODO - ahe - Never Panic GSMU !!!
   687  		}
   687             // has to be tested, what happens in this default case
       
   688             // Panic(KGsmuPanicNotSupportedWithDCSBits7To4);
       
   689 		}
       
   690 	return (TSmsAlphabet) alphabet;
   688 	return (TSmsAlphabet) alphabet;
   691 	} // TSmsDataCodingScheme::TSmsAlphabet
   689 	} // TSmsDataCodingScheme::TSmsAlphabet
   692 
       
   693 
   690 
   694 void TSmsDataCodingScheme::SetAlphabet(TSmsAlphabet aAlphabet)
   691 void TSmsDataCodingScheme::SetAlphabet(TSmsAlphabet aAlphabet)
   695 	{
   692 	{
   696 	LOGGSMU1("TSmsDataCodingScheme::SetAlphabet()");
   693 	LOGGSMU1("TSmsDataCodingScheme::SetAlphabet()");
   697 
   694 
   718 				}
   715 				}
   719 			break;
   716 			break;
   720 			}
   717 			}
   721 		case (ESmsDCSMessageWaitingIndicationDiscardMessage):
   718 		case (ESmsDCSMessageWaitingIndicationDiscardMessage):
   722 			{
   719 			{
   723             // TODO - ahe - Never Panic GSMU !!!
   720             if (aAlphabet!=ESmsAlphabet7Bit)
   724             // has to be tested, what happens in this default case
   721                 {
   725 			//if (aAlphabet!=ESmsAlphabet7Bit)
   722                 LOGGSMU3("TSmsDataCodingScheme::SetAlphabet() WARNING! Not Supported With Discard Message  [Bits7To4=%d], [aAlphabet=%d]", bits7to4, aAlphabet);
   726 				//Panic(KGsmuPanicNotSupportedWithDCSBits7To4);
   723                 }
   727 			break;
   724 			break;
   728 			}
   725 			}
   729 		case (ESmsDCSMessageWaitingIndication7Bit):
   726 		case (ESmsDCSMessageWaitingIndication7Bit):
   730 			{
   727 			{
   731             // TODO - ahe - Never Panic GSMU !!!
   728  			if (aAlphabet==ESmsAlphabetUCS2)
   732             // has to be tested, what happens in this default case
   729  			    {
   733 			//if (aAlphabet==ESmsAlphabet8Bit)
       
   734 				//Panic(KGsmuPanicNotSupportedWithDCSBits7To4);
       
   735 			if (aAlphabet==ESmsAlphabetUCS2)
       
   736 				iValue=(TUint8) (ESmsDCSMessageWaitingIndicationUCS2|(iValue&(~ESmsDCSBits7To4Mask)));
   730 				iValue=(TUint8) (ESmsDCSMessageWaitingIndicationUCS2|(iValue&(~ESmsDCSBits7To4Mask)));
       
   731  			    }
       
   732  			else 
       
   733                 {
       
   734         		LOGGSMU3("TSmsDataCodingScheme::SetAlphabet() WARNING! Not Supported With Discard Message  [Bits7To4=%d], [aAlphabet=%d]", bits7to4, aAlphabet);
       
   735 			    }	     
   737 			break;
   736 			break;
   738 			}
   737 			}
   739 		case (ESmsDCSMessageWaitingIndicationUCS2):
   738 		case (ESmsDCSMessageWaitingIndicationUCS2):
   740 			{
   739 			{
   741             // TODO - ahe - Never Panic GSMU !!!
   740   			if (aAlphabet==ESmsAlphabet7Bit)
   742             // has to be tested, what happens in this default case
   741 			    {
   743 			//if (aAlphabet==ESmsAlphabet8Bit)
       
   744 				//Panic(KGsmuPanicNotSupportedWithDCSBits7To4);
       
   745 			if (aAlphabet==ESmsAlphabet7Bit)
       
   746 				iValue=(TUint8) (ESmsDCSMessageWaitingIndication7Bit|(iValue&(~ESmsDCSBits7To4Mask)));
   742 				iValue=(TUint8) (ESmsDCSMessageWaitingIndication7Bit|(iValue&(~ESmsDCSBits7To4Mask)));
       
   743 			    }
       
   744 			else 
       
   745 			    {
       
   746 				LOGGSMU3("TSmsDataCodingScheme::SetAlphabet() WARNING! Not Supported With Discard Message  [Bits7To4=%d], [aAlphabet=%d]", bits7to4, aAlphabet);
       
   747 			    }
   747 			break;
   748 			break;
   748 			}
   749 			}
   749 		default:
   750 		default:
       
   751 		    LOGGSMU1("TSmsDataCodingScheme::SetAlphabet() WARNING! default case has been reached");
   750             break;
   752             break;
   751             // TODO - ahe - Never Panic GSMU !!!
   753       		}
   752             // has to be tested, what happens in this default case
       
   753 			//Panic(KGsmuPanicNotSupportedWithDCSBits7To4);
       
   754 		}
       
   755 	} // TSmsDataCodingScheme::SetAlphabet
   754 	} // TSmsDataCodingScheme::SetAlphabet
   756 
   755 
   757 
   756 
   758 TBool TSmsDataCodingScheme::Class(TSmsClass& aClass) const
   757 TBool TSmsDataCodingScheme::Class(TSmsClass& aClass) const
   759 	{
   758 	{
   812 				{
   811 				{
   813 				iValue=(TUint8) (iValue&(~ESmsClassMask)|aClass);
   812 				iValue=(TUint8) (iValue&(~ESmsClassMask)|aClass);
   814 				break;
   813 				break;
   815 				}
   814 				}
   816 			default:
   815 			default:
       
   816 		        LOGGSMU1("WARNING! default case has been reached");
   817                 break;
   817                 break;
   818             // TODO - ahe - Never Panic GSMU !!!
       
   819             // has to be tested, what happens in this default case
       
   820 				//Panic(KGsmuPanicNotSupportedWithDCSBits7To4);
       
   821 			}
   818 			}
   822 		}
   819 		}
   823 	else
   820 	else
   824 		{
   821 		{
   825 		switch (bits7to4)
   822 		switch (bits7to4)
   878 			{
   875 			{
   879 			state=(TSmsIndicationState) (iValue&ESmsIndicationStateMask);
   876 			state=(TSmsIndicationState) (iValue&ESmsIndicationStateMask);
   880 			break;
   877 			break;
   881 			}
   878 			}
   882 		default:
   879 		default:
       
   880 		    LOGGSMU1("WARNING! default case has been reached");
   883             break;
   881             break;
   884             // TODO - ahe - Never Panic GSMU !!!
   882   		}
   885             // has to be tested, what happens in this default case
       
   886 			//Panic(KGsmuPanicNotSupportedWithDCSBits7To4);
       
   887 		}
       
   888 	return state;
   883 	return state;
   889 	} // TSmsDataCodingScheme::TSmsIndicationState
   884 	} // TSmsDataCodingScheme::TSmsIndicationState
   890 
   885 
   891 
   886 
   892 void TSmsDataCodingScheme::SetIndicationState(TSmsIndicationState aState)
   887 void TSmsDataCodingScheme::SetIndicationState(TSmsIndicationState aState)
   902 			{
   897 			{
   903 			iValue=(TUint8) (aState | (iValue&(~ESmsIndicationStateMask)));
   898 			iValue=(TUint8) (aState | (iValue&(~ESmsIndicationStateMask)));
   904 			break;
   899 			break;
   905 			}
   900 			}
   906 		default:
   901 		default:
       
   902 		    LOGGSMU1("TSmsDataCodingScheme::SetIndicationState() WARNING! default case has been reached");
   907             break;
   903             break;
   908             // TODO - ahe - Never Panic GSMU !!!
   904   		}
   909             // has to be tested, what happens in this default case
       
   910 			//Panic(KGsmuPanicNotSupportedWithDCSBits7To4);
       
   911 		}
       
   912 	} // TSmsDataCodingScheme::SetIndicationState
   905 	} // TSmsDataCodingScheme::SetIndicationState
   913 
   906 
   914 
   907 
   915 TSmsDataCodingScheme::TSmsIndicationType TSmsDataCodingScheme::IndicationType() const
   908 TSmsDataCodingScheme::TSmsIndicationType TSmsDataCodingScheme::IndicationType() const
   916 	{
   909 	{
   926 			{
   919 			{
   927 			type=(TSmsIndicationType) (iValue&ESmsIndicationTypeMask);
   920 			type=(TSmsIndicationType) (iValue&ESmsIndicationTypeMask);
   928 			break;
   921 			break;
   929 			}
   922 			}
   930 		default:
   923 		default:
       
   924 		    LOGGSMU1("TSmsDataCodingScheme::IndicationType() WARNING default case has been reached");
   931             break;
   925             break;
   932             // TODO - ahe - Never Panic GSMU !!!
       
   933             // has to be tested, what happens in this default case
       
   934 			//Panic(KGsmuPanicNotSupportedWithDCSBits7To4);
       
   935 		}
   926 		}
   936 	return type;
   927 	return type;
   937 	} // TSmsDataCodingScheme::TSmsIndicationType
   928 	} // TSmsDataCodingScheme::TSmsIndicationType
   938 
   929 
   939 
   930 
   950 			{
   941 			{
   951 			iValue=(TUint8) (aType | (iValue&(~ESmsIndicationTypeMask)));
   942 			iValue=(TUint8) (aType | (iValue&(~ESmsIndicationTypeMask)));
   952 			break;
   943 			break;
   953 			}
   944 			}
   954 		default:
   945 		default:
       
   946 		    LOGGSMU1("TSmsDataCodingScheme::SetIndicationType() WARNING! default case has been reached");
   955             break;
   947             break;
   956             // TODO - ahe - Never Panic GSMU !!!
   948  		}
   957             // has to be tested, what happens in this default case
       
   958 			//Panic(KGsmuPanicNotSupportedWithDCSBits7To4);
       
   959 		}
       
   960 	} // TSmsDataCodingScheme::SetIndicationType
   949 	} // TSmsDataCodingScheme::SetIndicationType
   961 
   950 
   962 
   951 
   963 /**
   952 /**
   964  *  Allocates and creates a CSmsAlphabetConverter object, specifying an Alphabet
   953  *  Allocates and creates a CSmsAlphabetConverter object, specifying an Alphabet
  2741 
  2730 
  2742 void CSmsAddress::NewBufferL(TInt aLength)
  2731 void CSmsAddress::NewBufferL(TInt aLength)
  2743 	{
  2732 	{
  2744 	LOGGSMU1("CSmsAddress::NewBufferL()");
  2733 	LOGGSMU1("CSmsAddress::NewBufferL()");
  2745 
  2734 
  2746 	HBufC* buffer=HBufC::NewL(aLength);
  2735     HBufC* buffer=HBufC::NewL(aLength);
  2747 	delete iBuffer;
  2736     delete iBuffer;
  2748 	iBuffer=buffer;
  2737     iBuffer=buffer;
  2749 	iBuffer->Des().SetLength(aLength);
  2738     iBuffer->Des().SetLength(aLength);
  2750 	iBuffer->Des().FillZ();
  2739     iBuffer->Des().FillZ();
  2751 	} // CSmsAddress::NewBufferL
  2740 	}
  2752 
  2741 
  2753 
  2742 
  2754 void CSmsAddress::DoSetParsedAddressL(const TDesC& aAddress)
  2743 void CSmsAddress::DoSetParsedAddressL(const TDesC& aAddress)
  2755 	{
  2744 	{
  2756 	LOGGSMU1("CSmsAddress::DoSetParsedAddressL()");
  2745 	LOGGSMU2("CSmsAddress::DoSetParsedAddressL() the length of the Address [Length = %d", aAddress.Length());
  2757 
  2746 
  2758 	TInt length=aAddress.Length();
  2747 	TInt length=aAddress.Length();
  2759 	if ((iTypeOfAddress.TON()==EGsmSmsTONInternationalNumber) &&
  2748 	if ((iTypeOfAddress.TON()==EGsmSmsTONInternationalNumber) &&
  2760 	    (length && (aAddress[0]!='+')))
  2749 	    (length && (aAddress[0]!='+')))
  2761 		{
  2750 		{
  3898 				{
  3887 				{
  3899 				maxbodylengthinchars=(KSmsMaxUserDataSize-totalheaderlengthinudlunits)/2;
  3888 				maxbodylengthinchars=(KSmsMaxUserDataSize-totalheaderlengthinudlunits)/2;
  3900 				break;
  3889 				break;
  3901 				}
  3890 				}
  3902 			default:
  3891 			default:
       
  3892 			    LOGGSMU1("CSmsUserData::MaxBodyLengthInChars() WARNING! default case has been reached");
  3903                 break;
  3893                 break;
  3904             // TODO - ahe - Never Panic GSMU !!!
  3894  			}
  3905             // has to be tested, what happens in this default case
       
  3906 				//Panic(KGsmuPanicUnsupportedAlphabet);
       
  3907 			}
       
  3908 		}
  3895 		}
  3909 	return maxbodylengthinchars;
  3896 	return maxbodylengthinchars;
  3910 	} // CSmsUserData::MaxBodyLengthInChars
  3897 	} // CSmsUserData::MaxBodyLengthInChars
  3911 
  3898 
  3912 
  3899 
  4279 					{
  4266 					{
  4280 					totalheaderlengthinudlunits=totalheaderlength;
  4267 					totalheaderlengthinudlunits=totalheaderlength;
  4281 					break;
  4268 					break;
  4282 					}
  4269 					}
  4283 				default:
  4270 				default:
       
  4271 				    LOGGSMU1("CSmsUserData::TotalHeaderLengthInUDLUnits() WARNING default case has been reached");
  4284                     break;
  4272                     break;
  4285                 // TODO - ahe - Never Panic GSMU !!!
       
  4286                 // has to be tested, what happens in this default case
       
  4287 					//Panic(KGsmuPanicUnsupportedAlphabet);
       
  4288 				}
  4273 				}
  4289 			}
  4274 			}
  4290 		}
  4275 		}
  4291 	return totalheaderlengthinudlunits;
  4276 	return totalheaderlengthinudlunits;
  4292 	} // CSmsUserData::TotalHeaderLengthInUDLUnits
  4277 	} // CSmsUserData::TotalHeaderLengthInUDLUnits