omasuplasnconverterstubimpl/src/cstubsuplposinit.cpp
changeset 46 e1758cbb96ac
parent 0 0ce1b5ce9557
equal deleted inserted replaced
43:e71858845f73 46:e1758cbb96ac
       
     1 /*
       
     2  * Copyright (c) 2009 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: Supl PosInit
       
    15  *
       
    16  */
       
    17 
       
    18 #include <e32base.h>
       
    19 #include <e32def.h> 
       
    20 #include <e32cmn.h> 
       
    21 #include "epos_comasuplasnbase.h"
       
    22 #include "epos_comasuplasnmessagebase.h"
       
    23 #include "epos_comasuplposinit.h"
       
    24 #include "cstubsuplposinit.h"
       
    25 #include "cstubsuplstart.h"
       
    26 #include "lbs/epos_comasuplreqasstdata.h"
       
    27 #include "lbs/epos_comasuplposition.h"
       
    28 #include "lbs/epos_comasuplvelocity.h"
       
    29 #include "lbs/epos_comasuplsetcapabilities.h"
       
    30 #include "lbs/epos_comasuplpospayload.h"
       
    31 #include "epos_comasuplpos.h"
       
    32 #include "epos_comasuplsessionid.h"
       
    33 #include "epos_comasupllocationid.h"
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // CStubSuplPosInit::NewL
       
    37 // Other Items were commented in a header
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 EXPORT_C CStubSuplPosInit* CStubSuplPosInit::NewL()
       
    41     {
       
    42     CStubSuplPosInit* self = new (ELeave) CStubSuplPosInit;
       
    43     CleanupStack::PushL(self);
       
    44     self->ConstructL();
       
    45     CleanupStack::Pop();
       
    46     return self;
       
    47     }
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // CStubSuplPosInit::~CStubSuplPosInit
       
    51 // Other Items were commented in a header
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 EXPORT_C CStubSuplPosInit::~CStubSuplPosInit()
       
    55     {
       
    56 
       
    57     }
       
    58 // -----------------------------------------------------------------------------
       
    59 // CStubSuplPosInit::ConstructL
       
    60 // Other Items were commented in a header
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 void CStubSuplPosInit::ConstructL()
       
    64     {
       
    65     COMASuplPosInit::ConstructL();
       
    66     //Allocate memory for internal usage....
       
    67     }
       
    68 // -----------------------------------------------------------------------------
       
    69 // CStubSuplPosInit::EncodeL
       
    70 // Other Items were commented in a header
       
    71 // -----------------------------------------------------------------------------
       
    72 //
       
    73 HBufC8* CStubSuplPosInit::EncodeL(TInt& aErrorCode)
       
    74     {
       
    75     aErrorCode = 0;
       
    76     HBufC8* encodedBuffer = NULL;
       
    77     InitializeL();
       
    78     // Do actual encoding here and return encoded buffer and put appropriate error code in aErrorCode
       
    79     return encodedBuffer;
       
    80     }
       
    81 // -----------------------------------------------------------------------------
       
    82 // CStubSuplPosInit::CStubSuplPosInit
       
    83 // Other Items were commented in a header
       
    84 // -----------------------------------------------------------------------------
       
    85 //
       
    86 CStubSuplPosInit::CStubSuplPosInit()
       
    87     {
       
    88     }
       
    89 // -----------------------------------------------------------------------------
       
    90 // CStubSuplPosInit::InitializeL
       
    91 // Other Items were commented in a header
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 void CStubSuplPosInit::InitializeL()
       
    95     {
       
    96     if (iReqAsstData)  //This parameter is optional in asn
       
    97         {
       
    98     InitializeRequestData();
       
    99         }
       
   100     if (iPosition)  //This parameter is optional in asn
       
   101         {
       
   102     InitializePosition();
       
   103         }
       
   104     if (iPosPayload)  //This parameter is optional in asn
       
   105         {
       
   106     InitializePosPayLoad();
       
   107         }
       
   108     if (iSETCapabilities)  //This parameter is mandatory in asn
       
   109         {
       
   110     InitializeSetCapabilities();
       
   111         }
       
   112     if (iLocationId)  //This parameter is mandatory in asn
       
   113         {
       
   114     InitializeLocationId();
       
   115         }
       
   116     if (ieCID)  //This parameter is optional in asn
       
   117         {
       
   118     InitializeECellId();
       
   119         }
       
   120     }
       
   121 void CStubSuplPosInit::InitializeRequestData()
       
   122     { 
       
   123     TBool almanac;
       
   124     TBool utc;
       
   125     TBool ionos;
       
   126     TBool dgps;
       
   127     TBool ref;
       
   128     TBool refTime;
       
   129     TBool acq;
       
   130     TBool realTime; 
       
   131     iReqAsstData->GetReqAsstData(almanac,utc,ionos,dgps,ref,refTime,acq,realTime);
       
   132     //Initialize structure here...
       
   133     }
       
   134 void CStubSuplPosInit::InitializePosition()
       
   135     {
       
   136     // Retrieve mandatory parametrs of Position
       
   137     // Retrieve mandatory parametrs of Position
       
   138     TOMASuplUtcTime utcTime;
       
   139     TOMASuplPositionEstimate posEstimate;
       
   140 
       
   141     iPosition->GetPosition(utcTime,posEstimate );
       
   142 
       
   143     TInt error = 0;
       
   144 
       
   145     //Initialize Time
       
   146     InitializeTime(utcTime);
       
   147     //InitializePositionEstimate
       
   148     
       
   149     InitializePositionEstimate(posEstimate);
       
   150     
       
   151     if(error)
       
   152         {
       
   153         return;
       
   154         }
       
   155     else
       
   156         {
       
   157         COMASuplVelocity* velocity = NULL;
       
   158         error = iPosition->GetVelocity(velocity);
       
   159         if(error)
       
   160             {
       
   161             
       
   162             }
       
   163         else
       
   164             {
       
   165 
       
   166             TOMASuplVelocityType velocityType = velocity->VelType();
       
   167             COMASuplHorizVelocity* horizVelocity = velocity->Velocity();
       
   168             if(horizVelocity)
       
   169                 {
       
   170                 switch(velocityType)
       
   171                     {
       
   172                     case EHorizVelocity:
       
   173                         {
       
   174                         //Initialize Horizontal velocity
       
   175                         IntializeHorizVelocity(horizVelocity);
       
   176                         break;      
       
   177                         }
       
   178                     case EHorizAndVertVelocity:
       
   179                         {
       
   180                         //Initialize Horizontal and Vertical velocity
       
   181                         IntializeHorizAndVertVelocity(horizVelocity);
       
   182                         break;
       
   183                         }
       
   184                     case EHorizUncertVelocity:
       
   185                         {
       
   186                         //Initialize Horizontal Uncert velocity
       
   187                         IntializeHorizUncertVelocity(horizVelocity);
       
   188                         break;
       
   189                         }
       
   190                     case EHorizAndVertUncertVelocity:
       
   191                         {
       
   192                         //Initialize Horizontal Vertical Uncert velocity
       
   193                         IntializeHorizVertUncertVelocity(horizVelocity);
       
   194                         break;  
       
   195                         }
       
   196                     default:
       
   197                         {
       
   198                         //error
       
   199                         return;         
       
   200                         }
       
   201                     }   
       
   202                 }
       
   203             else
       
   204                 {
       
   205                 //error
       
   206                 return; 
       
   207                 }
       
   208             }
       
   209         }
       
   210     }
       
   211 
       
   212 void CStubSuplPosInit::IntializeHorizVelocity(const COMASuplHorizVelocity* aVelocity)
       
   213     {
       
   214     TUint16 bearing;
       
   215     TUint16 horSpeed;
       
   216 
       
   217     aVelocity->GetHorizVel(bearing,horSpeed);
       
   218 
       
   219     //Initialize bearing,horSpeed
       
   220     }
       
   221 
       
   222 void CStubSuplPosInit::IntializeHorizAndVertVelocity(const COMASuplHorizVelocity* aVelocity)
       
   223     {
       
   224     TUint16 bearing;
       
   225     TUint16 horSpeed;
       
   226     TUint8 verDirect;
       
   227     TUint8 verSpeed;
       
   228     
       
   229     COMASuplHorizAndVertVelocity* horizVertVel = (COMASuplHorizAndVertVelocity*)aVelocity;
       
   230 
       
   231     horizVertVel->GetHorizAndVertVel(bearing,horSpeed,verDirect,verSpeed);
       
   232 
       
   233     //Initialize bearing,horSpeed,verDirect,verSpeed
       
   234     }
       
   235 
       
   236 void CStubSuplPosInit::IntializeHorizUncertVelocity(const COMASuplHorizVelocity* aVelocity)
       
   237     {
       
   238     TUint16 bearing;
       
   239     TUint16 horSpeed;
       
   240     TUint8 uncertSpeed;
       
   241 
       
   242     COMASuplHorizUncertVelocity* horizUncertVel = (COMASuplHorizUncertVelocity*)aVelocity;
       
   243 
       
   244     horizUncertVel->GetHorizUncertVel(bearing,horSpeed,uncertSpeed);
       
   245     //Initialize bearing,horSpeed,uncertSpeed
       
   246     }
       
   247 
       
   248 void CStubSuplPosInit::IntializeHorizVertUncertVelocity(const COMASuplHorizVelocity* aVelocity)
       
   249     {
       
   250     TUint16 bearing;
       
   251     TUint16 horSpeed;
       
   252     TUint8  verDirect;
       
   253     TUint8  verSpeed;
       
   254     TUint8  horizUncertSpeed;
       
   255     TUint8  vertUncertSpeed;
       
   256 
       
   257     COMASuplHorizAndVertUncertVelocity* horizVertUncertVel = (COMASuplHorizAndVertUncertVelocity*)aVelocity;
       
   258 
       
   259     horizVertUncertVel->GetHorizVertUncertVel(bearing,horSpeed,verDirect,verSpeed,
       
   260             horizUncertSpeed,vertUncertSpeed);
       
   261     //Initialize bearing,horSpeed,verDirect,verSpeed,horizUncertSpeed,vertUncertSpeed
       
   262     }
       
   263 
       
   264 void CStubSuplPosInit::InitializePosPayLoad()
       
   265     {   
       
   266     // Retrieve mandatory parametrs of PosMessage
       
   267     COMASuplPosPayload::TOMASuplPosPayloadType payloadType;
       
   268     HBufC8* payloadData = NULL;
       
   269 
       
   270     iPosPayload->GetPosPayload(payloadData,payloadType);
       
   271 
       
   272     if(!payloadData)  
       
   273         {
       
   274         //error
       
   275         return; 
       
   276         }
       
   277 
       
   278     TPtr8 ptr = payloadData->Des();
       
   279 
       
   280     TInt len = payloadData->Length();
       
   281 
       
   282     const char* lTemp = (const char *)ptr.Ptr();
       
   283 
       
   284 
       
   285     switch(payloadType)
       
   286         {
       
   287         case COMASuplPosPayload::ETIA801:
       
   288             {
       
   289             //initialize pospayload for TIA   
       
   290             break;
       
   291             }   
       
   292         case COMASuplPosPayload::ERRC:
       
   293             {
       
   294             //initialize pospayload for RRC
       
   295             break;                      
       
   296             }
       
   297         case COMASuplPosPayload::ERRLP:
       
   298             {
       
   299             //initialize pospayload for RRLP
       
   300             break;                      
       
   301             }
       
   302         default:
       
   303             {
       
   304             //error
       
   305             return;
       
   306             }           
       
   307         }
       
   308 
       
   309     }
       
   310 void CStubSuplPosInit::InitializeSetCapabilities()
       
   311     {
       
   312     TOMASuplPosTechnology lPosTechnology;
       
   313     COMASuplSETCapabilities::TOMASuplPrefMethod    lPrefMethod;
       
   314     TOMASuplPosProtocol   lPosProtocol;
       
   315 
       
   316     iSETCapabilities->GetSETCapabilities(lPosTechnology,lPrefMethod,lPosProtocol);
       
   317 
       
   318     TBool lSETAssist;
       
   319     TBool lGpsSETBased;
       
   320     TBool lAuto;
       
   321     TBool lFLT;
       
   322     TBool leOTD;
       
   323     TBool loTDOA;
       
   324 
       
   325     lPosTechnology.GetPosTechnology(lSETAssist,lGpsSETBased,lAuto,
       
   326             lFLT,leOTD,loTDOA);
       
   327 
       
   328     //Initialize structure accordingly from here...
       
   329     }
       
   330 // -----------------------------------------------------------------------------
       
   331 // CStubSuplPosInit::InitializeLocationId
       
   332 // Other Items were commented in a header
       
   333 // -----------------------------------------------------------------------------
       
   334 //
       
   335 void CStubSuplPosInit::InitializeLocationId()
       
   336     {
       
   337     COMASuplLocationId::TOMASuplCellInfoType lChoice = iLocationId->SuplCellInfoType();
       
   338 
       
   339     switch(lChoice)
       
   340         {
       
   341         case COMASuplLocationId::EGSM :
       
   342             {
       
   343             COMASuplGSMCellInfo* lCellInfo = NULL;
       
   344             COMASuplLocationId::TOMASuplStatus lStatus;
       
   345             iLocationId->SuplLocationId(lCellInfo,lStatus);
       
   346             if(lCellInfo)
       
   347                 {
       
   348                 TInt lRefMNC;
       
   349                 TInt lRefMCC;
       
   350                 TInt lRefLAC;
       
   351                 TInt lRefCI;
       
   352                 lCellInfo->SuplGSMCellInfo(lRefMNC,lRefMCC,lRefCI,lRefLAC);
       
   353                 }
       
   354             }
       
   355         case COMASuplLocationId::EWCDMA:
       
   356             {
       
   357             COMASuplCellInfo* lCellInfo = NULL;
       
   358             COMASuplLocationId::TOMASuplStatus lStatus;
       
   359             iLocationId->SuplLocationId(lCellInfo,lStatus);
       
   360             if(lCellInfo)
       
   361                 {
       
   362                 TInt lRefMNC;
       
   363                 TInt lRefMCC;
       
   364                 TInt lRefUC;
       
   365                 lCellInfo->SuplCellInfo(lRefMNC,lRefMCC,lRefUC);
       
   366                 if((KMncMin<=lRefMNC && lRefMNC<=KMncMax) && (KMccMin<=lRefMCC && lRefMCC<=KMccMax) &&
       
   367                         (KRefUcMin<=lRefUC && lRefUC<=KRefUcMax))
       
   368                     {
       
   369                     //Initialize  
       
   370                     }
       
   371                 }
       
   372             else
       
   373                 {
       
   374                 //error    
       
   375                 }
       
   376 
       
   377             }
       
   378         }
       
   379     //Initialize structure accordingly from here...
       
   380     }
       
   381 
       
   382 // -----------------------------------------------------------------------------
       
   383 // CStubSuplPosInit::InitializeECellId
       
   384 // Other Items were commented in a header
       
   385 // -----------------------------------------------------------------------------
       
   386 //
       
   387 void CStubSuplPosInit::InitializeECellId()
       
   388     {
       
   389     TOMASuplNwMode nwMode = iMmCellInfo.NetworkMode();
       
   390 
       
   391     if (nwMode == EOMASuplGSM)
       
   392         {
       
   393         InitializeGSMECellId();
       
   394         }
       
   395     else
       
   396         {
       
   397         InitializeWCDMAECellId();
       
   398         }
       
   399     //Initialize structure accordingly...
       
   400     }
       
   401 // -----------------------------------------------------------------------------
       
   402 // CStubSuplPosInit::InitializeGSMECellId
       
   403 // Other Items were commented in a header
       
   404 // -----------------------------------------------------------------------------
       
   405 //
       
   406 void CStubSuplPosInit::InitializeGSMECellId()
       
   407     {
       
   408     TOMASuplGSMCellinfo  omaSuplGSMCellinfo;
       
   409     iMmCellInfo.GSMCellInfo(omaSuplGSMCellinfo);
       
   410     if(KOMASuplOptionalParamNotSet != omaSuplGSMCellinfo.iTA)
       
   411         {
       
   412         if(KTAMin <= omaSuplGSMCellinfo.iTA && omaSuplGSMCellinfo.iTA <= KTAMax)
       
   413             {
       
   414             //Initialize
       
   415             }
       
   416         else
       
   417             {
       
   418             //error
       
   419             }
       
   420         }       
       
   421     else
       
   422         {
       
   423         }
       
   424 
       
   425     TOMASuplNmr Nmr;
       
   426     TInt ARFCN;
       
   427     TInt BSIC;
       
   428     TInt RxLEV;
       
   429     
       
   430     for(TInt i = 0; i < KOMASUPLMaxNmrAmount; i++)
       
   431         {
       
   432         Nmr = omaSuplGSMCellinfo.iNmr[i];
       
   433         ARFCN = Nmr.iARFCN; // 0 to 1023  
       
   434         BSIC = Nmr.iBSIC;   // 0 to 63    
       
   435         RxLEV = Nmr.iRxLEV; // 0 to 63   
       
   436 
       
   437         if(ARFCN == KOMASuplOptionalParamNotSet && BSIC == KOMASuplOptionalParamNotSet &&  RxLEV ==  KOMASuplOptionalParamNotSet ) 
       
   438             {
       
   439                 //error
       
   440                 return;
       
   441             }
       
   442 
       
   443         if(KARFCNMin <= ARFCN && ARFCN <= KARFCNMax && 
       
   444                 KBSICMin  <= BSIC  && BSIC  <= KBSICMax  &&
       
   445                 KRxLEVMin <= RxLEV && RxLEV <= KRxLEVMax)
       
   446             {
       
   447             //initialize
       
   448             }
       
   449         else
       
   450             {
       
   451 						//error
       
   452             return;
       
   453             }   
       
   454 
       
   455         }
       
   456     }
       
   457 // -----------------------------------------------------------------------------
       
   458 // CStubSuplPosInit::InitializeWCDMAECellId
       
   459 // Other Items were commented in a header
       
   460 // -----------------------------------------------------------------------------
       
   461 //
       
   462 void CStubSuplPosInit::InitializeWCDMAECellId()
       
   463     {
       
   464     TOMASuplWCDMACellinfo  omaSuplWCDMACellinfo;
       
   465     iMmCellInfo.WCDMACellInfo(omaSuplWCDMACellinfo);
       
   466     if(KOMASuplOptionalParamNotSet != omaSuplWCDMACellinfo.iPrimaryScrambilingCode) // means PrimaryScrambilingCode is filled
       
   467         {
       
   468         if(KPrimaryScrambilingCodeMin <= omaSuplWCDMACellinfo.iPrimaryScrambilingCode && omaSuplWCDMACellinfo.iPrimaryScrambilingCode <= KPrimaryScrambilingCodeMax)
       
   469             {
       
   470             //Initialize
       
   471             }
       
   472         else
       
   473             {
       
   474             //error
       
   475             }
       
   476         }       
       
   477     else
       
   478         {
       
   479         //error
       
   480         }
       
   481     
       
   482     FillFrequencyInfo(omaSuplWCDMACellinfo.iFrequencyInfo);
       
   483                 
       
   484     FillMeasuredResultsList(omaSuplWCDMACellinfo.iNwkMeasureReport);   
       
   485     }
       
   486 
       
   487 TInt CStubSuplPosInit::FillFrequencyInfo(TOMASuplFrequencyInfo& aOMASuplFrequencyInfo)
       
   488     {
       
   489     TInt    FddUL = aOMASuplFrequencyInfo.iFddUL;       // 0..16383     In case of fdd( iFddUL, iFddDL),
       
   490     TInt    FddDL = aOMASuplFrequencyInfo.iFddDL;       // 0..16383     iFddUL is optional while iFddDL is mandatory. 
       
   491     TInt    TddDt = aOMASuplFrequencyInfo.iTddNt;       // 0..16383     
       
   492 
       
   493     TInt retError = KErrNone;   
       
   494 
       
   495     if(FddDL != KOMASuplOptionalParamNotSet ) //means FddDL is provided...
       
   496     {
       
   497     if(KFddDLMin <= FddDL && FddDL <= KFddDLMax)
       
   498         {
       
   499         //Initialize here..
       
   500         }
       
   501     else
       
   502         {
       
   503         //error
       
   504         }
       
   505     }
       
   506     else
       
   507         {
       
   508             //error
       
   509         }
       
   510 
       
   511     FillFrequencyInfoULInfo(FddUL,retError);
       
   512 
       
   513     FillFrequencyInfoDT(TddDt,retError);
       
   514 
       
   515     return 0;
       
   516     }
       
   517 
       
   518 void CStubSuplPosInit::FillFrequencyInfoULInfo(TInt aFddUL,TInt& aRetErrorCode)
       
   519     {
       
   520     if(aFddUL != KOMASuplOptionalParamNotSet && aRetErrorCode == KErrNone )
       
   521         {
       
   522         if(KFddULMin <= aFddUL && aFddUL <= KFddULMax)
       
   523             {
       
   524             //set to message
       
   525               aRetErrorCode = KErrNone;
       
   526             }
       
   527         else
       
   528             {     
       
   529             //error   
       
   530             }
       
   531         }                                                                       
       
   532     }
       
   533 
       
   534 void CStubSuplPosInit::FillFrequencyInfoDT(TInt aTddDt,TInt& aRetErrorCode)
       
   535     {
       
   536     if(aTddDt != KOMASuplOptionalParamNotSet ) //means TddDt is provided...
       
   537         {
       
   538         if(KTddDtMin <= aTddDt && aTddDt <= KTddDtMax)
       
   539             {
       
   540             //Initialize
       
   541             }
       
   542         else
       
   543             {
       
   544             //error
       
   545             }
       
   546         }
       
   547     else
       
   548         {
       
   549          //error
       
   550         }
       
   551     aRetErrorCode = KErrNone;
       
   552     }
       
   553 
       
   554 TInt CStubSuplPosInit::FillMeasuredResultsList(TOMASuplNetworkMeasureReport aNwkMeasureReport[])
       
   555     {
       
   556     
       
   557     
       
   558     for(TInt i = 0; i < KOMASUPLMaxNetworkMeasureReports; i++ )
       
   559         {
       
   560         TOMASuplNetworkMeasureReport NwkMeasureReport = aNwkMeasureReport[i];
       
   561         TInt err = FillFrequencyInfo(NwkMeasureReport.iFrequencyInfo);                
       
   562 
       
   563         if(KOMASuplOptionalParamNotSet != NwkMeasureReport.iCarrierRSSI) // means iCarrierRSSI is filled
       
   564             {
       
   565             if(KCarrierRSSIMin <= NwkMeasureReport.iCarrierRSSI && NwkMeasureReport.iCarrierRSSI <= KCarrierRSSIMax)
       
   566                 {  
       
   567                 //initialize
       
   568                 }
       
   569             else
       
   570                 {
       
   571                 //error
       
   572                 }
       
   573             }       
       
   574 
       
   575         err = FillCellMeasuredResult(NwkMeasureReport.iCellMeasuredResult);               
       
   576         }
       
   577     return 0;
       
   578     }
       
   579 
       
   580 TInt CStubSuplPosInit::FillCellMeasuredResult(TOMASuplCellMeasuredResult aCellMeasuredResult[])
       
   581     {
       
   582     
       
   583     TInt eleCount = 0;
       
   584     for(TInt i = 0; i < KOMASUPLMaxCellMeasuredResults; i++ )
       
   585         {
       
   586         TOMASuplCellMeasuredResult  CellMeasuredResult = aCellMeasuredResult[i];
       
   587         TInt err = FillModeSpecificInfo(CellMeasuredResult);
       
   588         if( err == KErrNone)
       
   589             {
       
   590             //Initialize
       
   591 
       
   592             if(CellMeasuredResult.iCID != KOMASuplOptionalParamNotSet) // CID is present
       
   593                 {
       
   594                 if(KCIDMin <= CellMeasuredResult.iCID && CellMeasuredResult.iCID <= KCIDMax)
       
   595                     {
       
   596                     //Set to message                                
       
   597                     }
       
   598                 else
       
   599                     {
       
   600                        //error
       
   601                     }
       
   602                 }
       
   603             else
       
   604                 {
       
   605                     //error
       
   606                 }
       
   607             eleCount++;
       
   608             }           
       
   609         }
       
   610 
       
   611 
       
   612     if(eleCount != 0 )
       
   613         return KErrNone;
       
   614     else
       
   615         return KErrArgument; 
       
   616     }
       
   617 
       
   618 TInt CStubSuplPosInit::FillModeSpecificInfo(TOMASuplCellMeasuredResult&  aCellMeasuredResult)
       
   619     {
       
   620 
       
   621     TOMASuplFddInfo     FddInfo = aCellMeasuredResult.iFddInfo;
       
   622     TOMASuplTddInfo     TddInfo = aCellMeasuredResult.iTddInfo;
       
   623 
       
   624     if(FddInfo.iPrimaryCPICH != KOMASuplOptionalParamNotSet) // iPrimaryCPICH is present
       
   625         {
       
   626 
       
   627         //////////////////////////////////////////////////////////////////////////////////////////////////////////////////              
       
   628         if(KPrimaryCPICHMin <= FddInfo.iPrimaryCPICH && FddInfo.iPrimaryCPICH <= KPrimaryCPICHMax)
       
   629             {
       
   630             //Set to message   
       
   631             //initialize
       
   632             }
       
   633         else
       
   634             {
       
   635                //error
       
   636             }
       
   637         //////////////////////////////////////////////////////////////////////////////////////////////////////////////////                                                  
       
   638 
       
   639         if(FddInfo.iCpichEcN0 != KOMASuplOptionalParamNotSet) // iCpichEcN0 is present
       
   640             {
       
   641             if(KCpichEcN0Min <= FddInfo.iCpichEcN0 && FddInfo.iCpichEcN0 <= KCpichEcN0Max)
       
   642                 {
       
   643                 //Set to message                                
       
   644                 }
       
   645             else
       
   646                 {
       
   647                     //error
       
   648                 }
       
   649             }       
       
   650         //////////////////////////////////////////////////////////////////////////////////////////////////////////////////                                                                              
       
   651 
       
   652         if(FddInfo.iCichRscp != KOMASuplOptionalParamNotSet) // iCichRscp is present
       
   653             {
       
   654             if(KCichRscpMin <= FddInfo.iCichRscp && FddInfo.iCichRscp <= KCichRscpMax)
       
   655                 {
       
   656                 //Set to message                                
       
   657                 }
       
   658             else
       
   659                 {
       
   660                     //error
       
   661                 }
       
   662             }       
       
   663         //////////////////////////////////////////////////////////////////////////////////////////////////////////////////                                                  
       
   664 
       
   665         if(FddInfo.iPathloss != KOMASuplOptionalParamNotSet) // iPathloss is present
       
   666             {
       
   667             if(KPathlossMin <= FddInfo.iPathloss && FddInfo.iPathloss <= KPathlossMax)
       
   668                 {
       
   669                 //Set to message                                
       
   670                 }
       
   671             else
       
   672                 {
       
   673                     //error
       
   674                 }
       
   675             }       
       
   676         //////////////////////////////////////////////////////////////////////////////////////////////////////////////////                                                  
       
   677         return KErrNone;            
       
   678         }
       
   679     else
       
   680         {
       
   681             //error
       
   682         }
       
   683 
       
   684     if(TddInfo.iCellParamID != KOMASuplOptionalParamNotSet) // iCellParamID is present
       
   685         {
       
   686         //////////////////////////////////////////////////////////////////////////////////////////////////////////////////                                                 
       
   687         if(KCellParamIDMin <= TddInfo.iCellParamID && TddInfo.iCellParamID <= KCellParamIDMax)
       
   688             {
       
   689             //Set to message
       
   690             }
       
   691         else
       
   692             {
       
   693                 //error
       
   694             }
       
   695         //////////////////////////////////////////////////////////////////////////////////////////////////////////////////                                                                                         
       
   696 
       
   697         if(TddInfo.iProposedTGSN != KOMASuplOptionalParamNotSet) // iProposedTGSN is present
       
   698             {
       
   699             if(KProposedTGSNMin <= TddInfo.iProposedTGSN && TddInfo.iProposedTGSN <= KProposedTGSNMax)
       
   700                 {
       
   701                 //Set to message    
       
   702                 }
       
   703             else
       
   704                 {
       
   705                     //error
       
   706                 }
       
   707             }       
       
   708 
       
   709         //////////////////////////////////////////////////////////////////////////////////////////////////////////////////                                                                                         
       
   710 
       
   711         if(TddInfo.iPrimaryCcpchRscp != KOMASuplOptionalParamNotSet) // iPrimaryCcpchRscp is present
       
   712             {
       
   713             if(KPrimaryCcpchRscpMin <= TddInfo.iPrimaryCcpchRscp && TddInfo.iPrimaryCcpchRscp <= KPrimaryCcpchRscpMax)
       
   714                 {
       
   715                 //Set to message           
       
   716                 }
       
   717             else
       
   718                 {
       
   719                     //error
       
   720                 }
       
   721             }       
       
   722 
       
   723         //////////////////////////////////////////////////////////////////////////////////////////////////////////////////                                                                                         
       
   724 
       
   725         if(TddInfo.iPathloss != KOMASuplOptionalParamNotSet) // iPathloss is present
       
   726             {
       
   727             if(KPathlossMin <= TddInfo.iPathloss && TddInfo.iPathloss <= KPathlossMax)
       
   728                 {
       
   729                 //Set to message                                
       
   730                 }
       
   731             else
       
   732                 {
       
   733                    //error
       
   734                 }
       
   735             }       
       
   736         //////////////////////////////////////////////////////////////////////////////////////////////////////////////////                                                  
       
   737         TInt eleCount = 0; 
       
   738         for(TInt i = 0; i < KOMASUPLMaxTimeSlotIscpAmount; i++)
       
   739             {
       
   740             if(TddInfo.iTimeslotISCP[i] != KOMASuplOptionalParamNotSet && KTimeslotISCPMin <= TddInfo.iTimeslotISCP[i] && TddInfo.iTimeslotISCP[i] <= KTimeslotISCPMax)
       
   741                 {
       
   742                 //Set to message                                
       
   743                 //Set to message that its not optional
       
   744                 eleCount++;
       
   745                 }
       
   746             else
       
   747                 {
       
   748                     //error
       
   749                 }
       
   750 
       
   751             }
       
   752         //////////////////////////////////////////////////////////////////////////////////////////////////////////////////                                                  
       
   753         //       
       
   754         return KErrNone;
       
   755         }
       
   756     else
       
   757         {
       
   758             //error
       
   759         }
       
   760     return 0;
       
   761     }
       
   762 
       
   763 void CStubSuplPosInit::InitializePositionEstimate(TOMASuplPositionEstimate& aPosEstimate)
       
   764     {
       
   765     TInt error;
       
   766 
       
   767     // Retrieve mandatory parametrs of Position Estimate
       
   768     TOMASuplPositionEstimate::TOMASuplLatitudeSign  latSign;
       
   769     TInt               latitude;
       
   770     TInt               longitude;
       
   771     aPosEstimate.GetPositionEstimate(latSign,latitude,longitude);   
       
   772 
       
   773     // Set Position Estimate
       
   774     if(KLatitudeMin <= latitude && latitude <= KLatitudeMax)
       
   775         {
       
   776         //Initialize
       
   777         }
       
   778     else
       
   779         {
       
   780         //error
       
   781         }
       
   782 
       
   783     if(KLongitudeMin <= longitude && longitude <= KLongitudeMax)
       
   784         {
       
   785         //Initialize
       
   786         }
       
   787     else
       
   788         {
       
   789         //error
       
   790         }
       
   791 
       
   792     //Initialize
       
   793 
       
   794     // Retrieve optional parametrs of Position Estimate
       
   795     // Retrieve Uncertainity
       
   796     TOMASuplUncertainty uncertainty;
       
   797     error = aPosEstimate.GetUncertainty(uncertainty);
       
   798     if(!error)
       
   799         {    
       
   800         TInt uncertSemiMajor;
       
   801         TInt uncertSemiMinor;
       
   802         TInt orientMajorAxis;
       
   803         uncertainty.GetUncertainty(uncertSemiMajor,uncertSemiMinor,orientMajorAxis);
       
   804         if((KUncertSemiMajorMin <= uncertSemiMajor && uncertSemiMajor<= KUncertSemiMajorMax)
       
   805                 && (KUncertSemiMinorMin <= uncertSemiMinor && uncertSemiMinor<= KUncertSemiMinorMax)
       
   806                 && (KOrientMajorAxisMin <= orientMajorAxis && orientMajorAxis<= KOrientMajorAxisMax))
       
   807             {
       
   808             //Initialize
       
   809             }
       
   810         else
       
   811             {
       
   812             //error
       
   813             }
       
   814         }
       
   815     else
       
   816         {
       
   817         //return error
       
   818         }
       
   819 
       
   820     // Retrieve Confidence
       
   821     TInt confidence;
       
   822     error = aPosEstimate.GetConfidence(confidence);
       
   823     if(!error)
       
   824         {
       
   825 
       
   826         if(KConfidenceMin <= confidence && confidence <= KConfidenceMax)
       
   827             {
       
   828             //Initialize       
       
   829             }
       
   830         else
       
   831             {
       
   832             //error 
       
   833             }
       
   834         }
       
   835     else
       
   836         {
       
   837         //return error
       
   838         }
       
   839 
       
   840     // Retrieve AltitudeInfo
       
   841     TOMASuplAltitudeInfo altitudeInfo;
       
   842     error = aPosEstimate.GetAltitudeInfo(altitudeInfo);
       
   843     if(!error)
       
   844         {
       
   845 
       
   846         TOMASuplAltitudeInfo::TOMASuplAltitudeDirection altDirection;
       
   847         TInt altitude;
       
   848         TInt altUncert;
       
   849         altitudeInfo.GetAltitudeInfo(altDirection,altitude,altUncert);
       
   850         if((KAltitudeMin <= altitude && altitude<= KAltitudeMax) && (KAltitudeUncertMin <= altUncert && altUncert<= KAltitudeUncertMax))
       
   851             {
       
   852             //Initialize
       
   853             }
       
   854         else
       
   855             {
       
   856             //error
       
   857             }
       
   858         }
       
   859     else
       
   860         {
       
   861         //return error
       
   862         }
       
   863     }
       
   864 
       
   865 void CStubSuplPosInit::InitializeTime(const TOMASuplUtcTime aUtcTime)
       
   866     {
       
   867     
       
   868     TDateTime lDateTime;
       
   869     TInt      zoneCode;
       
   870     TInt      zone;
       
   871     
       
   872     aUtcTime.GetUtcTime(lDateTime,zoneCode,zone);
       
   873     
       
   874     TInt   year     = lDateTime.Year();
       
   875     TMonth month    = lDateTime.Month(); 
       
   876     TInt   day      = lDateTime.Day();
       
   877     TInt   hour     = lDateTime.Hour();
       
   878     TInt   minute   = lDateTime.Minute();
       
   879     TInt   second   = lDateTime.Second();
       
   880     TInt   microsec = lDateTime.MicroSecond();
       
   881     
       
   882     if(0 == zoneCode || 1 == zoneCode)
       
   883         {
       
   884         //Initialize 
       
   885         }
       
   886     else
       
   887         {
       
   888         //error
       
   889         }
       
   890     
       
   891     
       
   892     }