networkprotocolmodules/common/suplrrlpasn1/src/rrlpassistancedata.cpp
branchRCL_3
changeset 65 a796fdeeb33c
parent 0 9cfd9a3ee49c
equal deleted inserted replaced
58:87622fad6b51 65:a796fdeeb33c
       
     1 // Copyright (c) 2008-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 
       
    22 #include "RRLP-Messages.h"
       
    23 #include "rrlpassistancedata.h"
       
    24 #include <lbs/lbsassistancedatabase.h>
       
    25 #include <lbs/lbsassistancedatabuilderset.h>
       
    26 #include "supldevloggermacros.h" 
       
    27 
       
    28 
       
    29 /**
       
    30 Static Factory Constructor
       
    31 */
       
    32 EXPORT_C CRrlpAssistanceData* CRrlpAssistanceData::NewL()
       
    33 	{
       
    34 	SUPLLOG(ELogP1, "CRrlpAssistanceData::NewL() Begin\n");
       
    35 	CRrlpAssistanceData* self = new (ELeave) CRrlpAssistanceData();
       
    36 	CleanupStack::PushL(self);
       
    37 	self->ConstructL();
       
    38 	SUPLLOG(ELogP1, "CRrlpAssistanceData::NewL() End\n");
       
    39 	CleanupStack::Pop(self);
       
    40 	return self;
       
    41 	}
       
    42 
       
    43 
       
    44 /**
       
    45 Private default constructor
       
    46 */
       
    47 CRrlpAssistanceData::CRrlpAssistanceData()
       
    48  : CRrlpMessageBase(ERrlpAssistanceData, EFalse)
       
    49 	{
       
    50 	}
       
    51 
       
    52 
       
    53 /**
       
    54 Second stage constructor
       
    55 */
       
    56 void CRrlpAssistanceData::ConstructL()
       
    57 	{
       
    58 	}
       
    59 
       
    60 
       
    61 /**
       
    62 Destructor
       
    63 */
       
    64 CRrlpAssistanceData::~CRrlpAssistanceData()
       
    65 	{
       
    66 	SUPLLOG(ELogP1, "CRrlpAssistanceData::~CRrlpAssistanceData() Begin\n");
       
    67 	SUPLLOG(ELogP1, "CRrlpAssistanceData::~CRrlpAssistanceData() End\n");
       
    68 	}
       
    69 	
       
    70 
       
    71 /** 
       
    72 AssistanceDataPresent()
       
    73 
       
    74 Indicates whether supported assistance data is present in the received message.
       
    75 This implementation supports only receipt of GPS assistance data, hence this
       
    76 method returns ETrue if GPS assistance data is present in the received content.
       
    77 
       
    78 @return ETrue if valid assistance data is present in the received message
       
    79 */
       
    80 EXPORT_C TBool CRrlpAssistanceData::AssistanceDataPresent()
       
    81 	{
       
    82 	SUPLLOG(ELogP1, "CRrlpAssistanceData::AssistanceDataPresent() Begin\n");
       
    83 	__ASSERT_DEBUG(iData != NULL, User::Invariant());
       
    84 	__ASSERT_DEBUG(!iIsOutgoingMessage, User::Invariant());
       
    85 	__ASSERT_DEBUG(iData->component.u.assistanceData != NULL, User::Invariant());
       
    86 	
       
    87 	if (iData->component.u.assistanceData->m.gps_AssistDataPresent == 0)
       
    88 		{
       
    89 		SUPLLOG(ELogP1, "CRrlpAssistanceData::AssistanceDataPresent(EFalse) End\n");
       
    90 		return EFalse;
       
    91 		}
       
    92 	SUPLLOG(ELogP1, "CRrlpAssistanceData::AssistanceDataPresent(ETrue) End\n");
       
    93 	return ETrue;
       
    94 	}
       
    95 
       
    96 
       
    97 /** 
       
    98 BuildAssistanceData()
       
    99 
       
   100 @param  aDataMask populated to indicate what assistance data exists
       
   101 @param  aData     reference to assistance data builder object to populate with
       
   102                   received assistance data
       
   103 @return KErrNotFound if gps assistance data is not present in the received message,
       
   104         KErrNone otherwise
       
   105 */
       
   106 EXPORT_C TInt CRrlpAssistanceData::BuildAssistanceData(TLbsAsistanceDataGroup& aDataMask, RLbsAssistanceDataBuilderSet& aAssistanceDataBuilderSet)
       
   107 	{
       
   108 	SUPLLOG(ELogP1, "CRrlpAssistanceData::BuildAssistanceData() Begin\n");
       
   109 	__ASSERT_DEBUG(iData != NULL, User::Invariant());
       
   110 	__ASSERT_DEBUG(!iIsOutgoingMessage, User::Invariant());
       
   111 	__ASSERT_DEBUG(iData->component.u.assistanceData != NULL, User::Invariant());
       
   112 
       
   113 	
       
   114 	// return immediately if no gps assistance data present
       
   115 	if (iData->component.u.assistanceData->m.gps_AssistDataPresent == 0)
       
   116 		{
       
   117 		SUPLLOG(ELogP1, "CRrlpAssistanceData::BuildAssistanceData() End (no assistance data available)\n");
       
   118 		return KErrNotFound;
       
   119 		}
       
   120 		
       
   121 	// pointer to the received/decoded GPS Assistance Data element
       
   122 	ASN1T_ControlHeader& gpsData = iData->component.u.assistanceData->gps_AssistData.controlHeader;
       
   123 
       
   124 	SUPLLOG(ELogP1, "CRrlpAssistanceData::BuildAssistanceData() End\n");
       
   125 	return CRrlpMessageBase::BuildAssistanceData(aDataMask, aAssistanceDataBuilderSet, gpsData);
       
   126 	}
       
   127 
       
   128 
       
   129 /** 
       
   130 MoreAssDataToBeSent()
       
   131 
       
   132 @return ETrue if another RRLP Assistance Data Message is pending
       
   133 */
       
   134 EXPORT_C TBool CRrlpAssistanceData::MoreAssDataToBeSent()
       
   135 	{
       
   136 	SUPLLOG(ELogP1, "CRrlpAssistanceData::MoreAssDataToBeSent() Begin\n");
       
   137 	__ASSERT_DEBUG(iData != NULL, User::Invariant());
       
   138 	__ASSERT_DEBUG(!iIsOutgoingMessage, User::Invariant());
       
   139 	__ASSERT_DEBUG(iData->component.u.assistanceData != NULL, User::Invariant());
       
   140 	
       
   141 	// check the optional field is present
       
   142 	if (iData->component.u.assistanceData->m.moreAssDataToBeSentPresent != 0)
       
   143 		{
       
   144 		// check the content of the field.
       
   145 		if (iData->component.u.assistanceData->moreAssDataToBeSent == 1)
       
   146 			{
       
   147 			SUPLLOG(ELogP1, "CRrlpAssistanceData::MoreAssDataToBeSent(ETrue) End\n");
       
   148 			return ETrue;
       
   149 			}
       
   150 		}
       
   151 	
       
   152 	SUPLLOG(ELogP1, "CRrlpAssistanceData::MoreAssDataToBeSent(EFalse) End\n");
       
   153 	return EFalse;
       
   154 	}
       
   155 
       
   156 
       
   157 /**
       
   158 GetExtendedReference()
       
   159 
       
   160 Populates aRrlpRef if Rel-5 Extended Reference is present in the received message
       
   161 
       
   162 @param  aRrlpRef local copy of the session reference details
       
   163 @return KErrNotFound if the extended reference parameters are not present,
       
   164         KErrNone otherwise
       
   165 */
       
   166 TInt CRrlpAssistanceData::GetExtendedReference(TRrlpReference& aRrlpRef)
       
   167 	{
       
   168 	__ASSERT_DEBUG(iData->component.u.assistanceData != NULL, User::Invariant());
       
   169 	
       
   170 	if (iData->component.u.assistanceData->m.rel5_AssistanceData_ExtensionPresent != 0)
       
   171 		{
       
   172 		aRrlpRef.aRel5EntendedRefPresent = ETrue;
       
   173 		aRrlpRef.aRel5SmlcCode = iData->component.u.assistanceData->rel5_AssistanceData_Extension.extended_reference.smlc_code;
       
   174 		aRrlpRef.aRel5TransactionId = iData->component.u.assistanceData->rel5_AssistanceData_Extension.extended_reference.transaction_ID;
       
   175 		}
       
   176 	else
       
   177 		{
       
   178 		return KErrNotFound;
       
   179 		}
       
   180 	return KErrNone;
       
   181 	}
       
   182