supl/locationomasuplprotocolhandler/asnconverterpluginapi/src/epos_comasuplpos.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 pos message
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 
       
    20 #include <e32def.h>
       
    21 
       
    22 #include "epos_comasuplpos.h"
       
    23 #include "epos_suplconstants.h"
       
    24 #include "lbs/epos_comasuplvelocity.h"
       
    25 #include "lbs/epos_comasuplpospayload.h"
       
    26 #include "epos_comasuplsessionid.h"
       
    27 #include "lbs/epos_eomasuplposerrors.h"
       
    28 
       
    29 
       
    30 // ============================ MEMBER FUNCTIONS of COMASuplPos===============================
       
    31 // -----------------------------------------------------------------------------
       
    32 // COMASuplPos::NewL() 
       
    33 // (other items were commented in a header).
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 EXPORT_C COMASuplPos* COMASuplPos::NewL()
       
    37     {
       
    38     COMASuplPos* self = new( ELeave ) COMASuplPos;
       
    39     CleanupStack::PushL( self );
       
    40     self->ConstructL();
       
    41     CleanupStack::Pop(self);
       
    42     return self;
       
    43     }
       
    44 // -----------------------------------------------------------------------------
       
    45 // COMASuplPos::~COMASuplPos() 
       
    46 // (other items were commented in a header).
       
    47 // -----------------------------------------------------------------------------
       
    48 //    
       
    49 EXPORT_C COMASuplPos::~COMASuplPos()
       
    50     {
       
    51 	delete iPayload;
       
    52 	delete iVelocity;
       
    53     }
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // COMASuplPos::SuplPos() 
       
    57 // (other items were commented in a header).
       
    58 // -----------------------------------------------------------------------------
       
    59 //   			
       
    60 EXPORT_C COMASuplPosPayload* COMASuplPos::SuplPos()const
       
    61     {
       
    62     return iPayload;
       
    63     }						  			   
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // COMASuplPos::SetSuplPos() 
       
    67 // (other items were commented in a header).
       
    68 // -----------------------------------------------------------------------------
       
    69 //   			
       
    70 EXPORT_C void COMASuplPos::SetSuplPos(COMASuplPosPayload* aPosPayload)
       
    71     {	
       
    72     delete iPayload;
       
    73     iPayload = NULL;
       
    74     iPayload = aPosPayload;
       
    75     }	
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // COMASuplPos::Velocity() 
       
    79 // (other items were commented in a header).
       
    80 // -----------------------------------------------------------------------------
       
    81 //   			
       
    82 EXPORT_C TInt COMASuplPos::Velocity(COMASuplVelocity*& aVelocity)const
       
    83 {
       
    84     if(iOptionalMask & (1<<(0)))
       
    85 		{
       
    86 		aVelocity = iVelocity;		
       
    87 		return KErrNone;
       
    88 		}
       
    89 	else
       
    90 		{
       
    91 		return KErrOMASuplParamNotSet;
       
    92 		}
       
    93 }						  			   
       
    94 
       
    95 // -----------------------------------------------------------------------------
       
    96 // COMASuplPos::SetVelocity() 
       
    97 // (other items were commented in a header).
       
    98 // -----------------------------------------------------------------------------
       
    99 //   			
       
   100 EXPORT_C void COMASuplPos::SetVelocity(COMASuplVelocity* aVelocity)
       
   101 {	
       
   102 	delete iVelocity;
       
   103 	iVelocity = NULL;
       
   104 	iVelocity = aVelocity;
       
   105 	if(iVelocity)
       
   106 		{
       
   107 		iOptionalMask |= LEFTSHIFT(0);		
       
   108 		}	
       
   109 }				   
       
   110 
       
   111 // -----------------------------------------------------------------------------
       
   112 // COMASuplPos::Clone() 
       
   113 // (other items were commented in a header).
       
   114 // -----------------------------------------------------------------------------
       
   115 //   			
       
   116 EXPORT_C void COMASuplPos::Clone(const COMASuplAsnMessageBase* aSuplPos,TInt& aErrorCode)
       
   117 {
       
   118 	TRAP(aErrorCode, CloneBaseL(aSuplPos,aErrorCode));
       
   119 	if(aErrorCode)
       
   120 	 	return;
       
   121 	COMASuplPos* suplPos = (COMASuplPos*)aSuplPos;
       
   122 	
       
   123 	iOptionalMask = suplPos->iOptionalMask;
       
   124 	
       
   125 	if(suplPos->iPayload)
       
   126 	    TRAP(aErrorCode,iPayload =static_cast <COMASuplPosPayload *> (suplPos->iPayload->CloneL()));
       
   127 	if(aErrorCode)
       
   128 		{
       
   129 		return;
       
   130 		}
       
   131 	if(iOptionalMask & (1<<(0)))
       
   132 		{
       
   133 		delete iVelocity;
       
   134 		iVelocity = NULL;
       
   135 		if(suplPos->iVelocity)
       
   136 		    TRAP(aErrorCode,iVelocity =static_cast <COMASuplVelocity *> (suplPos->iVelocity->CloneL()));
       
   137 		}
       
   138 }		
       
   139     
       
   140 // -----------------------------------------------------------------------------
       
   141 // COMASuplPos::COMASuplPos() 
       
   142 // (other items were commented in a header).
       
   143 // -----------------------------------------------------------------------------
       
   144 //
       
   145 EXPORT_C COMASuplPos::COMASuplPos()
       
   146 	{
       
   147 		
       
   148 	}
       
   149 // -----------------------------------------------------------------------------
       
   150 // COMASuplPos::COMASuplPos() 
       
   151 // (other items were commented in a header).
       
   152 // -----------------------------------------------------------------------------
       
   153 //
       
   154 EXPORT_C void COMASuplPos::ConstructL()
       
   155     {
       
   156     SetMessageType(COMASuplAsnMessageBase::ESUPL_POS);
       
   157     }
       
   158