epoc32/include/gsmuelem.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 gsmuelem.h
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // This file define the classes for the different PDU elements
       
    15 // 
       
    16 //
       
    17 
       
    18 
       
    19 
       
    20 /**
       
    21  @file
       
    22 */
       
    23 
       
    24 #ifndef __GSMUELEM_H__
       
    25 #define __GSMUELEM_H__
       
    26 
       
    27 // Includes
       
    28 
       
    29 #include <e32std.h>
       
    30 #include <e32base.h>
       
    31 #include <charconv.h>
       
    32 #include <gsmunmspacemobph.h>
       
    33 
       
    34 class RFs;
       
    35 class RReadStream;
       
    36 class RWriteStream;
       
    37 class CSmsEMSBufferSegmenter;
       
    38 
       
    39 
       
    40 // class declarations
       
    41 
       
    42 /**
       
    43  *  Decoding error.
       
    44  *  @publishedAll
       
    45  *  @released 
       
    46  */
       
    47 const TInt KErrGsmuDecoding = KErrCorrupt;
       
    48 /**
       
    49  *  @internalComponent
       
    50  */
       
    51 _LIT8(KMOSES,"\x40\x4d\x64\xd3\x50\x00");
       
    52 /**
       
    53  *  @internalComponent
       
    54  */
       
    55 _LIT16(KNETWORK,"NETWORK");
       
    56 
       
    57 
       
    58 // Constants
       
    59 /**
       
    60  *  @internalComponent
       
    61  */
       
    62 const TUint8 KSms7BitAlphabetEscapeChar=0x1b;
       
    63 
       
    64 
       
    65 /**
       
    66  *  Thin wrapper over TLex8 to provide leaving functions when getting the next
       
    67  *  character(s).
       
    68  *  
       
    69  *  These functions leave with KErrGsmuDecoding if there are insufficient characters
       
    70  *  remaining.
       
    71  *  @publishedAll
       
    72  *  @released
       
    73  */
       
    74 class TGsmuLex8 : public TLex8
       
    75 	{
       
    76 	public:
       
    77 		TGsmuLex8(const TDesC8& aSource);
       
    78 		TUint8 GetL();
       
    79 		void IncL(TInt aNumber = 1);
       
    80 		TPtrC8 NextWithNoIncL(TInt aLength) const;
       
    81 		TPtrC8 NextWithNoIncL(TInt aLength, TBool aAcceptTruncation) const;		
       
    82 		TPtrC8 NextAndIncL(TInt aLength);
       
    83 
       
    84 	private:
       
    85 		inline void LeaveL() const;
       
    86 	};
       
    87 
       
    88 
       
    89 /**
       
    90  *  Base class for performing all operations on octets.
       
    91  *  @publishedAll
       
    92  *  @released 
       
    93  */
       
    94 class TSmsOctet
       
    95 	{
       
    96 public:
       
    97 	inline TSmsOctet(TInt aValue);
       
    98 	inline TSmsOctet(TUint8 aValue = 0);
       
    99 	inline operator TInt() const;
       
   100 	const TSmsOctet& operator = (TInt aValue);
       
   101 	inline void FillSemiOctets(TInt aNum);
       
   102 	inline TInt SemiOctetsToNum() const;
       
   103 	TUint8* EncodeL(TUint8* aPtr) const;
       
   104 	inline void DecodeL(TGsmuLex8& aPdu);
       
   105 	inline void InternalizeL(RReadStream& aStream);
       
   106 	inline void ExternalizeL(RWriteStream& aStream) const;
       
   107 protected:
       
   108 	/** Octet value. */
       
   109 	TUint8 iValue;
       
   110 	};
       
   111 
       
   112 
       
   113 /**
       
   114  *  Bit masks for key first octet of an SMS PDU
       
   115  *  @publishedAll
       
   116  *  @released
       
   117  */
       
   118 class TSmsFirstOctet : public TSmsOctet
       
   119 	{
       
   120 public:
       
   121 /** TP-MTI (Message Type Indicator) First octet of all SMS PDUs. */
       
   122 	enum TSmsMTI
       
   123 		{
       
   124 	/** SMS-DELIVER or SMS-DELIVER-REPORT message. */
       
   125 		ESmsMTIDeliverOrDeliverReport=0x00,
       
   126 	/** SMS-SUBMIT or SMS-SUBMIT-REPORT message. */
       
   127 		ESmsMTISubmitOrSubmitReport=0x01,
       
   128 	/** SMS-STATUS or SMS-COMMAND message. */
       
   129 		ESmsMTIStatusReportOrCommand=0x02,
       
   130 
       
   131 	/** Mask for these bit flags. */
       
   132 		ESmsMTIMask=0x03
       
   133 		};
       
   134 
       
   135 /**
       
   136  *  TP-UDHI (User Data Header Indicator) Found in first octet of
       
   137  *  Submit and Deliver and possibly, Deliver Report and Status Report. 
       
   138  */
       
   139 	enum TSmsUDHI
       
   140 		{
       
   141 	/** User data header indicator not present. */
       
   142 		ESmsUDHIHeaderNotPresent=0x00,
       
   143 	/** User data header indicator present. */
       
   144 		ESmsUDHIHeaderPresent=0x40,
       
   145 
       
   146 	/** Mask for these bit flags. */
       
   147 		ESmsUDHIMask=0x40
       
   148 		};
       
   149 
       
   150 /** TP-RP (Reply Path) Found in first octet of Submit and Deliver. */
       
   151 	enum TSmsReplyPath
       
   152 		{
       
   153 	/** Reply path does not exist. */
       
   154 		ESmsReplyPathNone=0x00,
       
   155 	/** Reply path exists. */
       
   156 		ESmsReplyPathExists=0x080,
       
   157 
       
   158 	/** Mask for these bit flags. */
       
   159 		ESmsReplyPathMask=0x80
       
   160 		};
       
   161 
       
   162 /** TP-MMS (More Messages To Send) Found in Deliver and Status Report. */
       
   163 	enum TSmsMoreMessagesToSend
       
   164 		{
       
   165 	/** More messages to send. */
       
   166 		ESmsMoreMessagesToSend=0x00,
       
   167 	/** No more messages to send. */
       
   168 		ESmsNoMoreMessagesToSend=0x04,
       
   169 
       
   170 	/** Mask for these bit flags. */
       
   171 		ESmsMoreMessagesToSendMask=0x04,
       
   172 		};
       
   173 
       
   174 /** T-SRI (Status Report Indicator) Found in Status Report. */
       
   175 	enum TSmsStatusReportIndicator
       
   176 		{
       
   177 	/** Status report is not going to be returned. */
       
   178 		ESmsStatusReportNotReturned=0x00,
       
   179 	/** Status report is going to be returned. */
       
   180 		ESmsStatusReportReturned=0x20,
       
   181 
       
   182 	/** Mask for these bit flags. */
       
   183 		ESmsStatusReportIndicatorMask=0x20
       
   184 		};
       
   185 
       
   186 /** TP-RD bit flags. */
       
   187 	enum TSmsRejectDuplicates
       
   188 		/**
       
   189 		 *  T-RD (Reject Duplicates) Found in Submit
       
   190 		 */
       
   191 		{
       
   192 	/** Accept duplicates. */
       
   193 		ESmsAcceptDuplicates=0x00,
       
   194 	/** Reject duplicates. */
       
   195 		ESmsRejectDuplicates=0x04,
       
   196 
       
   197 	/** Mask for these bit flags. */
       
   198 		ESmsRejectDuplicatesMask=0x04
       
   199 		};
       
   200 
       
   201 /** T-SRQ (Status Report Qualifier). Found in Status Report. */
       
   202 	enum TSmsStatusReportQualifier
       
   203 		{
       
   204 	/** Status report result of submit. */
       
   205 		ESmsStatusReportResultOfSubmit=0x00,
       
   206 	/** Status report result of command. */
       
   207 		ESmsStatusReportResultOfCommand=0x20,
       
   208 
       
   209 	/** Mask for these bit flags. */
       
   210 		ESmsStatusReportQualifierMask=0x20
       
   211 		};
       
   212 
       
   213 /** TP-VPF (Validity Period Format). Found in Submit. */
       
   214 	enum TSmsValidityPeriodFormat
       
   215 		{
       
   216 	/** TP-VP field not present. */
       
   217 		ESmsVPFNone=0x00,
       
   218 	/** TP-VP field present. Enhanced format (7 octets). */
       
   219 		ESmsVPFEnhanced=0x08,	// was ESmsVPFReserved, the new GSM spec!
       
   220 	/** TP-VP field present, relative validity format. */
       
   221 		ESmsVPFInteger=0x10,    // relative validity period
       
   222 	/** TP-VP field present, absolute validity format. */
       
   223 		ESmsVPFSemiOctet=0x18,  // absolute validity period
       
   224 
       
   225 	/** Mask for these bit flags. */
       
   226 		ESmsVPFMask=0x18
       
   227 		};
       
   228 
       
   229 /** TP-SRR (Status Report Request) Found in Submit and Command. */
       
   230 	enum TSmsStatusReportRequest
       
   231 		{
       
   232 	/** Status report is not requested. */
       
   233 		ESmsStatusReportNotRequested=0x00,
       
   234 	/** Status report is requested. */
       
   235 		ESmsStatusReportRequested=0x20,
       
   236 
       
   237 	/** Mask for these bit flags. */
       
   238 		ESmsStatusReportRequestMask=0x20
       
   239 		};
       
   240 
       
   241 public:
       
   242 	TSmsFirstOctet(TInt aValue=0);
       
   243 	const TSmsFirstOctet& operator = (TInt aValue);  //  Review
       
   244 	};
       
   245 
       
   246 
       
   247 /**
       
   248  *  TP-FCS (Failure Cause) octet. For Deliver and Submit errors
       
   249  *  @publishedAll
       
   250  *  @released
       
   251  */
       
   252 class TSmsFailureCause : public TSmsOctet
       
   253 	{
       
   254 public:
       
   255 /** TP-FCS flags. */
       
   256 	enum TSmsFailureCauseError
       
   257 		{
       
   258 //  Reserved values
       
   259 //		....
       
   260 //		....
       
   261 //  PID errors
       
   262 	/** Telematic interworking not supported. */
       
   263 		ESmsPIDErrorTelematicInterworkingNotSupported=0x80,
       
   264 	/** Short message Type 0 not supported. */
       
   265 		ESmsPIDErrorShortMessageType0NotSupported=0x81,
       
   266 	/** Cannot replace short message. */
       
   267 		ESmsPIDErrorCannotReplaceShortMessage=0x82,
       
   268 	/** Reserved. */
       
   269 		ESmsPIDErrorReserved1=0x83,
       
   270 	/** Reserved. */
       
   271 		ESmsPIDErrorReserved2=0x84,
       
   272 	/** Reserved. */
       
   273 		ESmsPIDErrorReserved3=0x85,
       
   274 	/** Reserved. */
       
   275 		ESmsPIDErrorReserved4=0x86,
       
   276 	/** Reserved. */
       
   277 		ESmsPIDErrorReserved5=0x87,
       
   278 	/** Reserved. */
       
   279 		ESmsPIDErrorReserved6=0x88,
       
   280 	/** Reserved. */
       
   281 		ESmsPIDErrorReserved7=0x89,
       
   282 	/** Reserved. */
       
   283 		ESmsPIDErrorReserved8=0x8A,
       
   284 	/** Reserved. */
       
   285 		ESmsPIDErrorReserved9=0x8B,
       
   286 	/** Reserved. */
       
   287 		ESmsPIDErrorReserved10=0x8C,
       
   288 	/** Reserved. */
       
   289 		ESmsPIDErrorReserved11=0x8D,
       
   290 	/** Reserved. */
       
   291 		ESmsPIDErrorReserved12=0x8E,
       
   292 	/** Unspecified TP-PID error. */
       
   293 		ESmsPIDErrorUnspecified=0x8F,
       
   294 //  DCS errors
       
   295 	/** Data coding scheme (alphabet) not supported. */
       
   296 		ESmsDCSErrorAlphabetNotSupported=0x90,
       
   297 	/** Message class not supported. */
       
   298 		ESmsDCSErrorMessageClassNotSupported=0x91,
       
   299 	/** Reserved. */
       
   300 		ESmsDCSErrorReserved1=0x92,
       
   301 	/** Reserved. */
       
   302 		ESmsDCSErrorReserved2=0x93,
       
   303 	/** Reserved. */
       
   304 		ESmsDCSErrorReserved3=0x94,
       
   305 	/** Reserved. */
       
   306 		ESmsDCSErrorReserved4=0x95,
       
   307 	/** Reserved. */
       
   308 		ESmsDCSErrorReserved5=0x96,
       
   309 	/** Reserved. */
       
   310 		ESmsDCSErrorReserved6=0x97,
       
   311 	/** Reserved. */
       
   312 		ESmsDCSErrorReserved7=0x98,
       
   313 	/** Reserved. */
       
   314 		ESmsDCSErrorReserved8=0x99,
       
   315 	/** Reserved. */
       
   316 		ESmsDCSErrorReserved9=0x9A,
       
   317 	/** Reserved. */
       
   318 		ESmsDCSErrorReserved10=0x9B,
       
   319 	/** Reserved. */
       
   320 		ESmsDCSErrorReserved11=0x9C,
       
   321 	/** Reserved. */
       
   322 		ESmsDCSErrorReserved12=0x9D,
       
   323 	/** Reserved. */
       
   324 		ESmsDCSErrorReserved13=0x9E,
       
   325 	/** Reserved. */
       
   326 		ESmsDCSErrorUnspecified=0x9F,
       
   327 //  CommandErrors
       
   328 	/** Command cannot be actioned. */
       
   329 		ESmsCommandErrorCannotBeActioned=0xA0,
       
   330 	/** Command unsupported. */
       
   331 		ESmsCommandErrorUnsupported=0xA1,
       
   332 	/** Reserved. */
       
   333 		ESmsCommandErrorReserved1=0xA2,
       
   334 	/** Reserved. */
       
   335 		ESmsCommandErrorReserved2=0xA3,
       
   336 	/** Reserved. */
       
   337 		ESmsCommandErrorReserved3=0xA4,
       
   338 	/** Reserved. */
       
   339 		ESmsCommandErrorReserved4=0xA5,
       
   340 	/** Reserved. */
       
   341 		ESmsCommandErrorReserved5=0xA6,
       
   342 	/** Reserved. */
       
   343 		ESmsCommandErrorReserved6=0xA7,
       
   344 	/** Reserved. */
       
   345 		ESmsCommandErrorReserved7=0xA8,
       
   346 	/** Reserved. */
       
   347 		ESmsCommandErrorReserved8=0xA9,
       
   348 	/** Reserved. */
       
   349 		ESmsCommandErrorReserved9=0xAA,
       
   350 	/** Reserved. */
       
   351 		ESmsCommandErrorReserved10=0xAB,
       
   352 	/** Reserved. */
       
   353 		ESmsCommandErrorReserved11=0xAC,
       
   354 	/** Reserved. */
       
   355 		ESmsCommandErrorReserved12=0xAD,
       
   356 	/** Reserved. */
       
   357 		ESmsCommandErrorReserved13=0xAE,
       
   358 	/** Unspecified TP-Command error. */
       
   359 		ESmsCommandErrorUnspecified=0xAF,
       
   360 //
       
   361 	/** PDU not supported. */
       
   362 		ESmsErrorPDUNotSupported=0xB0,
       
   363 //  Reserved values
       
   364 //		....
       
   365 //		....
       
   366 	/** SC busy. */
       
   367 		ESmsErrorSCBusy=0xC0,
       
   368 	/** No SC subscription. */
       
   369 		ESmsErrorNoSCSubscription=0xC1,
       
   370 	/** SC system failure. */
       
   371 		ESmsErrorNoSCSystemFailure=0xC2,
       
   372 	/** Invalid SME address. */
       
   373 		ESmsErrorInvalidSMEAddress=0xC3,
       
   374 	/** Destination SME barred. */
       
   375 		ESmsErrorDestinationSMEBarred=0xC4,
       
   376 	/** SM Rejected-Duplicate SM. */
       
   377 		ESmsErrorSMRejectedDuplicateSM=0xC5,
       
   378 	/** TP-VPF not supported. */
       
   379 		ESmsErrorVPFNotSupported=0xC6,
       
   380 	/** TP-VP not supported. */
       
   381 		ESmsErrorVPNotSupported=0xC7,
       
   382 //  Reserved values
       
   383 //		....
       
   384 //		....
       
   385 	/** SIM SMS storage full. */
       
   386 		ESmsErrorSIMSMSStorageFull=0xD0,
       
   387 	/** No SMS storage capability in (U)SIM. */
       
   388 		ESmsErrorNoSMSStorageCapabilityOnSIM=0xD1,
       
   389 	/** Error in MS. */
       
   390 		ESmsErrorErrorInMS=0xD2,
       
   391 	/** Memory Capacity Exceeded. */
       
   392 		ESmsErrorMemoryCapacityExceded=0xD3,
       
   393 	/** (U)SIM Application Toolkit Busy. */
       
   394 		ESmsErrorSIMApplicationToolkitBusy=0xD4,
       
   395 	/** (U)SIM data download error. */
       
   396 		ESmsErrorSIMDataDownloadError=0xD5,
       
   397 //  Reserved values
       
   398 //		....
       
   399 //		....
       
   400 	/** Value specific to an application. */
       
   401 		ESmsApplicationError1=0xE0,
       
   402 	/** Value specific to an application. */
       
   403 		ESmsApplicationError2=0xE1,
       
   404 	/** Value specific to an application. */
       
   405 		ESmsApplicationError3=0xE2,
       
   406 	/** Value specific to an application. */
       
   407 		ESmsApplicationError4=0xE3,
       
   408 	/** Value specific to an application. */
       
   409 		ESmsApplicationError5=0xE4,
       
   410 	/** Value specific to an application. */
       
   411 		ESmsApplicationError6=0xE5,
       
   412 	/** Value specific to an application. */
       
   413 		ESmsApplicationError7=0xE6,
       
   414 	/** Value specific to an application. */
       
   415 		ESmsApplicationError8=0xE7,
       
   416 	/** Value specific to an application. */
       
   417 		ESmsApplicationError9=0xE8,
       
   418 	/** Value specific to an application. */
       
   419 		ESmsApplicationError10=0xE9,
       
   420 	/** Value specific to an application. */
       
   421 		ESmsApplicationError11=0xEA,
       
   422 	/** Value specific to an application. */
       
   423 		ESmsApplicationError12=0xEB,
       
   424 	/** Value specific to an application. */
       
   425 		ESmsApplicationError13=0xEC,
       
   426 	/** Value specific to an application. */
       
   427 		ESmsApplicationError14=0xED,
       
   428 	/** Value specific to an application. */
       
   429 		ESmsApplicationError15=0xEE,
       
   430 	/** Value specific to an application. */
       
   431 		ESmsApplicationError16=0xEF,
       
   432 	/** Value specific to an application. */
       
   433 		ESmsApplicationError17=0xF0,
       
   434 	/** Value specific to an application. */
       
   435 		ESmsApplicationError18=0xF1,
       
   436 	/** Value specific to an application. */
       
   437 		ESmsApplicationError19=0xF2,
       
   438 	/** Value specific to an application. */
       
   439 		ESmsApplicationError20=0xF3,
       
   440 	/** Value specific to an application. */
       
   441 		ESmsApplicationError21=0xF4,
       
   442 	/** Value specific to an application. */
       
   443 		ESmsApplicationError22=0xF5,
       
   444 	/** Value specific to an application. */
       
   445 		ESmsApplicationError23=0xF6,
       
   446 	/** Value specific to an application. */
       
   447 		ESmsApplicationError24=0xF7,
       
   448 	/** Value specific to an application. */
       
   449 		ESmsApplicationError25=0xF8,
       
   450 	/** Value specific to an application. */
       
   451 		ESmsApplicationError26=0xF9,
       
   452 	/** Value specific to an application. */
       
   453 		ESmsApplicationError27=0xFA,
       
   454 	/** Value specific to an application. */
       
   455 		ESmsApplicationError28=0xFB,
       
   456 	/** Value specific to an application. */
       
   457 		ESmsApplicationError29=0xFC,
       
   458 	/** Value specific to an application. */
       
   459 		ESmsApplicationError30=0xFD,
       
   460 	/** Value specific to an application. */
       
   461 		ESmsApplicationError31=0xFE,
       
   462 //
       
   463 	/** Unspecified error cause. */
       
   464 		ESmsErrorUnspecified=0xFF,
       
   465 
       
   466 	/**	@internalComponent	*/
       
   467 		ESmsErrorFree=0x100
       
   468 		};
       
   469 public:
       
   470 	TSmsFailureCause();
       
   471 	inline TInt Error() const;
       
   472 	inline void SetError(TSmsFailureCauseError aError);
       
   473 	};
       
   474 
       
   475 
       
   476 /**
       
   477  *  TP-ST (Status Report) octet. Found in Status Report
       
   478  *  @publishedAll
       
   479  *  @released
       
   480  */
       
   481 class TSmsStatus : public TSmsOctet
       
   482 	{
       
   483 public:
       
   484 /** TP-ST flag values. */
       
   485 	enum TSmsStatusValue
       
   486 		{
       
   487 //  Short message transaction completed
       
   488 	/** Short message received by the SME. */
       
   489 		ESmsShortMessageReceivedBySME=0x00,
       
   490 	/**
       
   491 	 *  Short message forwarded by the SC to the SME but the SC is unable to confirm
       
   492 	 *  	delivery. 
       
   493 	 */
       
   494 		ESmsShortMessageForwardedBySCToSMEButUnconfirmedBySC=0x01,
       
   495 	/** Short message replaced by the SC. */
       
   496 		ESmsShortMessageReplacedBySC=0x02,
       
   497 //  Reserved values
       
   498 //		....
       
   499 //		....
       
   500 //  Temporary error, SC still trying to transfer SM
       
   501 	/** Temporary error, SC still trying to transfer SM: congestion. */
       
   502 		ESmsTempError1StatusCongestion=0x20,
       
   503 	/** Temporary error, SC still trying to transfer SM: SME busy. */
       
   504 		ESmsTempError1StatusSMEBusy=0x21,
       
   505 	/** Temporary error, SC still trying to transfer SM: No response from SME. */
       
   506 		ESmsTempError1StatusNoResponseFromSME=0x22,
       
   507 	/** Temporary error, SC still trying to transfer SM: Service rejected. */
       
   508 		ESmsTempError1StatusServiceRejected=0x23,
       
   509 	/** Temporary error, SC still trying to transfer SM: Quality of service not available. */
       
   510 		ESmsTempError1StatusQualityOfServiceNotAvailable=0x24,
       
   511 	/** Temporary error, SC still trying to transfer SM: Error in SME. */
       
   512 		ESmsTempError1StatusErrorInSME=0x25,
       
   513 //  Reserved values
       
   514 //		....
       
   515 //		....
       
   516 //  Permanent error, SC is not making any more transfer attempts
       
   517 	/**
       
   518 	 *  Permanent error, SC is not making any more transfer attempts: Remote procedure
       
   519 	 *  	error. 
       
   520 	 */
       
   521 		ESmsPermErrorRemoteProcedureError=0x40,
       
   522 	/**
       
   523 	 *  Permanent error, SC is not making any more transfer attempts: Incompatible
       
   524 	 *  	destination. 
       
   525 	 */
       
   526 		ESmsPermErrorIncompatibleDestination=0x41,
       
   527 	/**
       
   528 	 *  Permanent error, SC is not making any more transfer attempts: Connection rejected
       
   529 	 *  	by SME. 
       
   530 	 */
       
   531 		ESmsPermErrorConnectionRejectedBySME=0x42,
       
   532 	/** Permanent error, SC is not making any more transfer attempts: Not obtainable. */
       
   533 		ESmsPermErrorNotObtainable=0x43,
       
   534 	/**
       
   535 	 *  Permanent error, SC is not making any more transfer attempts: Quality of service
       
   536 	 *  	not available. 
       
   537 	 */
       
   538 		ESmsPermErrorQualityOfServiceNotAvailable2=0x44,
       
   539 	/**
       
   540 	 *  Permanent error, SC is not making any more transfer attempts: No interworking
       
   541 	 *  	available. 
       
   542 	 */
       
   543 		ESmsPermErrorNoInterworkingAvailable=0x45,
       
   544 	/**
       
   545 	 *  Permanent error, SC is not making any more transfer attempts: SM Validity Period
       
   546 	 *  	Expired. 
       
   547 	 */
       
   548 		ESmsPermErrorSMValidityPeriodExpired=0x46,
       
   549 	/**
       
   550 	 *  Permanent error, SC is not making any more transfer attempts: SM Deleted by
       
   551 	 *  	originating SME. 
       
   552 	 */
       
   553 		ESmsPermErrorSMDeletedByOriginatingSME=0x47,
       
   554 	/**
       
   555 	 *  Permanent error, SC is not making any more transfer attempts: SM Deleted by
       
   556 	 *  	SC Administration. 
       
   557 	 */
       
   558 		ESmsPermErrorSMDeletedBySCAdministration=0x48,
       
   559 	/** Permanent error, SC is not making any more transfer attempts: SM does not exist. */
       
   560 		ESmsPermErrorDoesNotExist=0x49,
       
   561 //  Reserved values
       
   562 //		....
       
   563 //		....
       
   564 //  Temporary error, SC is not making any more transfer attempts
       
   565 	/** Temporary error, SC is not making any more transfer attempts: Congestion. */
       
   566 		ESmsTempError2Congestion=0x60,
       
   567 	/** Temporary error, SC is not making any more transfer attempts: SME Busy. */
       
   568 		ESmsTempError2SMEBusy=0x61,
       
   569 	/**
       
   570 	 *  Temporary error, SC is not making any more transfer attempts: No response from
       
   571 	 *  	SME. 
       
   572 	 */
       
   573 		ESmsTempError2NoResponseFromSME=0x62,
       
   574 	/** Temporary error, SC is not making any more transfer attempts: Service rejected. */
       
   575 		ESmsTempError2ServiceRejected=0x63,
       
   576 	/**
       
   577 	 *  Temporary error, SC is not making any more transfer attempts: Quality of service
       
   578 	 *  	not available. 
       
   579 	 */
       
   580 		ESmsTempError2QualityOfServiceNotAvailable=0x64,
       
   581 	/** Temporary error, SC is not making any more transfer attempts: Error in SME. */
       
   582 		ESmsTempError2ErrorInSME=0x65,
       
   583 //  Reserved values
       
   584 //		....
       
   585 //		....
       
   586 		};
       
   587 public:
       
   588 	TSmsStatus();
       
   589 	inline TSmsStatus::TSmsStatusValue Status() const;
       
   590 	inline void SetStatus(TSmsStatusValue aValue);
       
   591 	};
       
   592 
       
   593 
       
   594 /**
       
   595  *  TP-PI octet. Found in Reports and Commands
       
   596  *  @publishedAll
       
   597  *  @released
       
   598  */
       
   599 class TSmsParameterIndicator : public TSmsOctet
       
   600 	{
       
   601 public:
       
   602 /** TP-PI bit flags. */
       
   603 	enum TSmsPIBits
       
   604 		{
       
   605 	/** Protocol identifier present. */
       
   606 		ESmsPIDProtocolIdentifierPresent=0x01,
       
   607 	/** Data coding scheme present. */
       
   608 		ESmsPIDDataCodingSchemePresent=0x02,
       
   609 	/** User data present. */
       
   610 		ESmsPIDUserDataPresent=0x04,
       
   611 	/** Reserved. */
       
   612 		ESmsPIDReserved1=0x08,
       
   613 	/** Reserved. */
       
   614 		ESmsPIDReserved2=0x10,
       
   615 	/** Reserved. */
       
   616 		ESmsPIDReserved3=0x20,
       
   617 	/** Reserved. */
       
   618 		ESmsPIDReserved4=0x40,
       
   619 	/** Extension. */
       
   620 		ESmsPIDExtension=0x80
       
   621 		};
       
   622 public:
       
   623 	TSmsParameterIndicator();
       
   624 	inline TBool Extension() const;
       
   625 	inline void SetExtension(TBool aExtension);
       
   626 	inline TBool UserDataPresent() const;
       
   627 	inline void SetUserDataPresent(TBool aPresent);
       
   628 	inline TBool DataCodingSchemePresent() const;
       
   629 	inline void SetDataCodingSchemePresent(TBool aPresent);
       
   630 	inline TBool ProtocolIdentifierPresent() const;
       
   631 	inline void SetProtocolIdentifierPresent(TBool aPresent);
       
   632 	};
       
   633 
       
   634 // TSmsPID - conversion (None, Fax, Mail, etc.)
       
   635 
       
   636 /**
       
   637  *  TP-PID PDU octet. Found in ALL 6 message types.
       
   638  *  @publishedAll
       
   639  *  @released
       
   640  */
       
   641 class TSmsProtocolIdentifier : public TSmsOctet
       
   642 	{
       
   643 public:
       
   644 /** PID bits 7-6, which determine the meaning of the lower order bits. */
       
   645 	enum TSmsPIDType
       
   646 		{
       
   647 	/** Telematic interworking. */
       
   648 		ESmsPIDTelematicInterworking=0x00,
       
   649 	/** Short message. */
       
   650 		ESmsPIDShortMessageType=0x40,
       
   651 	/** Reserved. */
       
   652 		ESmsPIDReserved=0x80,
       
   653 	/** SC specific use. */
       
   654 		ESmsPIDSCSpecificUse=0xC0,
       
   655 
       
   656 	/** Mask of bits 7-6. */
       
   657 		ESmsPIDTypeMask=0xC0
       
   658 		};
       
   659 
       
   660 /** Telematic device indicator flags. Bit 5 - When Bit 7 = 0, Bit 6 = 0 */
       
   661 	enum TSmsTelematicDeviceIndicator
       
   662 		{
       
   663 	/** No telematic device. */
       
   664 		ESmsNoTelematicDevice=0x00,
       
   665 	/** Telematic device. */
       
   666 		ESmsTelematicDevice=0x20,
       
   667 
       
   668 	/** Telematic device indicator mask. */
       
   669 		EPIDTelematicDeviceIndicatorMask=0x20
       
   670 		};
       
   671 
       
   672 /** Telematic Interworking device type flags. Bits 4-0 - When Bit 5 = 1*/
       
   673 	enum TSmsTelematicDeviceType
       
   674 		{
       
   675 	/** Device type is specific to this SC. */
       
   676 		ESmsSCSpecificDevice=0x00,
       
   677 	/** Telex. */
       
   678 		ESmsTelex=0x01,
       
   679 	/** Group 3 telefax. */
       
   680 		ESmsGroup3TeleFax=0x02,
       
   681 	/** Group 4 telefax. */
       
   682 		ESmsGroup4TeleFax=0x03,
       
   683 	/** Voice telephone. */
       
   684 		ESmsVoiceTelephone=0x04,
       
   685 	/** ERMES. */
       
   686 		ESmsERMES=0x05,
       
   687 	/** National Paging System. */
       
   688 		ESmsNationalPagingSystem=0x06,
       
   689 	/** Videotex. */
       
   690 		ESmsVideotex=0x07,
       
   691 	/** Teletex, carrier unspecified. */
       
   692 		ESmsTeletexCarrierUnspecified=0x08,
       
   693 	/** Teletex, PSPDN. */
       
   694 		ESmsTeletexPSPDN=0x09,
       
   695 	/** Teletex, CSPDN. */
       
   696 		ESmsTeletexCSPDN=0x0A,
       
   697 	/** Teletex, in analog PSTN. */
       
   698 		ESmsTeletexAnaloguePSTN=0x0B,
       
   699 	/** Teletex, in digital ISDN */
       
   700 		ESmsTeletexDigitalISDN=0x0C,
       
   701 	/** UCI (Universal Computer Interface, ETSI DE/PS 3 01-3). */
       
   702 		ESmsUCI=0x0D,
       
   703 	/** Reserved. */
       
   704 		ESmsReserved1=0x0E,
       
   705 	/** Reserved. */
       
   706 		ESmsReserved2=0x0F,
       
   707 	/** A message handling facility. */
       
   708 		ESmsMessageHandlingFacility=0x10,
       
   709 	/** X.400 message handling system. */
       
   710 		ESmsX400MessageHandlingSystem=0x11,
       
   711 	/** Internet Electronic Mail. */
       
   712 		ESmsInternetElectronicMail=0x12,
       
   713 	/** Reserved. */
       
   714 		ESmsReserved3=0x13,
       
   715 	/** Reserved. */
       
   716 		ESmsReserved4=0x14,
       
   717 	/** Reserved. */
       
   718 		ESmsReserved5=0x15,
       
   719 	/** Reserved. */
       
   720 		ESmsReserved6=0x16,
       
   721 	/** Reserved. */
       
   722 		ESmsReserved7=0x17,
       
   723 	/** Value specific to each SC. */
       
   724 		ESmsSCSpecific1=0x18,
       
   725 	/** Value specific to each SC. */
       
   726 		ESmsSCSpecific2=0x19,
       
   727 	/** Value specific to each SC. */
       
   728 		ESmsSCSpecific3=0x1A,
       
   729 	/** Value specific to each SC. */
       
   730 		ESmsSCSpecific4=0x1B,
       
   731 	/** Value specific to each SC. */
       
   732 		ESmsSCSpecific5=0x1C,
       
   733 	/** Value specific to each SC. */
       
   734 		ESmsSCSpecific6=0x1D,
       
   735 	/** Value specific to each SC. */
       
   736 		ESmsSCSpecific7=0x1E,
       
   737 	/** Value specific to each SC. */
       
   738 		ESmsGsmMobileStation=0x1F,
       
   739 
       
   740 	/** Mask for telematic device type bits. */
       
   741 		ESmsTelematicDeviceTypeMask=0x1F
       
   742 		};
       
   743 
       
   744 /** SM-AL protocol flag. No Telematic Interworking. Bits 4-0 - When Bit 5 = 0*/
       
   745 	enum TSmsShortMessageALProtocol
       
   746 		{
       
   747 	/** Mask for SM-AL protocol flag bit. */
       
   748 		ESmsShortMessageALProtocolMask=0x0F
       
   749 		};
       
   750 
       
   751 /** Short Message Type flags. Bits 5-0 - When Bit 7 = 1, Bit 6 = 0*/
       
   752 	enum TSmsShortMessageType
       
   753 		{
       
   754 	/** Short Message Type 0. */
       
   755 		ESmsShortMessageType0=0x00,
       
   756 	/** Replace Short Message Type 1. */
       
   757 		ESmsReplaceShortMessageType1=0x01,
       
   758 	/** Replace Short Message Type 2. */
       
   759 		ESmsReplaceShortMessageType2=0x02,
       
   760 	/** Replace Short Message Type 3. */
       
   761 		ESmsReplaceShortMessageType3=0x03,
       
   762 	/** Replace Short Message Type 4. */
       
   763 		ESmsReplaceShortMessageType4=0x04,
       
   764 	/** Replace Short Message Type 5. */
       
   765 		ESmsReplaceShortMessageType5=0x05,
       
   766 	/** Replace Short Message Type 6. */
       
   767 		ESmsReplaceShortMessageType6=0x06,
       
   768 	/** Replace Short Message Type 7. */
       
   769 		ESmsReplaceShortMessageType7=0x07,
       
   770 //  Reserved values
       
   771 //		....
       
   772 //		....
       
   773 	/** Return Call Message. */
       
   774 		ESmsReturnCallMesage=0x1F,
       
   775 //  Reserved values
       
   776 //		....
       
   777 //		....
       
   778 		ESmsAnsi136RData=0x3C,
       
   779  		ESmsMEDataDownload=0x3D,
       
   780 	/** ME De-personalization Short Message. */
       
   781 		ESmsMEDepersonalizationShortMessage=0x3E,
       
   782 	/** ME Data download. */
       
   783 		ESmsSIMDataDownLoad=0x3F,
       
   784 
       
   785 //		ESmsShortMessageTypeMask=0x1F
       
   786 	/** Mask for Short Message type bits. */
       
   787 		ESmsShortMessageTypeMask=0x3F
       
   788 		};
       
   789 public:
       
   790 	TSmsProtocolIdentifier();
       
   791 	inline TSmsPIDType PIDType() const;
       
   792 	inline void SetPIDType(TSmsPIDType aSmsPIDType);
       
   793 	TSmsTelematicDeviceIndicator TelematicDeviceIndicator() const;
       
   794 	void SetTelematicDeviceIndicator(TSmsTelematicDeviceIndicator aIndicator);
       
   795 	TSmsTelematicDeviceType TelematicDeviceType() const;
       
   796 	void SetTelematicDeviceType(TSmsTelematicDeviceType aDeviceType);
       
   797 	TInt ShortMessageALProtocol() const;
       
   798 	void SetShortMessageALProtocol(TSmsShortMessageALProtocol aProtocol);
       
   799 	TInt ShortMessageType() const;
       
   800 	void SetShortMessageType(TSmsShortMessageType aShortMessageType);
       
   801 	};
       
   802 
       
   803 
       
   804 /**
       
   805  *  TP-DCS Data Coding Scheme defined in 3GPP TS 23.038.
       
   806  *  
       
   807  *  The data coding scheme is not always present in an GSM SMS PDU (CSmsPDU).
       
   808  *  It is always present for a SUBMIT (CSmsSubmit) and a DELIVER (CSmsDeliver),
       
   809  *  and is sometimes present for a DELIVER REPORT (CSmsDeliverReport), a SUBMIT
       
   810  *  REPORT (CSmsSubmitReport) or a STATUS REPORT (CSmsStatusReport), depending
       
   811  *  on the parameter indicator (TSmsParameterIndicator).
       
   812  *  @publishedAll
       
   813  *  @released 
       
   814  */
       
   815 class TSmsDataCodingScheme : public TSmsOctet
       
   816 	{
       
   817 public:
       
   818 /** Flags for bits 7-4, which determine the meaning of the lower order bits. */
       
   819 	enum TSmsDCSBits7To4
       
   820 		{
       
   821 	/** Text is uncompressed, no class information. */
       
   822 		ESmsDCSTextUncompressedWithNoClassInfo=0x00,
       
   823 	/** Text is uncompressed, class information present. */
       
   824 		ESmsDCSTextUncompressedWithClassInfo=0x10,
       
   825 	/** Text is compressed, no class information. */
       
   826 		ESmsDCSTextCompressedWithNoClassInfo=0x20,
       
   827 	/** Text is compressed, class information present. */
       
   828 		ESmsDCSTextCompressedWithClassInfo=0x30,
       
   829 
       
   830 	/** Auto Deletion, Text is uncompressed, no class information. */
       
   831 		ESmsDCSAutoDelNoClassInfoUncompressedText=0x40,
       
   832 	/** Auto Deletion, Text is uncompressed, class information present. */
       
   833 		ESmsDCSAutoDelClassInfoUncompressedText=0x50,
       
   834 	/** Auto Deletion, Text is compressed, no class information. */
       
   835 		ESmsDCSAutoDelNoClassInfoCompressedText=0x60,
       
   836 	/** Auto Deletion, Text is compressed, class information present. */
       
   837 		ESmsDCSAutoDelClassInfoTextCompressedText=0x70,
       
   838 
       
   839 	/** Reserved. */
       
   840 		ESmsDCSReserved1=0x40,
       
   841 	/** Reserved. */
       
   842 		ESmsDCSReserved2=0x50,
       
   843 	/** Reserved. */
       
   844 		ESmsDCSReserved3=0x60,
       
   845 	/** Reserved. */
       
   846 		ESmsDCSReserved4=0x70,
       
   847 	/** Reserved. */
       
   848 		ESmsDCSReserved5=0x80,
       
   849 	/** Reserved. */
       
   850 		ESmsDCSReserved6=0x90,
       
   851 	/** Reserved. */
       
   852 		ESmsDCSReserved7=0xA0,
       
   853 	/** Reserved. */
       
   854 		ESmsDCSReserved8=0xB0,
       
   855 
       
   856 
       
   857 
       
   858 	/** Message Waiting Indication Group: Discard Message. */
       
   859 		ESmsDCSMessageWaitingIndicationDiscardMessage=0xC0,
       
   860 
       
   861 	/** Message Waiting Indication Group (7 bit). */
       
   862 		ESmsDCSMessageWaitingIndication7Bit=0xD0,  //  7 bit User data
       
   863 	/** Message Waiting Indication Group (UCS2). */
       
   864 		ESmsDCSMessageWaitingIndicationUCS2=0xE0,  //  unicode User data
       
   865 
       
   866 	/** Text uncompressed, 7 bit or 8 bit. */
       
   867 		ESmsDCSTextUncompressed7BitOr8Bit=0xF0,
       
   868 
       
   869 	/** Masks bits 7 to 4. */
       
   870 		ESmsDCSBits7To4Mask=0xF0
       
   871 		};
       
   872 
       
   873 /** Message Marked for Automatic Deletion */
       
   874     enum TAutomaticDeletionGroup
       
   875         {
       
   876         ESmsDCSAutomaticDeletion     = 0x40,
       
   877         ESmsDCSAutomaticDeletionMask = 0xC0
       
   878         };
       
   879 
       
   880 /** Alphabet bit flags. */
       
   881 	enum TSmsAlphabet
       
   882 		{
       
   883 	/** GSM 7 bit default alphabet. */
       
   884 		ESmsAlphabet7Bit=0x00,
       
   885 	/** 8-bit data. */
       
   886 		ESmsAlphabet8Bit=0x04,
       
   887 	/** UCS2. */
       
   888 		ESmsAlphabetUCS2=0x08,
       
   889 	/** Reserved. */
       
   890 		ESmsAlphabetReserved=0x0C,
       
   891 
       
   892 	/** Mask for these bit flags. */
       
   893 		ESmsAlphabetMask=0x0C,
       
   894 		};
       
   895 /** Message Class bit flags. */
       
   896 	enum TSmsClass
       
   897 		{
       
   898 	/** Class 0. */
       
   899 		ESmsClass0=0x00,
       
   900 	/** Class 1. */
       
   901 		ESmsClass1=0x01,
       
   902 	/** Class 2. */
       
   903 		ESmsClass2=0x02,
       
   904 	/** Class 3. */
       
   905 		ESmsClass3=0x03,
       
   906 
       
   907 	/** Mask for these bit flags. */
       
   908 		ESmsClassMask=0x03,
       
   909 		};
       
   910 
       
   911 /** Indication Sense bit flags. */
       
   912 	enum TSmsIndicationState
       
   913 		{
       
   914 	/** Indication inactive. */
       
   915 		ESmsIndicationInactive=0x00,
       
   916 	/** Indication active. */
       
   917 		ESmsIndicationActive=0x08,
       
   918 
       
   919 	/** Mask for these bit flags. */
       
   920 		ESmsIndicationStateMask=0x08
       
   921 		};
       
   922 /** Indication Type bit flags. */
       
   923 	enum TSmsIndicationType
       
   924 		{
       
   925 	/** Voicemail Message Waiting. */
       
   926 		ESmsVoicemailMessageWaiting=0x00,
       
   927 	/** Fax Message Waiting. */
       
   928 		ESmsFaxMessageWaiting=0x01,
       
   929 	/** Electronic Mail Message Waiting. */
       
   930 		ESmsElectronicMailMessageWaiting=0x02,
       
   931 	/** Other Message Waiting. */
       
   932 		ESmsFaxOtherMessageWaiting=0x03,
       
   933 
       
   934 	/** Mask for these bit flags. */
       
   935 		ESmsIndicationTypeMask=0x03
       
   936 		};
       
   937 
       
   938 public:
       
   939 	TSmsDataCodingScheme();
       
   940 	inline TSmsDCSBits7To4 Bits7To4() const;
       
   941 	inline void SetBits7To4(TSmsDCSBits7To4 aBits7To4);
       
   942 //  Normal SMS settings
       
   943 	TBool TextCompressed() const;
       
   944 	void SetTextCompressed(TBool aCompressed);
       
   945 	TSmsAlphabet Alphabet() const;
       
   946 	void SetAlphabet(TSmsAlphabet aAlphabet);
       
   947 	TBool Class(TSmsClass& aClass) const;
       
   948 	void SetClass(TBool aClassDefined,TSmsClass aClass);
       
   949 //  Message waiting settings
       
   950 	TSmsIndicationState IndicationState() const;
       
   951 	void SetIndicationState(TSmsIndicationState aState);
       
   952 	TSmsIndicationType IndicationType() const;
       
   953 	void SetIndicationType(TSmsIndicationType aType);
       
   954 	};
       
   955 
       
   956 
       
   957 /**
       
   958  *  Specifies alternative 7bit encoding combinations to use if the default
       
   959  *  GSM encoding cannot encode the message as 7bit without data loss.
       
   960  * 
       
   961  *  @publishedAll
       
   962  *  @released 
       
   963  */
       
   964 enum TSmsEncoding
       
   965 	{
       
   966 	/** Default value meaning that no alternative encoding would be used. */
       
   967 	ESmsEncodingNone = 0,
       
   968 	
       
   969 	/**
       
   970 	 *  Allows the use of the Turkish Single Shift table in place of the
       
   971 	 *  default GSM shift table.
       
   972 	 * 
       
   973 	 *  @note If used during encoding there will be a 3 octet cost in the User Data
       
   974 	 *        Header.
       
   975 	 */
       
   976 	ESmsEncodingTurkishSingleShift = 0x11,
       
   977 
       
   978 	/**
       
   979 	 *  Allows the use of the Turkish Locking Shift table in place of the
       
   980 	 *  default GSM alphabet table.
       
   981 	 * 
       
   982 	 *  @note If used during encoding there will be a 3 octet cost in the User Data
       
   983 	 *        Header.
       
   984 	 *  @note This encoding should only be used if the relevant national
       
   985 	 *        regulatory body has requested its use.
       
   986 	 */
       
   987 	ESmsEncodingTurkishLockingShift	= 0x12,
       
   988 
       
   989     /**
       
   990      *  Allows the use of the Turkish Locking Shift and/or the Turkish Single
       
   991      *  Shift tables in place of the default GSM alphabet and shift tables.
       
   992 	 * 
       
   993 	 *  @note If used during encoding there will be a 3 or 6 octet cost in the User Data
       
   994 	 *        Header.
       
   995 	 *  @note This encoding should only be used if the relevant national
       
   996 	 *        regulatory body has requested its use.
       
   997 	 */
       
   998 	ESmsEncodingTurkishLockingAndSingleShift = 0x13,
       
   999 
       
  1000 	/**
       
  1001 	 *  Allows the use of the Spanish Single Shift table in place of the
       
  1002 	 *  default GSM shift table.
       
  1003 	 * 
       
  1004 	 *  @note If used during encoding there will be a 3 octet cost in the User Data
       
  1005 	 *        Header.
       
  1006 	 */
       
  1007 	ESmsEncodingSpanishSingleShift = 0x21,
       
  1008 
       
  1009 	/**
       
  1010 	 *  Allows the use of the Portuguese Single Shift table in place of the
       
  1011 	 *  default GSM shift table.
       
  1012 	 * 
       
  1013 	 *  @note If used during encoding there will be a 3 octet cost in the User Data
       
  1014 	 *        Header.
       
  1015 	 */
       
  1016 	ESmsEncodingPortugueseSingleShift = 0x31,
       
  1017 
       
  1018 	/**
       
  1019 	 *  Allows the use of the Portuguese Locking Shift table in place of the
       
  1020 	 *  default GSM alphabet table.
       
  1021 	 * 
       
  1022 	 *  @note If used during encoding there will be a 3 octet cost in the User Data
       
  1023 	 *        Header.
       
  1024 	 *  @note This encoding should only be used if the relevant national
       
  1025 	 *        regulatory body has requested its use.
       
  1026 	 */
       
  1027 	ESmsEncodingPortugueseLockingShift = 0x32,
       
  1028 
       
  1029     /**
       
  1030      *  Allows the use of the Portuguese Locking Shift and/or the Portuguese Single
       
  1031      *  Shift tables in place of the default GSM alphabet and shift tables.
       
  1032 	 * 
       
  1033 	 *  @note If used during encoding there will be a 3 or 6 octet cost in the User Data
       
  1034 	 *        Header.
       
  1035 	 *  @note This encoding should only be used if the relevant national
       
  1036 	 *        regulatory body has requested its use.
       
  1037 	 */
       
  1038 	ESmsEncodingPortugueseLockingAndSingleShift = 0x33
       
  1039 	};
       
  1040 
       
  1041 
       
  1042 /**
       
  1043  *  GSM National Language Identifiers.
       
  1044  * 
       
  1045  *  @publishedAll
       
  1046  *  @released 
       
  1047  */
       
  1048 enum TSmsNationalLanguageIdentifier
       
  1049 	{
       
  1050 	/** Turkish. */
       
  1051 	ESmsNationalLanguageIdentifierTurkish = 1,
       
  1052 
       
  1053 	/** Spanish. */
       
  1054 	ESmsNationalLanguageIdentifierSpanish = 2,
       
  1055 
       
  1056 	/** Portuguese. */
       
  1057 	ESmsNationalLanguageIdentifierPortuguese = 3
       
  1058 	};
       
  1059 
       
  1060 
       
  1061 /**
       
  1062  *  Utility to provide piecewise character set conversion to / from unpacked user
       
  1063  *  data elements.
       
  1064  *  @publishedAll
       
  1065  *  @released 
       
  1066  */
       
  1067 class CSmsAlphabetConverter : public CBase
       
  1068 	{
       
  1069 public:
       
  1070 // Construction and destruction methods
       
  1071 	IMPORT_C static CSmsAlphabetConverter* NewLC(CCnvCharacterSetConverter& aCharacterSetConverter,RFs& aFs,TSmsDataCodingScheme::TSmsAlphabet aSmsAlphabet,TBool aIsBinary);
       
  1072 	IMPORT_C ~CSmsAlphabetConverter();
       
  1073 
       
  1074 // Enumerated types and structs
       
  1075 /**
       
  1076  *  Indicates whether there is a fixed relationship between the number of characters
       
  1077  *  and user data elements.
       
  1078  *  
       
  1079  *  For example, Unicode characters always map to a single SMS UCS2 character,
       
  1080  *  while a Unicode character might map to one, two or more SMS 7-bit User Data
       
  1081  *  Elements (extended 7-bit characters). 
       
  1082  */
       
  1083 	enum TSmsAlphabetWidthConversion
       
  1084 		{
       
  1085 	/** Fixed relationship. */
       
  1086 		ESmsAlphabetWidthConversionFixed,
       
  1087 	/** Variable relationship. */
       
  1088 		ESmsAlphabetWidthConversionVariable
       
  1089 		};
       
  1090 
       
  1091 	struct TSmsAlphabetConversionProperties
       
  1092 /**
       
  1093  *  Holds the number of user data elements required for conversion from a single
       
  1094  *  native character.
       
  1095  *  
       
  1096  *  This value is applicable only if the iWidthConversion parameter is ESmsAlphabetWidthConversionFixed. 
       
  1097  */
       
  1098 		{
       
  1099 	/** Alphabet width conversion. */
       
  1100 		TSmsAlphabetWidthConversion iWidthConversion;
       
  1101 	/** Number of user data elements required for conversion from a single native character */
       
  1102 		TInt iUDElementsPerNativeCharacter;
       
  1103 		};
       
  1104 
       
  1105 public:
       
  1106 // Conversion methods
       
  1107 	void ConversionPropertiesL(TSmsAlphabetConversionProperties& aConversionProperties) const;
       
  1108 	IMPORT_C TPtrC8 ConvertFromNativeL(const TDesC& aNativeCharacters);
       
  1109 	IMPORT_C TPtrC8 ConvertFromNativeL(const TDesC& aNativeCharacters,
       
  1110 	                                   TSmsEncoding aEncoding,
       
  1111 	                                   TInt& aNumberOfUnconvertibleCharacters,
       
  1112 	                                   TInt& aNumberOfDowngradedCharacters);
       
  1113 	IMPORT_C TPtrC ConvertToNativeL(const TDesC8& aUDElements);
       
  1114 	IMPORT_C TPtrC ConvertToNativeL(const TDesC8& aUDElements, TSmsEncoding aEncoding);
       
  1115 
       
  1116 	TBool IsSupportedL(TChar aChar);
       
  1117 	TBool IsSupportedL(const TDesC& aDes, TInt& aNumberOfUnconvertibleCharacters,
       
  1118 			           TInt& aIndexOfFirstUnconvertibleCharacter);
       
  1119 
       
  1120 	TBool IsSupportedL(TChar aChar, TSmsEncoding aEncoding, TBool& aIsDowngrade,
       
  1121 			           TBool& aRequiresAlternativeEncoding);
       
  1122 	TBool IsSupportedL(const TDesC& aDes, TSmsEncoding aEncoding,
       
  1123 			           TInt& aNumberOfUnconvertibleCharacters,
       
  1124 			           TInt& aNumberOfDowngradedCharacters,
       
  1125 			           TInt& aNumberRequiringAlternativeEncoding,
       
  1126 			           TInt& aIndexOfFirstUnconvertibleCharacter);
       
  1127 	
       
  1128 // Alternative Encoding methods
       
  1129 	TSmsEncoding FindBestAlternativeEncodingL(const TDesC& aNativeCharacters,
       
  1130 											  TSmsEncoding aSuggestedEncoding);
       
  1131 	void ConfirmAlternativeEncoderL(TSmsEncoding aEncoding) const;
       
  1132 	
       
  1133 // Unconverted buffer methods
       
  1134 	inline void ResetUnconvertedNativeCharacters();
       
  1135 	inline void ResetUnconvertedUDElements();
       
  1136 	inline TPtrC UnconvertedNativeCharacters();
       
  1137 	inline TPtrC8 UnconvertedUDElements();
       
  1138 
       
  1139 // Getter / setters
       
  1140 	inline TSmsDataCodingScheme::TSmsAlphabet Alphabet() const;
       
  1141 
       
  1142 private:
       
  1143 // Private construction methods
       
  1144 	CSmsAlphabetConverter(CCnvCharacterSetConverter& aCharacterSetConverter,RFs& aFs,TSmsDataCodingScheme::TSmsAlphabet aSmsAlphabet,TBool aIsBinary);
       
  1145 	void ConstructL();
       
  1146 
       
  1147 // Private conversion preparation methods
       
  1148 	void PrepareForConversionFromNativeL(TSmsEncoding aEncoding);
       
  1149 	void PrepareForConversionToNativeL(TSmsEncoding aEncoding);
       
  1150 
       
  1151 // Private Alternative Encoding methods
       
  1152 	void GetAlternativeEncoderIDL(TSmsEncoding aEncoding, TUint& aEncoderID) const;
       
  1153 
       
  1154 // Private buffer helper methods
       
  1155 	TPtr16 CheckAllocBufferL(HBufC16** aBuffer,TInt aMaxLength,TInt aUsedLength);
       
  1156 	TPtr8 CheckAllocBufferL(HBufC8** aBuffer,TInt aMaxLength,TInt aUsedLength);
       
  1157 
       
  1158 // Private constants
       
  1159 	enum
       
  1160 		{
       
  1161 		KMaxSmsAlphabetConversionRetries=4
       
  1162 		};
       
  1163 
       
  1164 	enum
       
  1165 		{
       
  1166 		KMinSmsAlphabetConversionAllocIncrement=4
       
  1167 		};
       
  1168 
       
  1169 private:
       
  1170 
       
  1171 	CCnvCharacterSetConverter& iCharacterSetConverter;
       
  1172 	RFs& iFs;
       
  1173 	TSmsDataCodingScheme::TSmsAlphabet iSmsAlphabet;
       
  1174 	TBool iIsBinary;
       
  1175 	HBufC* iConvertedNativeCharacters;
       
  1176 	HBufC8* iConvertedUDElements;
       
  1177 	HBufC* iUnconvertedNativeCharacters;
       
  1178 	TPtr iUnconvertedNativeCharactersPtr;
       
  1179 	HBufC8* iUnconvertedUDElements;
       
  1180 	TPtr8 iUnconvertedUDElementsPtr;
       
  1181 	};
       
  1182 
       
  1183 
       
  1184 /** Type-of-number, as defined in ETSI 3GPP TS 23.040. */
       
  1185 enum TGsmSmsTypeOfNumber
       
  1186 	{
       
  1187 	/**
       
  1188 	 *  Unknown, used when the user or network has no a priori information about the
       
  1189 	 *  numbering plan.
       
  1190 	 *  In this case, the Address-Value field is organized according to the network
       
  1191 	 *  	dialling plan, e.g. prefix or escape digits might be present. 
       
  1192 	 */
       
  1193 	EGsmSmsTONUnknown=0x00,
       
  1194 	/**
       
  1195 	 *  International number.
       
  1196 	 *  The international format shall be accepted also when the message is destined
       
  1197 	 *  	to a recipient in the same country as the MSC or as the SGSN. 
       
  1198 	 */
       
  1199 		EGsmSmsTONInternationalNumber=0x10,
       
  1200 	/**
       
  1201 	 *  National number.
       
  1202 	 *  	Prefix or escape digits shall not be included. 
       
  1203 	 */
       
  1204 		EGsmSmsTONNationalNumber=0x20,
       
  1205 	/**
       
  1206 	 *  Network specific number.
       
  1207 	 *  Administration/service number specific to the serving network, e.g. used to
       
  1208 	 *  	access an operator. 
       
  1209 	 */
       
  1210 		EGsmSmsTONNetworkSpecificNumber=0x30,
       
  1211 	/**
       
  1212 	 *  Subscriber number.
       
  1213 	 *  Used when a specific short number representation is stored in one or more
       
  1214 	 *  SCs as part of a higher layer application. (Note that "Subscriber number"
       
  1215 	 *  	shall only be used in connection with the proper PID referring to this application). 
       
  1216 	 */
       
  1217 		EGsmSmsTONSubscriberNumber=0x40,
       
  1218 	/**
       
  1219 	 *  Alpha-numeric.
       
  1220 	 *  	Coded according to 3GPP TS 23.038 - GSM 7-bit default alphabet. 
       
  1221 	 */
       
  1222 		EGsmSmsTONAlphaNumeric=0x50,
       
  1223 		EGsmSmsTONAbbreviatedNumber=0x60,		///< Abbreviated number
       
  1224 		EGsmSmsTONReserverved=0x70,				///< Reserved for extension
       
  1225 	};
       
  1226 
       
  1227 /** Numbering-plan-identification defined in ETSI 3GPP TS 23.040. */
       
  1228 enum TGsmSmsNumberingPlanIdentification
       
  1229 	{
       
  1230 	/** Unknown. */
       
  1231 	EGsmSmsNPIUnknown=0x00,
       
  1232 	/** ISDN telephone numbering plan. */
       
  1233 	EGsmSmsNPIISDNTelephoneNumberingPlan=0x01,
       
  1234 	/** Data numbering plan. */
       
  1235 	EGsmSmsNPIDataNumberingPlan=0x03,
       
  1236 	/** Telex numbering plan. */
       
  1237 	EGsmSmsNPITelexNumberingPlan=0x04,
       
  1238 	/** National numbering plan. */
       
  1239 	EGsmSmsNPINationalNumberingPlan=0x08,
       
  1240 	/** Private numbering plan. */
       
  1241 	EGsmSmsNPIPrivateNumberingPlan=0x09,
       
  1242 	/** ERMES numbering plan. */
       
  1243 	EGsmSmsNPIERMESNumberingPlan=0x0A,
       
  1244 	/** Reserved for extension. */
       
  1245 	EGsmSmsNPIReservedForExtension=0x0F,
       
  1246 	};
       
  1247 
       
  1248 
       
  1249 /**
       
  1250  *  Type-of-address field defined in ETSI 3GPP TS 23.040
       
  1251  *  @publishedAll
       
  1252  *  @released
       
  1253  */
       
  1254 class TGsmSmsTypeOfAddress : public TSmsOctet
       
  1255 	{
       
  1256 	public:
       
  1257 
       
  1258     	enum
       
  1259     		{
       
  1260     		EGsmSmsFirstBitMask=0x80,
       
  1261     		EGsmSmsTONMask=0x70,
       
  1262     		EGsmSmsNPIMask=0x0F
       
  1263     		};
       
  1264 
       
  1265 	public:
       
  1266 
       
  1267 		inline TGsmSmsTypeOfAddress(TInt aValue = EGsmSmsFirstBitMask);
       
  1268 		inline TGsmSmsTypeOfAddress(TGsmSmsTypeOfNumber aTon, TGsmSmsNumberingPlanIdentification aNPI);
       
  1269 
       
  1270 		inline TGsmSmsTypeOfNumber TON() const;
       
  1271 		inline void SetTON(TGsmSmsTypeOfNumber aTON);
       
  1272 
       
  1273 		inline TGsmSmsNumberingPlanIdentification NPI() const;
       
  1274 	/**
       
  1275 	 *  Sets the numbering plan identification.
       
  1276 	 *  	@param aNPI Numbering plan identification 
       
  1277 	 */
       
  1278 		inline void SetNPI(TGsmSmsNumberingPlanIdentification aNPI);
       
  1279 
       
  1280 	/**
       
  1281 	 *  Converts type of number and numbering plan identification information from
       
  1282 	 *  the type of address parameter to the NMobilePhone::TMobileTON and NMobilePhone::TMobileNPI
       
  1283 	 *  format.
       
  1284 	 *  
       
  1285 	 *  @param aTON On return, type of number
       
  1286 	 *  	@param aNPI On return, numbering plan identification 
       
  1287 	 */
       
  1288 		IMPORT_C void ConvertToETelMM(NMobilePhone::TMobileTON& aTON, NMobilePhone::TMobileNPI& aNPI) const;
       
  1289 	/**
       
  1290 	 *  Sets type of number and numbering plan identification information from values
       
  1291 	 *  specified in NMobilePhone::TMobileTON and NMobilePhone::TMobileNPI formats.
       
  1292 	 *  
       
  1293 	 *  @param aTON Type of number
       
  1294 	 *  	@param aNPI Numbering plan identification 
       
  1295 	 */
       
  1296 		IMPORT_C void SetFromETelMM(NMobilePhone::TMobileTON aTON, NMobilePhone::TMobileNPI aNPI);
       
  1297 	};
       
  1298 
       
  1299 /** Maximum length of a Service Centre address = 21, as defined in ETSI GSM 04.11. */
       
  1300 const TInt TGsmSmsTelNumberMaxLen = 21;
       
  1301 
       
  1302 
       
  1303 /**
       
  1304  *  Encapsulation of basic address information
       
  1305  *  @publishedAll
       
  1306  *  @released
       
  1307  */
       
  1308 class TGsmSmsTelNumber
       
  1309 	{
       
  1310 	public:
       
  1311         /**
       
  1312          *  @internalComponent
       
  1313          *  If the address is an alphanumeric address,
       
  1314          *  it can represent a voice message waiting indicator
       
  1315          *  as defined in the Common PCN Handset Specification
       
  1316          *  v4.2. The specification allows other indicators
       
  1317          *          to be defined in the future.
       
  1318          */
       
  1319         enum TTypeOfIndicator
       
  1320         {
       
  1321         EVoiceMessageWaitingIndicator = 0
       
  1322         };
       
  1323 
       
  1324         private:
       
  1325     	enum TCPHSIndicatorTypeByte
       
  1326         {
       
  1327         ECPSHIndicatorTypeBitMask             = 0x7E,
       
  1328         ECPSHVoiceMailId                      = 0x10,
       
  1329         ECPHSIndicatorSettingBit              = 0x01,
       
  1330         ECPHSVoiceMailSettingSpareBit         = 0x80
       
  1331         };
       
  1332 
       
  1333         enum TCPHSIndicatorIdByte
       
  1334         {
       
  1335         ECPSHIndicatorIdBitMask               = 0x7E,
       
  1336         ECPSHIndicatorId                      = 0x00,
       
  1337         ECPSHIndicatorIdSettingBit            = 0x01,
       
  1338         ECTSHVoiceMailIndicatorSpareBit       = 0x80
       
  1339         };
       
  1340 
       
  1341         enum TCPHSByteIndex
       
  1342         {
       
  1343         ECPHSLength                   = 0,
       
  1344         ECPHSAddressType              = 1,
       
  1345         ECPHSAddressIndicatorType     = 2,
       
  1346         ECPHSAddressIndicatorId       = 3,
       
  1347         ECPHSSizeOfAddressField       = 4
       
  1348         };
       
  1349 
       
  1350 	public:
       
  1351 		inline   TGsmSmsTelNumber();
       
  1352 
       
  1353 		IMPORT_C TBool IsInstanceOf(TTypeOfIndicator aType);
       
  1354 
       
  1355 	public:
       
  1356 
       
  1357 		TGsmSmsTypeOfAddress iTypeOfAddress;		///< The type-of-address of iTelNumber
       
  1358 		TBuf<TGsmSmsTelNumberMaxLen> iTelNumber;	///< Telephone number, in format of iTypeOfAddress
       
  1359 	};
       
  1360 
       
  1361 
       
  1362 /**
       
  1363  *  CSmsAddress - address of the recipient or SC
       
  1364  *  @publishedAll
       
  1365  *  @released
       
  1366  */
       
  1367 class CSmsAddress : public CBase
       
  1368 	{
       
  1369 public:
       
  1370 	enum
       
  1371 		{
       
  1372 		KSmsAddressMaxAddressValueLength=10,// octets
       
  1373 		KSmsAddressMaxAddressLength = 12 // address length, type and address value
       
  1374 		};
       
  1375 public:
       
  1376 	static CSmsAddress* NewL(CCnvCharacterSetConverter& aCharacterSetConverter,RFs& aFs);
       
  1377 	~CSmsAddress();
       
  1378 	TPtrC Address() const;
       
  1379 	void SetAddressL(const TDesC& aAddress);
       
  1380 	void ParsedAddress(TGsmSmsTelNumber& aParsedAddress) const;
       
  1381 	void SetParsedAddressL(const TGsmSmsTelNumber& aParsedAddress);
       
  1382 
       
  1383 	void SetRawAddressL(TGsmSmsTypeOfAddress aTypeOfAddress, TPtrC aBuffer);
       
  1384 	TGsmSmsTypeOfAddress& TypeOfAddress();
       
  1385 
       
  1386 	TUint8 SizeL();
       
  1387 
       
  1388 	TUint8* EncodeL(TUint8* aPtr) const;
       
  1389 	void DecodeL(TGsmuLex8& aPdu);
       
  1390 	void InternalizeL(RReadStream& aStream);
       
  1391 	void ExternalizeL(RWriteStream& aStream) const;
       
  1392 private:
       
  1393 	CSmsAddress(CCnvCharacterSetConverter& aCharacterSetConverter,RFs& aFs);
       
  1394 	void NewBufferL(TInt aLength);
       
  1395 	void DoSetParsedAddressL(const TDesC& aAddress);
       
  1396 private:
       
  1397 
       
  1398 	CCnvCharacterSetConverter& iCharacterSetConverter;
       
  1399 	RFs& iFs;
       
  1400 	TGsmSmsTypeOfAddress iTypeOfAddress;
       
  1401 	HBufC* iBuffer;
       
  1402 	};
       
  1403 
       
  1404 
       
  1405 /**
       
  1406  *  TP-SCTS Service Center Time Stamp Found in Deliver, Submit Report, Status Report,
       
  1407  *  @publishedAll
       
  1408  *  @released
       
  1409  */
       
  1410 class TSmsServiceCenterTimeStamp
       
  1411 	{
       
  1412 public:
       
  1413 	enum {KSmsMaxTimeZoneNumQuarterHours=79};
       
  1414 /** Time zone offset sign bit. */
       
  1415 	enum TSmsTimeZoneSignBit
       
  1416 		{
       
  1417 	/** Positive offset. */
       
  1418 		ESmsTimeZonePositive=0x00,
       
  1419 	/** Negative offset. */
       
  1420 		ESmsTimeZoneNegative=0x08,
       
  1421 
       
  1422 	/** Mask for these bit flags. */
       
  1423 		ESmsTimeZoneSignBitMask=0x08
       
  1424 		};
       
  1425 public:
       
  1426 	TSmsServiceCenterTimeStamp();
       
  1427 	inline TInt TimeOffset() const;
       
  1428 	void SetTimeOffset(TInt aNumQuarterHours);
       
  1429 	inline const TTime& Time() const;
       
  1430 	inline void SetTime(const TTime& aTime);
       
  1431 	TUint8* EncodeL(TUint8* aPtr) const;
       
  1432 	void DecodeL(TGsmuLex8& aPdu, TInt& aTimeError);
       
  1433 	void InternalizeL(RReadStream& aStream);
       
  1434 	void ExternalizeL(RWriteStream& aStream) const;
       
  1435 private:
       
  1436 	TTime iTime;
       
  1437 	TInt iTimeZoneNumQuarterHours;
       
  1438 	};
       
  1439 
       
  1440 
       
  1441 /**
       
  1442  *  TP-VP Validity Period Found in SUBMIT PDUs.
       
  1443  *  
       
  1444  *  The validy period format is encoded in the first octet of the PDU, so the
       
  1445  *  class takes a reference to a TSmsFirstOctet. The validty period specifies
       
  1446  *  the length of time the PDU lives in the service center if the PDU cannot be
       
  1447  *  immediately delivered.
       
  1448  *  @publishedAll
       
  1449  *  @released 
       
  1450  */
       
  1451 class TSmsValidityPeriod
       
  1452 	{
       
  1453 public:
       
  1454 /** Validity period units (in minutes). */
       
  1455 	enum TValidityPeriodUnitInMinutes
       
  1456 		{
       
  1457 	/** Five minutes. */
       
  1458 		EFiveMinuteUnitInMinutes=5,
       
  1459 	/** 30 minutes. */
       
  1460 		EHalfHourUnitInMinutes=30,
       
  1461 	/** 1 day. */
       
  1462 		EOneDayUnitInMinutes=1440,
       
  1463 	/** 1 week. */
       
  1464 		EOneWeekUnitInMinutes=7*EOneDayUnitInMinutes
       
  1465 		};
       
  1466 /** Limits for validity period units (in minutes). */
       
  1467 	enum TValidityPeriodUnitLimitInMinutes
       
  1468 		{
       
  1469 	/** Limit for 5 minute validity period unit. */
       
  1470 		EFiveMinuteUnitLimitInMinutes=24*EHalfHourUnitInMinutes,
       
  1471 	/** Limit for 30 minute validity period unit. */
       
  1472 		EHalfHourUnitLimitInMinutes=EOneDayUnitInMinutes,
       
  1473 	/** Limit for 1 day validity period unit. */
       
  1474 		EOneDayUnitLimitInMinutes=30*EOneDayUnitInMinutes,
       
  1475 	/** Limit for 1 week validity period unit. */
       
  1476 		EOneWeekUnitLimitInMinutes=63*EOneWeekUnitInMinutes
       
  1477 		};
       
  1478 /** Limits for validity period units. */
       
  1479 	enum TValidityPeriodLimit
       
  1480 		{
       
  1481 	/** Limit for 5 minute validity period unit. */
       
  1482 		EFiveMinuteUnitLimit=143,
       
  1483 	/** Limit for 30 minute validity period unit. */
       
  1484 		EHalfHourUnitLimit=167,
       
  1485 	/** Limit for 1 day validity period unit. */
       
  1486 		EOneDayUnitLimit=196,
       
  1487 	/** Limit for 1 week validity period unit. */
       
  1488 		EOneWeekUnitLimit=255
       
  1489 		};
       
  1490 public:
       
  1491 	TSmsValidityPeriod(TSmsFirstOctet& aFirstOctet);
       
  1492 	inline TSmsFirstOctet::TSmsValidityPeriodFormat ValidityPeriodFormat() const;
       
  1493 	inline void SetValidityPeriodFormat(TSmsFirstOctet::TSmsValidityPeriodFormat aValidityPeriodFormat);
       
  1494 	inline const TTimeIntervalMinutes& TimeIntervalMinutes() const;
       
  1495 	inline void SetTimeIntervalMinutes(const TTimeIntervalMinutes& aTimeIntervalMinutes);
       
  1496 	TTime Time() const;
       
  1497 	TUint8* EncodeL(TUint8* aPtr) const;
       
  1498 	void DecodeL(TGsmuLex8& aPdu);
       
  1499 	void InternalizeL(RReadStream& aStream);
       
  1500 	void ExternalizeL(RWriteStream& aStream) const;
       
  1501 private:
       
  1502 	TSmsFirstOctet& iFirstOctet;
       
  1503 	TTimeIntervalMinutes iTimeIntervalMinutes;
       
  1504 	};
       
  1505 
       
  1506 class CEmsInformationElement;
       
  1507 
       
  1508 /**
       
  1509  *  SMS element defined in TP-UD octet.
       
  1510  *  
       
  1511  *  This element is found in Deliver, Deliver Report, Submit, Submit Report, Status
       
  1512  *  Report and Command type messages.
       
  1513  *  @publishedAll
       
  1514  *  @released 
       
  1515  */
       
  1516 class CSmsInformationElement : public CBase
       
  1517 	{
       
  1518 public:
       
  1519 /** TP-UD Information Element Identifier. */
       
  1520 	enum TSmsInformationElementIdentifier
       
  1521 		{
       
  1522 	/** Concatenated short messages, 8-bit reference number. */
       
  1523 		ESmsIEIConcatenatedShortMessages8BitReference=0x00,
       
  1524 	/** Special SMS Message Indication. */
       
  1525 		ESmsIEISpecialSMSMessageIndication=0x01,
       
  1526 	/** Reserved. */
       
  1527 		ESmsIEIReserved=0x02,
       
  1528 	/** Value not used to avoid misinterpretation as line feed character. */
       
  1529 		ESmsIEIValueNotUsed=0x03,
       
  1530 	/** Application port addressing scheme, 8 bit address. */
       
  1531 		ESmsIEIApplicationPortAddressing8Bit=0x04,
       
  1532 	/** Application port addressing scheme, 16 bit address */
       
  1533 		ESmsIEIApplicationPortAddressing16Bit=0x05,
       
  1534 	/** SMSC Control Parameters. */
       
  1535 		ESmsIEISMSCControlParameters=0x06,
       
  1536 	/** UDH Source Indicator. */
       
  1537 		ESmsIEIUDHSourceIndicator=0x07,
       
  1538 	/** Concatenated short message, 16-bit reference number. */
       
  1539 		ESmsIEIConcatenatedShortMessages16BitReference=0x08,
       
  1540 	/** Wireless Control Message Protocol. */
       
  1541 		ESmsIEIWirelessControlMessageProtocol=0x09,
       
  1542 		ESmsIEIRFC822EmailHeader=0x20,
       
  1543 
       
  1544 
       
  1545 //	Enhanced SMS IE
       
  1546 		ESmsEnhancedTextFormatting=0x0A,
       
  1547 		ESmsEnhancedPredefinedSound=0x0B,
       
  1548 		ESmsEnhancedUserDefinedSound=0x0C,
       
  1549 		ESmsEnhancedPredefinedAnimation=0x0D,
       
  1550 		ESmsEnhancedLargeAnimation=0x0E,
       
  1551 		ESmsEnhancedSmallAnimation=0x0F,
       
  1552 		ESmsEnhancedLargePicture=0x10,
       
  1553 		ESmsEnhancedSmallPicture=0x11,
       
  1554 		ESmsEnhancedVariablePicture=0x12,
       
  1555 		ESmsEnhancedUserPromptIndicator=0x13,
       
  1556 		ESmsEnhancedExtendedObject=0x14,
       
  1557 		ESmsEnhancedReusedExtendedObject=0x15,
       
  1558 		ESmsEnhancedCompressionControl=0x16,
       
  1559 		ESmsEnhancedODI=0x17,
       
  1560 		ESmsEnhancedStandardWVG=0x18,
       
  1561 		ESmsEnhancedCharacterSizeWVG=0x19,
       
  1562 		ESmsEnhancedextendedObjectDataRequest=0x1A,
       
  1563 
       
  1564 //  Control Information Elements
       
  1565 
       
  1566 		ESmsHyperLinkFormat = 0x21,
       
  1567 		ESmsReplyAddressFormat = 0x22,
       
  1568 		ESmsEnhanceVoiceMailInformation = 0x23,
       
  1569 		ESmsNationalLanguageSingleShift = 0x24,
       
  1570 		ESmsNationalLanguageLockingShift = 0x25,
       
  1571 
       
  1572 //  Reserved values
       
  1573 //		....
       
  1574 //		....
       
  1575 	/** SIM Toolkit Security Header 1. */
       
  1576 		ESmsIEISIMToolkitSecurityHeaders1=0x70,
       
  1577 	/** SIM Toolkit Security Header 2. */
       
  1578 		ESmsIEISIMToolkitSecurityHeaders2=0x71,
       
  1579 	/** SIM Toolkit Security Header 3. */
       
  1580 		ESmsIEISIMToolkitSecurityHeaders3=0x72,
       
  1581 	/** SIM Toolkit Security Header 4. */
       
  1582 		ESmsIEISIMToolkitSecurityHeaders4=0x73,
       
  1583 	/** SIM Toolkit Security Header 5. */
       
  1584 		ESmsIEISIMToolkitSecurityHeaders5=0x74,
       
  1585 	/** SIM Toolkit Security Header 6. */
       
  1586 		ESmsIEISIMToolkitSecurityHeaders6=0x75,
       
  1587 	/** SIM Toolkit Security Header 7. */
       
  1588 		ESmsIEISIMToolkitSecurityHeaders7=0x76,
       
  1589 	/** SIM Toolkit Security Header 8. */
       
  1590 		ESmsIEISIMToolkitSecurityHeaders8=0x77,
       
  1591 	/** SIM Toolkit Security Header 9. */
       
  1592 		ESmsIEISIMToolkitSecurityHeaders9=0x78,
       
  1593 	/** SIM Toolkit Security Header 10. */
       
  1594 		ESmsIEISIMToolkitSecurityHeaders10=0x79,
       
  1595 	/** SIM Toolkit Security Header 11. */
       
  1596 		ESmsIEISIMToolkitSecurityHeaders11=0x7A,
       
  1597 	/** SIM Toolkit Security Header 12. */
       
  1598 		ESmsIEISIMToolkitSecurityHeaders12=0x7B,
       
  1599 	/** SIM Toolkit Security Header 13. */
       
  1600 		ESmsIEISIMToolkitSecurityHeaders13=0x7C,
       
  1601 	/** SIM Toolkit Security Header 14. */
       
  1602 		ESmsIEISIMToolkitSecurityHeaders14=0x7D,
       
  1603 	/** SIM Toolkit Security Header 15. */
       
  1604 		ESmsIEISIMToolkitSecurityHeaders15=0x7E,
       
  1605 	/** SIM Toolkit Security Header 16. */
       
  1606 		ESmsIEISIMToolkitSecurityHeaders16=0x7F,
       
  1607 	/** SME to SME specific use 1. */
       
  1608 		ESmsIEISMEToSMESpecificUse1=0x80,
       
  1609 	/** SME to SME specific use 2. */
       
  1610 		ESmsIEISMEToSMESpecificUse2=0x81,
       
  1611 	/** SME to SME specific use 3. */
       
  1612 		ESmsIEISMEToSMESpecificUse3=0x82,
       
  1613 	/** SME to SME specific use 4. */
       
  1614 		ESmsIEISMEToSMESpecificUse4=0x83,
       
  1615 	/** SME to SME specific use 5. */
       
  1616 		ESmsIEISMEToSMESpecificUse5=0x84,
       
  1617 	/** SME to SME specific use 6. */
       
  1618 		ESmsIEISMEToSMESpecificUse6=0x85,
       
  1619 	/** SME to SME specific use 7. */
       
  1620 		ESmsIEISMEToSMESpecificUse7=0x86,
       
  1621 	/** SME to SME specific use 8. */
       
  1622 		ESmsIEISMEToSMESpecificUse8=0x87,
       
  1623 	/** SME to SME specific use 9. */
       
  1624 		ESmsIEISMEToSMESpecificUse9=0x88,
       
  1625 	/** SME to SME specific use 10. */
       
  1626 		ESmsIEISMEToSMESpecificUse10=0x89,
       
  1627 	/** SME to SME specific use 11. */
       
  1628 		ESmsIEISMEToSMESpecificUse11=0x8A,
       
  1629 	/** SME to SME specific use 12. */
       
  1630 		ESmsIEISMEToSMESpecificUse12=0x8B,
       
  1631 	/** SME to SME specific use 13. */
       
  1632 		ESmsIEISMEToSMESpecificUse13=0x8C,
       
  1633 	/** SME to SME specific use 14. */
       
  1634 		ESmsIEISMEToSMESpecificUse14=0x8D,
       
  1635 	/** SME to SME specific use 15. */
       
  1636 		ESmsIEISMEToSMESpecificUse15=0x8E,
       
  1637 	/** SME to SME specific use 16. */
       
  1638 		ESmsIEISMEToSMESpecificUse16=0x8F,
       
  1639 	/** SME to SME specific use 17. */
       
  1640 		ESmsIEISMEToSMESpecificUse17=0x90,
       
  1641 	/** SME to SME specific use 18. */
       
  1642 		ESmsIEISMEToSMESpecificUse18=0x91,
       
  1643 	/** SME to SME specific use 19. */
       
  1644 		ESmsIEISMEToSMESpecificUse19=0x92,
       
  1645 	/** SME to SME specific use 20. */
       
  1646 		ESmsIEISMEToSMESpecificUse20=0x93,
       
  1647 	/** SME to SME specific use 21. */
       
  1648 		ESmsIEISMEToSMESpecificUse21=0x94,
       
  1649 	/** SME to SME specific use 22. */
       
  1650 		ESmsIEISMEToSMESpecificUse22=0x95,
       
  1651 	/** SME to SME specific use 23. */
       
  1652 		ESmsIEISMEToSMESpecificUse23=0x96,
       
  1653 	/** SME to SME specific use 24. */
       
  1654 		ESmsIEISMEToSMESpecificUse24=0x97,
       
  1655 	/** SME to SME specific use 25. */
       
  1656 		ESmsIEISMEToSMESpecificUse25=0x98,
       
  1657 	/** SME to SME specific use 26. */
       
  1658 		ESmsIEISMEToSMESpecificUse26=0x99,
       
  1659 	/** SME to SME specific use 27. */
       
  1660 		ESmsIEISMEToSMESpecificUse27=0x9A,
       
  1661 	/** SME to SME specific use 28. */
       
  1662 		ESmsIEISMEToSMESpecificUse28=0x9B,
       
  1663 	/** SME to SME specific use 29. */
       
  1664 		ESmsIEISMEToSMESpecificUse29=0x9C,
       
  1665 	/** SME to SME specific use 30. */
       
  1666 		ESmsIEISMEToSMESpecificUse30=0x9D,
       
  1667 	/** SME to SME specific use 31. */
       
  1668 		ESmsIEISMEToSMESpecificUse31=0x9E,
       
  1669 	/** SME to SME specific use 32. */
       
  1670 		ESmsIEISMEToSMESpecificUse32=0x9F,
       
  1671 //  Reserved values
       
  1672 //		....
       
  1673 //		....
       
  1674 	/** SC specific use 1. */
       
  1675 		ESmsIEISCSpecificUse1=0xC0,
       
  1676 	/** SC specific use 2. */
       
  1677 		ESmsIEISCSpecificUse2=0xC1,
       
  1678 	/** SC specific use 3. */
       
  1679 		ESmsIEISCSpecificUse3=0xC2,
       
  1680 	/** SC specific use 4. */
       
  1681 		ESmsIEISCSpecificUse4=0xC3,
       
  1682 	/** SC specific use 5. */
       
  1683 		ESmsIEISCSpecificUse5=0xC4,
       
  1684 	/** SC specific use 6. */
       
  1685 		ESmsIEISCSpecificUse6=0xC5,
       
  1686 	/** SC specific use 7. */
       
  1687 		ESmsIEISCSpecificUse7=0xC6,
       
  1688 	/** SC specific use 8. */
       
  1689 		ESmsIEISCSpecificUse8=0xC7,
       
  1690 	/** SC specific use 9. */
       
  1691 		ESmsIEISCSpecificUse9=0xC8,
       
  1692 	/** SC specific use 10. */
       
  1693 		ESmsIEISCSpecificUse10=0xC9,
       
  1694 	/** SC specific use 11. */
       
  1695 		ESmsIEISCSpecificUse11=0xCA,
       
  1696 	/** SC specific use 12. */
       
  1697 		ESmsIEISCSpecificUse12=0xCB,
       
  1698 	/** SC specific use 13. */
       
  1699 		ESmsIEISCSpecificUse13=0xCC,
       
  1700 	/** SC specific use 14. */
       
  1701 		ESmsIEISCSpecificUse14=0xCD,
       
  1702 	/** SC specific use 15. */
       
  1703 		ESmsIEISCSpecificUse15=0xCE,
       
  1704 	/** SC specific use 16. */
       
  1705 		ESmsIEISCSpecificUse16=0xCF,
       
  1706 	/** SC specific use 17. */
       
  1707 		ESmsIEISCSpecificUse17=0xD0,
       
  1708 	/** SC specific use 18. */
       
  1709 		ESmsIEISCSpecificUse18=0xD1,
       
  1710 	/** SC specific use 19. */
       
  1711 		ESmsIEISCSpecificUse19=0xD2,
       
  1712 	/** SC specific use 20. */
       
  1713 		ESmsIEISCSpecificUse20=0xD3,
       
  1714 	/** SC specific use 21. */
       
  1715 		ESmsIEISCSpecificUse21=0xD4,
       
  1716 	/** SC specific use 22. */
       
  1717 		ESmsIEISCSpecificUse22=0xD5,
       
  1718 	/** SC specific use 23. */
       
  1719 		ESmsIEISCSpecificUse23=0xD6,
       
  1720 	/** SC specific use 24. */
       
  1721 		ESmsIEISCSpecificUse24=0xD7,
       
  1722 	/** SC specific use 25. */
       
  1723 		ESmsIEISCSpecificUse25=0xD8,
       
  1724 	/** SC specific use 26. */
       
  1725 		ESmsIEISCSpecificUse26=0xD9,
       
  1726 	/** SC specific use 27. */
       
  1727 		ESmsIEISCSpecificUse27=0xDA,
       
  1728 	/** SC specific use 28. */
       
  1729 		ESmsIEISCSpecificUse28=0xDB,
       
  1730 	/** SC specific use 29. */
       
  1731 		ESmsIEISCSpecificUse29=0xDC,
       
  1732 	/** SC specific use 30. */
       
  1733 		ESmsIEISCSpecificUse30=0xDD,
       
  1734 	/** SC specific use 31. */
       
  1735 		ESmsIEISCSpecificUse31=0xDE,
       
  1736 	/** SC specific use 32. */
       
  1737 		ESmsIEISCSpecificUse32=0xDF,
       
  1738 	/**
       
  1739 	 *  @internalComponent
       
  1740 	 */
       
  1741 		ESmsIEMaximum = 0xFF
       
  1742 		};
       
  1743 
       
  1744 public:
       
  1745 	// Exported functions
       
  1746 	IMPORT_C TSmsInformationElementIdentifier Identifier() const;
       
  1747 	IMPORT_C TPtr8 Data();
       
  1748 	IMPORT_C const TDesC8& Data() const;
       
  1749 public:
       
  1750 	static CSmsInformationElement* NewL(TSmsInformationElementIdentifier aIdentifier,const TDesC8& aData);
       
  1751 	static CSmsInformationElement* NewL();
       
  1752 	~CSmsInformationElement();
       
  1753 
       
  1754 	TUint8* EncodeL(TUint8* aPtr) const;
       
  1755 	void DecodeL(TGsmuLex8& aPdu);
       
  1756 	void InternalizeL(RReadStream& aStream);
       
  1757 	void ExternalizeL(RWriteStream& aStream) const;
       
  1758 	void ConstructL(const TDesC8& aData);
       
  1759 	TUint Length() const;
       
  1760 protected:
       
  1761 	void NewDataL(TInt aLength);
       
  1762 	inline CSmsInformationElement(TSmsInformationElementIdentifier aInformationElementIdentifier);
       
  1763 protected:
       
  1764 	TSmsOctet iIdentifier;
       
  1765 	HBufC8* iData;
       
  1766 	};
       
  1767 
       
  1768 
       
  1769 /**
       
  1770  *  @internalComponent
       
  1771  *  
       
  1772  *  TSmsInformationElementCategories
       
  1773  *  
       
  1774  *  This class specifies where information elements are located SMS Messages.
       
  1775  *  
       
  1776  *  It specifies which PDUs each information element can be located in.
       
  1777  *  
       
  1778  *  The SMS stack uses this information when encoding and decoding SMS messages.
       
  1779  */
       
  1780 class TSmsInformationElementCategories
       
  1781     {
       
  1782 public:
       
  1783 
       
  1784     // Comment, table approach probably is not necessary here.
       
  1785     // Simply use a switch statement as cannot index directly into table.
       
  1786 
       
  1787     enum TInformationElementCategory
       
  1788     {
       
  1789         EEmsInformationElement,
       
  1790         ECtrlMandatoryInEveryPDUAndWithIdenticalValues,    // e.g. Port Addresses
       
  1791         ECtrlMandatoryInEveryPDUMultipleInstancesPerPDU,   // e.g. Special SMS Message Indication
       
  1792         ECtrlMandatoryInEveryPDUButWithValueSpecificToPDU, // e.g. Email Header / Concatenation Elements, SMSC Parameters
       
  1793         ECtrlMandatoryIn1stPDUOnly,                        // e.g. Reply Address
       
  1794         ECtrlSingleInstanceOnly,                           // e.g. Enhanced Voice Mail
       
  1795         ECtrlMultipleInstancesAllowed,                     // e.g. Hyperlink format
       
  1796         ENumberOfCategories
       
  1797     };
       
  1798 
       
  1799 typedef CSmsInformationElement::TSmsInformationElementIdentifier TInformationElementId;
       
  1800 
       
  1801 private:
       
  1802     enum TIndexToCategory
       
  1803     {
       
  1804         EIndexEmsInformationElement,
       
  1805         EIndexCtrlMandatoryInEveryPDUAndWithIdenticalValues,
       
  1806         EIndexCtrlMandatoryInEveryPDUMultipleInstancesPerPDU,
       
  1807         EIndexCtrlMandatoryInEveryPDUButWithValueSpecificToPDU,
       
  1808         EIndexCtrlMandatoryIn1stPDUOnly,
       
  1809         EIndexCtrlSingleInstanceOnly,
       
  1810         EIndexCtrlMultipleInstancesAllowed,
       
  1811         EIndexCtrlOptionalInEveryPDUWithValueSpecificToPDU,
       
  1812         ENumberOfIndices
       
  1813     };
       
  1814 
       
  1815 public:
       
  1816     static TBool GetCategoryDefinition(TInformationElementId aId, TInformationElementCategory& aCategory);
       
  1817 private:
       
  1818     static TBool TranslateCategoryToIndex(TInformationElementId aId, TInt& index);
       
  1819     TSmsInformationElementCategories()  {};
       
  1820     ~TSmsInformationElementCategories() {};
       
  1821     void operator=(TSmsInformationElementCategories& aCategory) {(void) aCategory;  };
       
  1822     TBool operator==(TSmsInformationElementCategories& aCategory){(void) aCategory; return EFalse; };
       
  1823     static const TInformationElementCategory categories[ENumberOfIndices];
       
  1824     };
       
  1825 
       
  1826 
       
  1827 /**
       
  1828  *  @internalComponent
       
  1829  */
       
  1830 typedef CSmsInformationElement::TSmsInformationElementIdentifier TSmsId;
       
  1831 
       
  1832 
       
  1833 /**
       
  1834  *  Mobile originated SMS sent to the network requesting an action or information
       
  1835  *  on the status of a previously sent SUBMIT.
       
  1836  *  
       
  1837  *  This is internal and not intended for use.
       
  1838  *  @publishedAll
       
  1839  *  @released 
       
  1840  */
       
  1841 class CSmsCommandData : public CBase
       
  1842 	{
       
  1843 public:
       
  1844 	enum {KSmsMaxDataSize=157};
       
  1845 public:
       
  1846 	static CSmsCommandData* NewL(TSmsFirstOctet& aFirstOctet);
       
  1847 	~CSmsCommandData();
       
  1848 
       
  1849 	inline TInt NumInformationElements() const;
       
  1850 	CSmsInformationElement& InformationElement(TInt aIndex) const;
       
  1851 	CSmsInformationElement*& InformationElementPtr(TInt aIndex);
       
  1852 	TBool InformationElementIndex(CSmsInformationElement::TSmsInformationElementIdentifier aIdentifier,
       
  1853 		TInt& aIndex) const;
       
  1854 	void AddInformationElementL(const TSmsId aIdentifier,const TDesC8& aData);
       
  1855 	void RemoveInformationElement(TInt aIndex);
       
  1856 
       
  1857 	inline TInt MaxDataLength() const;
       
  1858 	TPtrC8 Data() const;
       
  1859 	void SetDataL(const TDesC8& aData);
       
  1860 
       
  1861 	TUint8* EncodeL(TUint8* aPtr) const;
       
  1862 	void DecodeL(TGsmuLex8& aPdu);
       
  1863 	void InternalizeL(RReadStream& aStream);
       
  1864 	void ExternalizeL(RWriteStream& aStream) const;
       
  1865 private:
       
  1866 	CSmsCommandData(TSmsFirstOctet& aFirstOctet);
       
  1867 
       
  1868 	TInt HeaderLength() const;
       
  1869 	TInt TotalHeaderLengthInUDLUnits() const;
       
  1870 
       
  1871 	TBool HeaderPresent() const;
       
  1872 	void SetHeaderPresent(TBool aHeaderPresent);
       
  1873 
       
  1874 private:
       
  1875 	TSmsFirstOctet& iFirstOctet;
       
  1876 	CArrayPtrFlat <CSmsInformationElement> iInformationElementArray;
       
  1877 	HBufC8* iBuffer;
       
  1878 	};
       
  1879 
       
  1880 
       
  1881 /**
       
  1882  *  Enumerations and operations for SMS commands.
       
  1883  *  @publishedAll
       
  1884  *  @released 
       
  1885  */
       
  1886 class TSmsCommandType : public TSmsOctet
       
  1887 	{
       
  1888 public:
       
  1889 /** Command types. */
       
  1890 	enum TSmsCommandTypeValue
       
  1891 		{
       
  1892 	/** Enquiry. */
       
  1893 		ESmsCommandTypeEnquiry=0x00,
       
  1894 	/** Cancel. */
       
  1895 		ESmsCommandTypeCancel=0x01,
       
  1896 	/** Delete. */
       
  1897 		ESmsCommandTypeDelete=0x02,
       
  1898 	/** Enable Status Report Request. */
       
  1899 		ESmsCommandTypeEnableStatusReportRequest=0x03
       
  1900 //  Reserved values
       
  1901 //		....
       
  1902 //		....
       
  1903 		};
       
  1904 public:
       
  1905 	TSmsCommandType();
       
  1906 	inline TInt CommandType() const;
       
  1907 	inline void SetCommandType(TSmsCommandTypeValue aType);
       
  1908 	};
       
  1909 
       
  1910 
       
  1911 /**
       
  1912  *  Operations on the User Data described in TP-UD.
       
  1913  *  @publishedAll
       
  1914  *  @released 
       
  1915  */
       
  1916 class CSmsUserData : public CBase
       
  1917 	{
       
  1918 public:
       
  1919 	enum {KSmsMaxUserDataSize=140};
       
  1920 
       
  1921 public:
       
  1922 	static CSmsUserData* NewL(CCnvCharacterSetConverter& aCharacterSetConverter,RFs& aFs,TSmsFirstOctet& aFirstOctet,const TSmsDataCodingScheme& aDataCodingScheme);
       
  1923 	~CSmsUserData();
       
  1924 
       
  1925 	inline TInt NumInformationElements() const;
       
  1926 	IMPORT_C  CSmsInformationElement& InformationElement(TInt aIndex) const;
       
  1927 	IMPORT_C TBool InformationElementIndex(CSmsInformationElement::TSmsInformationElementIdentifier aIdentifier,TInt& aIndex) const;
       
  1928 	IMPORT_C TBool InformationElementLastIndex(CSmsInformationElement::TSmsInformationElementIdentifier aIdentifier,TInt& aIndex) const;
       
  1929 	IMPORT_C void AddInformationElementL(TSmsId aIdentifier,const TDesC8& aData);
       
  1930 	IMPORT_C void RemoveInformationElement(TInt aIndex);
       
  1931 	void InformationElementIndicesL(CSmsInformationElement::TSmsInformationElementIdentifier aIdentifier, CArrayFixFlat<TInt>& aIndices) const;
       
  1932 
       
  1933 	// EMS related methods
       
  1934 	void AddEmsInformationElementL(CEmsInformationElement* aIe); // takes ownership od aIe;
       
  1935 	TBool EmsInformationElementWillFitL(CEmsInformationElement* aIe,CSmsEMSBufferSegmenter& aSeg,TUint& aCharsAddedToCurrentPDU);
       
  1936 	// Control Information Element related methods
       
  1937 	TBool ControlInformationElementWillFitL(CSmsInformationElement* aIe);
       
  1938 	void UpdateInformationElementArrayL(TSmsId aIdentifier,const TDesC8& aData);
       
  1939 	CSmsInformationElement*& InformationElementPtr(TInt aIndex);
       
  1940 
       
  1941 	TInt MaxPackedUDUnitsInBodyRemaining() const;
       
  1942 	TInt MaxPackedUDUnitsInBodyRemaining(TUint totalHeaderLengthInUDLUnits) const;
       
  1943 
       
  1944 	IMPORT_C TInt MaxBodyLengthInChars() const;
       
  1945 	IMPORT_C TPtrC8 Body() const;
       
  1946 	IMPORT_C void SetBodyL(const TDesC8& aBody);
       
  1947 	void AppendBodyL(const TDesC8& aExtraBody);
       
  1948 
       
  1949 	IMPORT_C TBool IsSupportedL(TChar aChar);
       
  1950 	IMPORT_C TBool IsSupportedL(const TDesC& aDes, TInt& aNumberOfUnconvertibleCharacters,
       
  1951 			                    TInt& aIndexOfFirstUnconvertibleCharacter) const;
       
  1952 
       
  1953 	IMPORT_C TBool IsSupportedL(const TDesC& aDes, TSmsEncoding aEncoding,
       
  1954 								TInt& aNumberOfUnconvertibleCharacters,
       
  1955 			                    TInt& aNumberOfDowngradedCharacters,
       
  1956 			                    TInt& aNumberRequiringAlternativeEncoding,
       
  1957 			                    TInt& aIndexOfFirstUnconvertibleCharacter) const;
       
  1958 
       
  1959 	TBool IsBinaryData() const;
       
  1960 
       
  1961 	TUint8* EncodeL(TUint8* aPtr) const;
       
  1962 	void DecodeL(TGsmuLex8& aPdu);
       
  1963 	void DecodeL(TGsmuLex8& aPdu, TBool aAcceptTruncation);
       
  1964 	void InternalizeL(RReadStream& aStream);
       
  1965 	void ExternalizeL(RWriteStream& aStream) const;
       
  1966 private:
       
  1967 	CSmsUserData(CCnvCharacterSetConverter& aCharacterSetConverter,RFs& aFs,TSmsFirstOctet& aFirstOctet,const TSmsDataCodingScheme& aDataCodingScheme);
       
  1968 	void ConstructL();
       
  1969 	TInt HeaderLength() const;
       
  1970 	TInt TotalHeaderLengthInUDLUnits() const;
       
  1971 	TInt BodyLengthInUDLUnits() const;
       
  1972 	void NewBodyL(TInt aLengthInChars);
       
  1973 	TBool HeaderPresent() const;
       
  1974 	void SetHeaderPresent(TBool aHeaderPresent);
       
  1975 	TInt TotalHeaderLengthInUDLUnits(TInt aIElen) const;
       
  1976 
       
  1977 private:
       
  1978 
       
  1979 	CCnvCharacterSetConverter& iCharacterSetConverter;
       
  1980 	RFs& iFs;
       
  1981 
       
  1982 	TSmsFirstOctet& iFirstOctet;
       
  1983 	const TSmsDataCodingScheme& iDataCodingScheme;
       
  1984 	CArrayPtrFlat<CSmsInformationElement> iInformationElementArray;
       
  1985 	HBufC8* iBody;
       
  1986 	};
       
  1987 
       
  1988  enum TSmsMessageIndicationType
       
  1989 	{
       
  1990 	EGsmSmsVoiceMessageWaiting            =0x00,
       
  1991 	EGsmSmsFaxMessageWaiting              =0x01,
       
  1992 	EGsmSmsElectronicMailMessageWaiting   =0x02,
       
  1993 	EGsmSmsExtendedMessageTypeWaiting     =0x03,
       
  1994 	};
       
  1995 
       
  1996  enum TExtendedSmsIndicationType
       
  1997 	{
       
  1998 	EGsmSmsNoExtendedMessageTypeIndication=0x00,
       
  1999 	EGsmSmsVideoMessageWaiting            =0x01,
       
  2000 	EGsmSmsExtendedIndicationType2        =0x02,
       
  2001 	EGsmSmsExtendedIndicationType3        =0x03,
       
  2002 	EGsmSmsExtendedIndicationType4        =0x04,
       
  2003 	EGsmSmsExtendedIndicationType5        =0x05,
       
  2004 	EGsmSmsExtendedIndicationType6        =0x06,
       
  2005 	EGsmSmsExtendedIndicationType7        =0x07
       
  2006 	};
       
  2007 
       
  2008 enum TSmsSpecialMessageIndicationTypeMask
       
  2009     {
       
  2010     /** Define a mask for the bits representing */
       
  2011     /** the TSmsMessageIndicationType and the   */
       
  2012     /** TExtendedSmsIndicationType              */
       
  2013     EGsmSmsSpecialMessageIndicationTypeMask = 0x1F
       
  2014     };
       
  2015 
       
  2016  enum TSmsMessageProfileType
       
  2017     {
       
  2018     EGsmSmsProfileId1 =0x00,
       
  2019     EGsmSmsProfileId2 =0x01,
       
  2020     EGsmSmsProfileId3 =0x02,
       
  2021     EGsmSmsProfileId4 =0x03
       
  2022     };
       
  2023 
       
  2024  enum TVoiceMailInfoType
       
  2025     {
       
  2026     EGsmSmsVoiceMailNotification       = 0x00,
       
  2027     EGsmSmsVoiceMailDeleteConfirmation = 0x01
       
  2028     };
       
  2029     
       
  2030  /** SMSC Control Parameters Selective Status Report For Each Segment. Found in Submit. */		
       
  2031  enum TSmsSMSCControlParameters
       
  2032 	{
       
  2033  /** Status Report for short message transaction completed. */
       
  2034 	ESmsStatusReportTransactionCompleted=0x01,
       
  2035  /** Status Report for permanent error when Service Centre is not making any more transfer attempts. */	
       
  2036 	ESmsStatusReportPermanentError=0x02,
       
  2037  /** Status Report for temporary error when Service Centre is not making any more transfer attempts. */
       
  2038 	ESmsStatusReportTemporaryError=0x04,
       
  2039  /** Status Report for temporary error when Service Centre is still trying to transfer message segment. */
       
  2040 	ESmsStatusReportTemporaryErrorSCTrying=0x08,
       
  2041  /** This is not Supported.
       
  2042  	Reserved for future use. */
       
  2043 	ESmsStatusReportForFutureUse1=0x10,
       
  2044  /** This is not Supported. 
       
  2045  	Reserved for future use. */
       
  2046 	ESmsStatusReportForFutureUse2=0x20,
       
  2047  /** This is not Supported. 
       
  2048  	A Status Report generated by this Short Message, due to a permanent error or last temporary error, 
       
  2049 	 cancels the SRR of the rest of the Short Messages in a concatenated message. */
       
  2050 	ESmsStatusReportCancelRestSRR=0x40,
       
  2051  /** This is not Supported. 
       
  2052  	Include original UDH into the Status Report. */
       
  2053 	ESmsStatusReportIncludeOriginalUDH=0x80,
       
  2054  /** Mask. The 4 least significant bits, which are supported, are set. */
       
  2055  	ESmsSMSCControlParametersMask=0x0F	
       
  2056  	};
       
  2057 
       
  2058 
       
  2059 /** Non Information Element Identifiers. */
       
  2060  enum TSmsNonIEIdentifier
       
  2061  	{
       
  2062  	ESmsTPSRRParameter = 0x00,
       
  2063 	ESmsIncompleteClass0MessageParameter = 0x01
       
  2064 	};
       
  2065 
       
  2066 
       
  2067 /** Status Report Scheme*/
       
  2068 enum TSmsStatusReportScheme
       
  2069 	{
       
  2070 	EDefaultScheme = 0x00,
       
  2071 	ETPSRRScheme = 0x01,
       
  2072 	EControlParametersScheme = 0x10
       
  2073 	};
       
  2074 
       
  2075 
       
  2076 /**
       
  2077  *  This is the base class for Enhanced Voice Mail Notifications and
       
  2078  *  Enhanced Voice Mail Delete Confirmations. It encapsulates
       
  2079  *  the attributes and encoding / decoding algorithms common to
       
  2080  *  both types of Enhanced Voice Mail Information Element.
       
  2081  *  
       
  2082  *  @publishedAll
       
  2083  */
       
  2084 class CEnhancedVoiceMailBoxInformation : public CBase
       
  2085 {
       
  2086 public:
       
  2087    enum {KSmsMaxEnhancedVoiceMailSize = CSmsUserData::KSmsMaxUserDataSize - 3};
       
  2088   // allow space in user data for the following bytes: user data header length, IE ID, IE Length
       
  2089 public:
       
  2090     IMPORT_C TVoiceMailInfoType Type() const;
       
  2091     IMPORT_C void   SetProfile(TSmsMessageProfileType aProfile);
       
  2092     IMPORT_C TSmsMessageProfileType Profile() const;
       
  2093     IMPORT_C void   SetStorage(TBool aIsStored);
       
  2094     IMPORT_C TBool  Store() const;
       
  2095     IMPORT_C void   SetAlmostMaximumCapacity(TBool aIsAlmostFull);
       
  2096     IMPORT_C TBool  AlmostMaximumCapacity() const;
       
  2097     IMPORT_C void   SetMaximumCapacity(TBool aIsFull);
       
  2098     IMPORT_C TBool  MaximumCapacity() const;
       
  2099     IMPORT_C TBool  ExtensionIndicator() const;
       
  2100     IMPORT_C void   SetAccessAddressL(const TDesC& aParsedAddress);
       
  2101     IMPORT_C void   SetParsedAccessAddressL(const TGsmSmsTelNumber& aParsedAddress);
       
  2102     IMPORT_C TPtrC  AccessAddress() const;
       
  2103     IMPORT_C void   ParsedAccessAddress(TGsmSmsTelNumber& aParsedAddress) const;
       
  2104     IMPORT_C void   SetNumberOfVoiceMessages(TUint8 aNumber);
       
  2105     IMPORT_C TUint8 NumberOfVoiceMessages() const;
       
  2106 
       
  2107     static   CEnhancedVoiceMailBoxInformation* NewL();
       
  2108     virtual  ~CEnhancedVoiceMailBoxInformation();
       
  2109 
       
  2110     virtual TUint8* EncodeL(TUint8* aPtr, CCnvCharacterSetConverter& aCharacterSetConverter, RFs& aFs) const;
       
  2111     virtual void DecodeL(TGsmuLex8& aVoiceMailInfo, CCnvCharacterSetConverter& aCharacterSetConverter, RFs& aFs);
       
  2112 protected:
       
  2113     CEnhancedVoiceMailBoxInformation();
       
  2114     CEnhancedVoiceMailBoxInformation(TVoiceMailInfoType aTVoiceMailInfoType);
       
  2115 
       
  2116     CEnhancedVoiceMailBoxInformation(const CEnhancedVoiceMailBoxInformation&);
       
  2117     TBool operator==(const CEnhancedVoiceMailBoxInformation&);
       
  2118     void operator=(const CEnhancedVoiceMailBoxInformation&);
       
  2119 
       
  2120     void ConstructL();
       
  2121     void NewBufferL(TInt aLength);
       
  2122     void DoSetParsedAddressL(const TDesC& aAddress);
       
  2123 protected:
       
  2124     TVoiceMailInfoType iType;
       
  2125     TBool iOctet1Bit1;
       
  2126     TSmsMessageProfileType iProfile;
       
  2127     TBool iStorage;
       
  2128     TBool iAlmostFull;
       
  2129     TBool iFull;
       
  2130     TBool iExtensionIndicator;
       
  2131 
       
  2132     HBufC* iAccessAddress;
       
  2133     TGsmSmsTypeOfAddress iTypeOfAddress;
       
  2134 
       
  2135     TUint8 iNumberOfVoiceMessages;
       
  2136 private:
       
  2137 enum TBitMasks
       
  2138 	{
       
  2139 	EMask1Bit  = 0x01,
       
  2140 	EMask2Bits = 0x03,
       
  2141 	EMask4Bits = 0x0F
       
  2142 	};
       
  2143 };
       
  2144 
       
  2145 
       
  2146 /**
       
  2147  *  This class encapsulates the attributes of a VM Notification as described in 23.040 V6.5.0.
       
  2148  *  It is used as one of the attributes a Enhanced Voice Mail Notification.
       
  2149  *  
       
  2150  *  @publishedAll
       
  2151  */
       
  2152 class CVoiceMailNotification : public CBase
       
  2153 {
       
  2154 public:
       
  2155     IMPORT_C void    SetMessageId(TUint16 aMessageId);
       
  2156     IMPORT_C TUint16 MessageId() const;
       
  2157     IMPORT_C void    SetMessageLength(TUint8 aLength);
       
  2158     IMPORT_C TUint8  MessageLength() const;
       
  2159     IMPORT_C void    SetRetentionDays(TUint8 aDays);
       
  2160     IMPORT_C TUint8  RetentionDays() const;
       
  2161     IMPORT_C void    SetPriorityIndication(TBool aPriority);
       
  2162     IMPORT_C TBool   PriorityIndication() const;
       
  2163     IMPORT_C TBool   MessageExtensionIndication() const;
       
  2164     IMPORT_C void    SetCallingLineIdentityL(TDesC& aLineIdentity);
       
  2165     IMPORT_C TPtrC   CallingLineIdentity() const;
       
  2166     IMPORT_C void    SetParsedCallingLineIdentityL(TGsmSmsTelNumber& aParsedAddress);
       
  2167     IMPORT_C void    ParsedCallingLineIdentity(TGsmSmsTelNumber& aParsedAddress) const;
       
  2168 
       
  2169     IMPORT_C static  CVoiceMailNotification* NewL();
       
  2170     IMPORT_C virtual ~CVoiceMailNotification();
       
  2171 
       
  2172     TUint8  SizeL(CCnvCharacterSetConverter& aCharacterSetConverter, RFs& aFs);
       
  2173 
       
  2174     virtual TUint8* EncodeL(TUint8* aPtr, CCnvCharacterSetConverter& aCharacterSetConverter, RFs& aFs) const;
       
  2175     virtual void    DecodeL(TGsmuLex8& aVoiceMailInfo, CCnvCharacterSetConverter& aCharacterSetConverter, RFs& aFs);
       
  2176 protected:
       
  2177     CVoiceMailNotification();
       
  2178     CVoiceMailNotification(const CVoiceMailNotification&);
       
  2179     TBool    operator==(const CVoiceMailNotification&);
       
  2180     void    operator=(const CVoiceMailNotification&);
       
  2181     void    ConstructL();
       
  2182     void    NewBufferL(TInt aLength);
       
  2183     void    NewExtensionL(TInt aLength);
       
  2184 
       
  2185     void DoSetParsedAddressL(const TDesC& aAddress);
       
  2186 protected:
       
  2187     TUint16 iMessageId;
       
  2188     TUint8  iMessageLength;
       
  2189     TUint8  iRetentionDays;
       
  2190     TBool   iOctetN8Bit1;
       
  2191     TBool   iPriorityIndication;
       
  2192     TBool   iMessageExtensionIndicator;
       
  2193 
       
  2194     HBufC*  iCallingLineIdentity;
       
  2195     TGsmSmsTypeOfAddress iTypeOfAddress;
       
  2196 
       
  2197     HBufC*  iExtension;
       
  2198 private:
       
  2199  enum TBitMasks
       
  2200 	{
       
  2201 	EMask1Bit  = 0x01,
       
  2202 	EMask2Bits = 0x03,
       
  2203 	EMask4Bits = 0x0F,
       
  2204 	EMask5Bits = 0x1F
       
  2205 	};
       
  2206 };
       
  2207 
       
  2208 
       
  2209 /**
       
  2210  *  This class encapsulates the attributes of an Enhanced Voice Mail Notification as described in
       
  2211  *  9.2.3.24.13.1. An enhanced voice mail notification is added to a CSmsMessage using the
       
  2212  *  interface provided by the class CSmsEnhancedVoiceMailOperations.
       
  2213  *  
       
  2214  *  Clients should be aware that 23.040 v6.5.0 specifies that this information element must fit into the
       
  2215  *  user data field of a single PDU. The amount of space available in the user data field depends on both
       
  2216  *  the number and size of the mandatory information elements that must also be present.
       
  2217  *  Intuitively the largest Enhanced Voice Mail information element can be added when no mandatory information
       
  2218  *  elements need to be encoded in the PDU. To achieve this, the CSmsMessage must be configured with
       
  2219  *  only the Enhanced Voice Mail Information Element and no other information elements or text.
       
  2220  *  
       
  2221  *  @publishedAll
       
  2222  */
       
  2223 class CEnhancedVoiceMailNotification : public CEnhancedVoiceMailBoxInformation
       
  2224 {
       
  2225 public:
       
  2226     enum {KMaxNumberOfNotifications = 15};
       
  2227 protected:
       
  2228     enum {KSmsNotificationBitMask = 0x0F};
       
  2229     // bits mask for bit representing the number of voice mail notifications.
       
  2230 public:
       
  2231     IMPORT_C TUint8   NumberOfVoiceMails();
       
  2232     IMPORT_C RPointerArray<CVoiceMailNotification>& GetVoiceMailNotifications();
       
  2233 
       
  2234     IMPORT_C static  CEnhancedVoiceMailNotification* NewL();
       
  2235     IMPORT_C ~CEnhancedVoiceMailNotification();
       
  2236 
       
  2237     TUint8* EncodeL(TUint8* aPtr, CCnvCharacterSetConverter& aCharacterSetConverter, RFs& aFs) const;
       
  2238     void    DecodeL(TGsmuLex8& aVoiceMailInfo, CCnvCharacterSetConverter& aCharacterSetConverter, RFs& aFs);
       
  2239 protected:
       
  2240     CEnhancedVoiceMailNotification();
       
  2241     CEnhancedVoiceMailNotification(const CEnhancedVoiceMailNotification&);
       
  2242     TBool operator==(const CEnhancedVoiceMailNotification&);
       
  2243     void operator=(const CEnhancedVoiceMailNotification&);
       
  2244     void NewExtensionL(TInt aLength);
       
  2245     void ConstructL();
       
  2246 protected:
       
  2247     TUint  iNumberOfVMNotifications;
       
  2248     HBufC* iExtension;
       
  2249     RPointerArray<CVoiceMailNotification>* iNotifications;
       
  2250 };
       
  2251 
       
  2252 
       
  2253 /**
       
  2254  *  This class encapsulates the attributes of a VM Deletion  as described in 23.040 V6.5.0.
       
  2255  *  9.2.3.24.13.1.
       
  2256  *  
       
  2257  *  It is used as one of the attributes of a Enhanced Voice Mail Delete Confirmation.
       
  2258  *  
       
  2259  *  @publishedAll
       
  2260  */
       
  2261 class CVoiceMailDeletion : public CBase
       
  2262 {
       
  2263 public:
       
  2264     IMPORT_C void    SetMessageId(TUint16 aMessageId);
       
  2265     IMPORT_C TUint16 MessageId() const;
       
  2266     IMPORT_C TBool   MessageExtensionIndication() const;
       
  2267 
       
  2268     IMPORT_C static  CVoiceMailDeletion* NewL();
       
  2269     IMPORT_C virtual ~CVoiceMailDeletion();
       
  2270     TUint8 SizeL();
       
  2271 
       
  2272 	virtual TUint8* EncodeL(TUint8* aPtr) const;
       
  2273     virtual void DecodeL(TGsmuLex8& aVoiceMailInfo);
       
  2274 protected:
       
  2275     CVoiceMailDeletion();
       
  2276     CVoiceMailDeletion(const CVoiceMailDeletion&);
       
  2277     TBool operator==(const CVoiceMailDeletion&);
       
  2278     void operator=(const CVoiceMailDeletion&);
       
  2279 
       
  2280     void ConstructL();
       
  2281     void NewBufferL(TInt aLength);
       
  2282 protected:
       
  2283     TUint   iMessageId;
       
  2284     TBool   iExtensionIndicator;
       
  2285     HBufC*  iExtension;
       
  2286 };
       
  2287 
       
  2288 
       
  2289 /**
       
  2290  *  This class encapsulates the attributes of an Enhanced Voice Delete Confirmation as described in
       
  2291  *  9.2.3.24.13.2. An enhanced voice delete confirmation is added to a CSmsMessage using the
       
  2292  *  interface provided by the class CSmsEnhancedVoiceMailOperations.
       
  2293  *  
       
  2294  *  @publishedAll
       
  2295  */
       
  2296 class CEnhancedVoiceMailDeleteConfirmations : public
       
  2297       CEnhancedVoiceMailBoxInformation
       
  2298 {
       
  2299 public:
       
  2300     enum {KMaxNumberOfNotifications = 31};
       
  2301 protected:
       
  2302     enum {KSmsNotificationBitMask = 0x1F};
       
  2303     // bits mask for bit representing the number of voice mail deletions.
       
  2304 public:
       
  2305     IMPORT_C TUint8  NumberOfDeletes();
       
  2306     IMPORT_C RPointerArray<CVoiceMailDeletion>& GetVoiceMailDeletions();
       
  2307 
       
  2308     IMPORT_C static CEnhancedVoiceMailDeleteConfirmations* NewL();
       
  2309     IMPORT_C ~CEnhancedVoiceMailDeleteConfirmations();
       
  2310 
       
  2311 	TUint8* EncodeL(TUint8* aPtr, CCnvCharacterSetConverter& aCharacterSetConverter, RFs& aFs) const;
       
  2312     void    DecodeL(TGsmuLex8& aVoiceMailInfo, CCnvCharacterSetConverter& aCharacterSetConverter, RFs& aFs);
       
  2313 protected:
       
  2314     CEnhancedVoiceMailDeleteConfirmations();
       
  2315     CEnhancedVoiceMailDeleteConfirmations(const CEnhancedVoiceMailDeleteConfirmations&);
       
  2316     TBool operator==(const CEnhancedVoiceMailDeleteConfirmations&);
       
  2317     void operator=(const CEnhancedVoiceMailDeleteConfirmations&);
       
  2318 
       
  2319     void ConstructL();
       
  2320     void NewExtensionL(TInt aLength);
       
  2321 protected:
       
  2322     HBufC*  iExtension;
       
  2323     RPointerArray<CVoiceMailDeletion>* iVoiceMailDeletions;
       
  2324 };
       
  2325 
       
  2326 
       
  2327 #include <gsmuelem.inl>
       
  2328 
       
  2329 #endif // !defined __GSMUELEM_H__