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