supl/locationomasuplprotocolhandler/asnconverterpluginapi/src/epos_comasuplend.cpp
changeset 0 667063e416a2
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     1 /*
       
     2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Header file for supl end message
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 
       
    21 #include <e32def.h>
       
    22 
       
    23 #include "epos_comasuplend.h"
       
    24 #include "lbs/epos_comasuplposition.h"
       
    25 #include "lbs/epos_comasuplvelocity.h"
       
    26 #include "epos_comasuplsessionid.h"
       
    27 #include "lbs/epos_eomasuplposerrors.h"
       
    28 
       
    29 
       
    30 // ============================ MEMBER FUNCTIONS of COMASuplEnd===============================
       
    31     
       
    32 // -----------------------------------------------------------------------------
       
    33 // COMASuplEnd::NewL() 
       
    34 // (other items were commented in a header).
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 EXPORT_C COMASuplEnd* COMASuplEnd::NewL()
       
    38     {
       
    39     COMASuplEnd* self = new( ELeave ) COMASuplEnd;
       
    40     CleanupStack::PushL( self );
       
    41     self->ConstructL();
       
    42     CleanupStack::Pop(self);
       
    43     return self;
       
    44     }
       
    45     
       
    46 // -----------------------------------------------------------------------------
       
    47 // COMASuplEnd::~COMASuplEnd() 
       
    48 // (other items were commented in a header).
       
    49 // -----------------------------------------------------------------------------
       
    50 //    
       
    51 EXPORT_C COMASuplEnd::~COMASuplEnd()
       
    52     {
       
    53 	if(iPosition)
       
    54 		{
       
    55 		delete iPosition;
       
    56 		iPosition = NULL;
       
    57 		}
       
    58 	
       
    59     }
       
    60 // -----------------------------------------------------------------------------
       
    61 // COMASuplEnd::Position()
       
    62 // (other items were commented in a header).
       
    63 // -----------------------------------------------------------------------------
       
    64 //   			
       
    65 EXPORT_C TInt COMASuplEnd::Position(COMASuplPosition*& aPosition)const
       
    66 {
       
    67 	if(iOptionalMask & (1<<(0)))
       
    68 		{
       
    69 		aPosition = iPosition;		
       
    70 		return KErrNone;
       
    71 		}
       
    72 	else
       
    73 		{
       
    74 		return KErrOMASuplParamNotSet;
       
    75 		}
       
    76 }						  			   
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // COMASuplEnd::SetPosition() 
       
    80 // (other items were commented in a header).
       
    81 // -----------------------------------------------------------------------------
       
    82 //   			
       
    83 EXPORT_C void COMASuplEnd::SetPosition(COMASuplPosition* aPosition)
       
    84 {	
       
    85 	delete iPosition;
       
    86 	iPosition = NULL;
       
    87 	iPosition = aPosition;
       
    88 	if(iPosition)
       
    89 		{
       
    90 		iOptionalMask |= LEFTSHIFT(0);		
       
    91 		}	
       
    92 }	
       
    93 // -----------------------------------------------------------------------------
       
    94 // COMASuplEnd::StatusCode()
       
    95 // (other items were commented in a header).
       
    96 // -----------------------------------------------------------------------------
       
    97 //   			
       
    98 EXPORT_C TInt COMASuplEnd::StatusCode(TOMASuplStatusCode& aStatusCode)const
       
    99 {
       
   100 	if(iOptionalMask & (1<<(1)))
       
   101 		{
       
   102 		aStatusCode = iStatusCode;		
       
   103 		return KErrNone;
       
   104 		}
       
   105 	else
       
   106 		{
       
   107 		return KErrOMASuplParamNotSet;
       
   108 		}
       
   109 }						  			   
       
   110 
       
   111 // -----------------------------------------------------------------------------
       
   112 // COMASuplEnd::SetStatusCode() 
       
   113 // (other items were commented in a header).
       
   114 // -----------------------------------------------------------------------------
       
   115 //   			
       
   116 EXPORT_C void COMASuplEnd::SetStatusCode(TOMASuplStatusCode aStatusCode)
       
   117 {
       
   118 	iStatusCode = aStatusCode;
       
   119 	iOptionalMask |= LEFTSHIFT(1);
       
   120 }	
       
   121 
       
   122 // -----------------------------------------------------------------------------
       
   123 // COMASuplEnd::StatusCode()
       
   124 // (other items were commented in a header).
       
   125 // -----------------------------------------------------------------------------
       
   126 //   			
       
   127 EXPORT_C TInt COMASuplEnd::Ver(TDes8& aVer)const
       
   128 {
       
   129 	if(iOptionalMask & (1<<(2)))
       
   130 		{
       
   131 		if(aVer.MaxLength() >= iVer.Length())
       
   132 		    {
       
   133 		    aVer.Copy(iVer);
       
   134 		    return KErrNone;
       
   135 		    }
       
   136 		return KErrArgument;
       
   137 		}
       
   138 	else
       
   139 		{
       
   140 		return KErrOMASuplParamNotSet;
       
   141 		}
       
   142 }						  			   
       
   143 // -----------------------------------------------------------------------------
       
   144 // COMASuplEnd::SetStatusCode() 
       
   145 // (other items were commented in a header).
       
   146 // -----------------------------------------------------------------------------
       
   147 //   			
       
   148 EXPORT_C void COMASuplEnd::SetVer(TDesC8& aVer)
       
   149     {
       
   150     if(aVer.Length() <= iVer.MaxLength())
       
   151         {
       
   152         iVer.Copy(aVer);
       
   153         iOptionalMask |= LEFTSHIFT(2);
       
   154         }
       
   155     }  
       
   156 // -----------------------------------------------------------------------------
       
   157 // COMASuplEnd::Clone() 
       
   158 // (other items were commented in a header).
       
   159 // -----------------------------------------------------------------------------
       
   160 //   			
       
   161 EXPORT_C void COMASuplEnd::Clone(const COMASuplAsnMessageBase* aEnd,TInt& aErrorCode)
       
   162 {
       
   163 	TRAP(aErrorCode, CloneBaseL(aEnd,aErrorCode));
       
   164 	if(aErrorCode)
       
   165 	 	return;
       
   166 	COMASuplEnd* suplEnd = (COMASuplEnd*)aEnd;
       
   167 	iOptionalMask = suplEnd->iOptionalMask;
       
   168 	if(suplEnd->iOptionalMask & (1<<(1)))
       
   169 		{
       
   170 		iStatusCode = suplEnd->iStatusCode;	
       
   171 		}
       
   172 	if(suplEnd->iOptionalMask & (1<<(2)))
       
   173 		{
       
   174 		iVer.Copy(suplEnd->iVer);
       
   175 		}
       
   176 	if(suplEnd->iOptionalMask & (1<<(0)))
       
   177 		{
       
   178 		delete iPosition;
       
   179 		iPosition = NULL;
       
   180 		TRAP(aErrorCode,iPosition =static_cast <COMASuplPosition *> (suplEnd->iPosition->CloneL()));
       
   181 		}
       
   182 }						  			   
       
   183 // -----------------------------------------------------------------------------
       
   184 // COMASuplEnd::ConstructL() 
       
   185 // (other items were commented in a header).
       
   186 // -----------------------------------------------------------------------------
       
   187 //
       
   188 EXPORT_C void COMASuplEnd::ConstructL()
       
   189     {
       
   190     iOptionalMask = 0;
       
   191     iStatusCode = EUnspecified;
       
   192     SetMessageType(COMASuplAsnMessageBase::ESUPL_END);
       
   193     }
       
   194 // -----------------------------------------------------------------------------
       
   195 // COMASuplEnd::COMASuplEnd() 
       
   196 // (other items were commented in a header).
       
   197 // -----------------------------------------------------------------------------
       
   198 //
       
   199 EXPORT_C COMASuplEnd::COMASuplEnd()
       
   200 	{
       
   201 		
       
   202 	}
       
   203 
       
   204