smsprotocols/smsstack/wapprot/Inc/wapdgrm.inl
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 1997-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 contains the inline file of WAPDGRM.CPP
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalAll 
       
    21 */
       
    22 
       
    23 #include <es_mbuf.h>
       
    24 
       
    25 inline TBool CWapDatagram::IsComplete() const
       
    26     {
       
    27     return iIsComplete;
       
    28     }
       
    29 
       
    30 inline void CWapDatagram::SegmentData(TSegmentData& aSegmentData) const
       
    31     {
       
    32     __ASSERT_DEBUG(iSegment != NULL,Panic(KPanicUsageError));
       
    33     if( iSegment )
       
    34         {
       
    35         iSegment->UserData(aSegmentData.iData);
       
    36         aSegmentData.iSegmentNumber = iSegmentNumber;
       
    37         }
       
    38     }
       
    39 
       
    40 inline TInt CWapDatagram::WapDatagramLength() const
       
    41     {
       
    42 	return (*iBuffer).Length();
       
    43     }
       
    44 
       
    45 inline TInt CWapDatagram::WapDatagram(RMBufChain& aBufChain, TUint aMaxLength) const
       
    46     {
       
    47     __ASSERT_DEBUG(iIsComplete,Panic(KPanicUsageError));
       
    48 
       
    49  	TInt err = KErrNone;
       
    50     if (iBuffer)
       
    51         {
       
    52         TInt Length = Min(iBuffer->Length(), aMaxLength);
       
    53  		TRAP(err, aBufChain.AllocL(Length));
       
    54  		if(err == KErrNone)
       
    55  		    {
       
    56  			aBufChain.CopyIn(*iBuffer, 0);
       
    57  			err = 1;	// wrote one datagram
       
    58  			}
       
    59         }
       
    60  	return err;
       
    61     }
       
    62 
       
    63 inline TPtrC CWapDatagram::ToAddress() const
       
    64     {
       
    65     return iToAddress;
       
    66     }
       
    67 
       
    68 inline void CWapDatagram::SetToAddress(const TDesC& aToAddress)
       
    69     {
       
    70     iToAddress = aToAddress;
       
    71     }
       
    72 
       
    73 inline TPtrC CWapDatagram::FromAddress() const
       
    74     {
       
    75     return iFromAddress;
       
    76     }
       
    77 
       
    78 inline void CWapDatagram::SetFromAddress(const TDesC& aFromAddress)
       
    79     {
       
    80     iFromAddress = aFromAddress;
       
    81     }
       
    82 
       
    83 inline void CWapDatagram::Ports(TInt& aFromPort,TInt& aToPort,TBool* aIs16Bit) const
       
    84     {
       
    85     aFromPort = iFromPort;
       
    86     aToPort = iToPort;
       
    87     if (aIs16Bit)
       
    88         *aIs16Bit = i16BitPorts;
       
    89     }
       
    90 
       
    91 inline void CWapDatagram::SetPorts(TInt aFromPort, TInt aToPort,TBool aIs16Bit)
       
    92     {
       
    93     i16BitPorts = aIs16Bit;
       
    94     iFromPort = aFromPort;
       
    95     iToPort = aToPort;
       
    96     }
       
    97 
       
    98 inline void CWapDatagram::OtherHeader(TDes8& aOtherHeader) const
       
    99     {
       
   100     aOtherHeader.Zero();
       
   101     if (iIsTextHeader)
       
   102         iSegment->OtherHeader(aOtherHeader);
       
   103     }
       
   104 
       
   105 inline const TTime& CWapDatagram::Time() const
       
   106     {
       
   107     return iTime;
       
   108     }
       
   109 
       
   110 inline TInt CWapDatagram::NumConcatenatedMessages() const
       
   111     {
       
   112     return iTotalSegments;
       
   113     }
       
   114 
       
   115 inline TInt CWapDatagram::ConcatenatedMessageReference(TBool* aIs16Bit) const
       
   116     {
       
   117     if (aIs16Bit)
       
   118         *aIs16Bit = EFalse;
       
   119     return iReference;
       
   120     }
       
   121 
       
   122 inline void CWapDatagram::
       
   123                 SetConcatenatedMessageReference(TInt    aReference)
       
   124     {
       
   125     iReference = aReference;
       
   126     }
       
   127 
       
   128 inline TSmsDataCodingScheme::TSmsAlphabet CWapDatagram::Alphabet() const
       
   129     {
       
   130     return iUserDataSettings.Alphabet();
       
   131     }
       
   132 
       
   133 inline void CWapDatagram::SetAlphabet(TSmsDataCodingScheme::TSmsAlphabet aAlphabet)
       
   134     {
       
   135     __ASSERT_DEBUG(   aAlphabet == TSmsDataCodingScheme::ESmsAlphabet8Bit
       
   136                     || aAlphabet == TSmsDataCodingScheme::ESmsAlphabet7Bit,
       
   137                     Panic(KPanicUsageError));
       
   138     iUserDataSettings.SetAlphabet(aAlphabet);
       
   139     }
       
   140 
       
   141 inline void CWapDatagram::SetStatusReportScheme(TSmsStatusReportScheme aScheme)
       
   142 	{
       
   143     iScheme = aScheme;
       
   144 	}