networkprotocolmodules/common/suplrrlpasn1/inc/suplpos.h
changeset 57 3267d9ea3e98
parent 48 81c9bee26a45
child 61 a2244af7b395
equal deleted inserted replaced
48:81c9bee26a45 57:3267d9ea3e98
     1 // Copyright (c) 2007-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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalTechnology
       
    19  
       
    20 */
       
    21 #ifndef LBS_SUPL_POS_H
       
    22 #define LBS_SUPL_POS_H
       
    23 
       
    24 #include "suplmessagebase.h"
       
    25 #include "suplpospayload.h"
       
    26 #include <lbspositioninfo.h>
       
    27 
       
    28 // forward declarations
       
    29 class ASN1PERDecodeBuffer;
       
    30 class ASN1T_PDU;
       
    31 class ASN1C_PDU;
       
    32 
       
    33 
       
    34 /**
       
    35 Encapsulation for outgoing/received SUPL POS messages.
       
    36 
       
    37 @internalTechnology
       
    38 */
       
    39 NONSHARABLE_CLASS(CSuplPos) : public CSuplMessageBase
       
    40 	{
       
    41 public:
       
    42 	IMPORT_C static CSuplPos* NewL(TBool aIsOutgoingMessage);
       
    43 	IMPORT_C static CSuplPos* NewLC(TBool aIsOutgoingMessage);
       
    44 		
       
    45 public:
       
    46 	virtual ~CSuplPos();
       
    47 	
       
    48 public:
       
    49 	
       
    50 	/** Set the velocity parameter (for outgoing messages) */
       
    51 	IMPORT_C TInt SetVelocity(const TPositionInfoBase& aPosInfo);
       
    52 
       
    53 	/** Assigns the payload RRLP message (for outgoing messages) */
       
    54 	IMPORT_C void SetPosPayload(CSuplPosPayload* aPayload);
       
    55 
       
    56 	/** Returns ETrue if the position parameter is present (for received messages) */
       
    57 	IMPORT_C TBool VelocityPresent();
       
    58 
       
    59 	/** Populates aPosInfo according to the velocity parameter (for received messages) */
       
    60 	IMPORT_C TInt GetVelocity(TPositionInfoBase& aPosInfo);
       
    61 	
       
    62 	/** Returns the positioning payload (for received messages).
       
    63 	    The calling method becomes responsible for destruction of the pos payload. */
       
    64 	IMPORT_C CSuplPosPayload* PosPayload();
       
    65 
       
    66 public:
       
    67 
       
    68 	/** Encodes the SUPL POS message to the passed buffer 
       
    69 		Called by CSuplMessageBase::EncodeToL() and not intended for DLL export */
       
    70 	TInt EncodePosPayloadL();
       
    71 	
       
    72 	/** Decodes the content of the positioning payload (for received messages)
       
    73 		Called by CSuplAsn1DecoderImpl::DecodeL() and not intended for DLL export */
       
    74 	void DecodePosPayloadL(TInt& aError);
       
    75 	
       
    76 	void LogPayload();
       
    77 
       
    78 private:
       
    79 	/** Constructor */
       
    80 	CSuplPos(TBool aIsOutgoingMessage);
       
    81 
       
    82 	/** second stage constructor */
       
    83 	void ConstructL();
       
    84 	
       
    85 	/** Prohibit copy constructor */
       
    86 	CSuplPos(const CSuplPos&);
       
    87 
       
    88 	/** Prohibit assigment operator */
       
    89 	CSuplPos& operator= (const CSuplPos&);
       
    90 	
       
    91 private:
       
    92 
       
    93 	// converts speed from encoded value N to meters per second.
       
    94 	TReal32 ConvertHorSpeedToMetersPerSecond(TUint aSpeed);
       
    95 	
       
    96 	// converts speed accuracy from encoded value N to meters per second.
       
    97 	TReal32 ConvertHorSpeedAccuracyToMetersPerSecond(TUint aSpeedAccuracy);
       
    98 
       
    99 private:
       
   100 
       
   101 	/** The positioning payload */	
       
   102 	CSuplPosPayload* iPosPayload;
       
   103 	
       
   104 	/** Objects used in decoding of the positioning payload */
       
   105 	ASN1PERDecodeBuffer* iDecodeBuffer;
       
   106 	ASN1T_PDU* iPayloadData;
       
   107 	ASN1C_PDU* iPayloadPdu;
       
   108 	};
       
   109 
       
   110 #endif // LBS_SUPL_POS_H