omasuplasnconverterstubimpl/src/cstubsuplpos.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: SuplPos
       
    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 "epos_comasuplpos.h"
       
    25 #include "cstubsuplpos.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 // CStubSuplPos::NewL
       
    37 // Other Items were commented in a header
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 EXPORT_C CStubSuplPos* CStubSuplPos::NewL()
       
    41     {
       
    42     CStubSuplPos* self = new (ELeave) CStubSuplPos;
       
    43     CleanupStack::PushL(self);
       
    44     self->ConstructL();
       
    45     CleanupStack::Pop();
       
    46     return self;
       
    47     }
       
    48 // -----------------------------------------------------------------------------
       
    49 // CStubSuplPos::~CStubSuplPos
       
    50 // Other Items were commented in a header
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 EXPORT_C CStubSuplPos::~CStubSuplPos()
       
    54     {
       
    55 
       
    56     }
       
    57 // -----------------------------------------------------------------------------
       
    58 // CStubSuplPos::ConstructL
       
    59 // Other Items were commented in a header
       
    60 // -----------------------------------------------------------------------------
       
    61 //
       
    62 void CStubSuplPos::ConstructL()
       
    63     {
       
    64     COMASuplPos::ConstructL();
       
    65     //Allocate memory for internal usage....
       
    66     }
       
    67 // -----------------------------------------------------------------------------
       
    68 // CStubSuplPos::EncodeL
       
    69 // Other Items were commented in a header
       
    70 // -----------------------------------------------------------------------------
       
    71 //
       
    72 HBufC8* CStubSuplPos::EncodeL(TInt& aErrorCode)
       
    73     {
       
    74     aErrorCode = 0;
       
    75     HBufC8* encodedBuffer = NULL;
       
    76     InitializeL();
       
    77     // Do actual encoding here and return encoded buffer and put appropriate error code in aErrorCode
       
    78     return encodedBuffer;
       
    79     }
       
    80 // -----------------------------------------------------------------------------
       
    81 // CStubSuplPos::CStubSuplPos
       
    82 // Other Items were commented in a header
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 CStubSuplPos::CStubSuplPos()
       
    86     {
       
    87     }
       
    88 void CStubSuplPos::InitializeL()
       
    89     {
       
    90     //Initialize your library
       
    91 
       
    92     if(iPayload)
       
    93         {
       
    94         HBufC8* payloadData = NULL;
       
    95         COMASuplPosPayload::TOMASuplPosPayloadType payloadType;
       
    96         iPayload->GetPosPayload(payloadData,payloadType);
       
    97 
       
    98         if(!payloadData)  
       
    99             {
       
   100             //error   
       
   101             }           
       
   102 
       
   103         TPtr8 ptr = payloadData->Des();
       
   104 
       
   105         TInt len = payloadData->Length();
       
   106 
       
   107         const char* lTemp = (const char *)ptr.Ptr();
       
   108 
       
   109         switch(payloadType)
       
   110             {
       
   111             case COMASuplPosPayload::ETIA801:
       
   112                 {
       
   113                 //initialize pospayload for TIA                              
       
   114                 break;
       
   115                 }   
       
   116             case COMASuplPosPayload::ERRC:
       
   117                 {
       
   118                 //initialize pospayload for RRC
       
   119                 break;                      
       
   120                 }
       
   121             case COMASuplPosPayload::ERRLP:
       
   122                 {
       
   123                 //initialize pospayload for RRLP
       
   124                 break;                      
       
   125                 }
       
   126             default:
       
   127                 {
       
   128 
       
   129                 }           
       
   130             }
       
   131 
       
   132         }
       
   133     else
       
   134         {   
       
   135         //error
       
   136 
       
   137         }
       
   138 
       
   139     if(iOptionalMask & (1<<(0))) //means velocity has been set
       
   140         {
       
   141         TOMASuplVelocityType velocityType = iVelocity->VelType();
       
   142         COMASuplHorizVelocity* horizVelocity = iVelocity->Velocity();
       
   143         if(horizVelocity)
       
   144             {
       
   145             switch(velocityType)
       
   146                 {
       
   147                 case EHorizVelocity:
       
   148                     {
       
   149                     //Initialize
       
   150                     IntializeHorizVelocity(horizVelocity);
       
   151                     break;      
       
   152                     }
       
   153                 case EHorizAndVertVelocity:
       
   154                     {
       
   155                     //Initialize
       
   156                     IntializeHorizAndVertVelocity(horizVelocity);
       
   157                     break;
       
   158                     }
       
   159                 case EHorizUncertVelocity:
       
   160                     {
       
   161                     //Initialize
       
   162                     IntializeHorizUncertVelocity(horizVelocity);
       
   163                     break;
       
   164                     }
       
   165                 case EHorizAndVertUncertVelocity:
       
   166                     {
       
   167                     //Initialize
       
   168                     IntializeHorizVertUncertVelocity(horizVelocity);
       
   169                     break;  
       
   170                     }
       
   171                 default:
       
   172                     {
       
   173                     //error
       
   174 
       
   175                     }
       
   176                 }       
       
   177             }
       
   178         else
       
   179             {
       
   180             //error
       
   181 
       
   182             }
       
   183         }
       
   184     else
       
   185         {
       
   186         //return error
       
   187         }
       
   188 
       
   189 
       
   190     }
       
   191 void CStubSuplPos::IntializeHorizVelocity(const COMASuplHorizVelocity* aVelocity)
       
   192     {
       
   193     TUint16 bearing;
       
   194     TUint16 horSpeed;
       
   195 
       
   196     aVelocity->GetHorizVel(bearing,horSpeed);
       
   197 
       
   198     //Initialize bearing,horSpeed
       
   199     }
       
   200 
       
   201 void CStubSuplPos::IntializeHorizAndVertVelocity(const COMASuplHorizVelocity* aVelocity)
       
   202     {
       
   203     TUint16 bearing;
       
   204     TUint16 horSpeed;
       
   205     TUint8 verDirect;
       
   206     TUint8 verSpeed;
       
   207 
       
   208     COMASuplHorizAndVertVelocity* horizVertVel = (COMASuplHorizAndVertVelocity*)aVelocity;
       
   209 
       
   210     horizVertVel->GetHorizAndVertVel(bearing,horSpeed,verDirect,verSpeed);
       
   211 
       
   212     //Initialize bearing,horSpeed,verDirect,verSpeed
       
   213     }
       
   214 
       
   215 void CStubSuplPos::IntializeHorizUncertVelocity(const COMASuplHorizVelocity* aVelocity)
       
   216     {
       
   217     TUint16 bearing;
       
   218     TUint16 horSpeed;
       
   219     TUint8 uncertSpeed;
       
   220 
       
   221     COMASuplHorizUncertVelocity* horizUncertVel = (COMASuplHorizUncertVelocity*)aVelocity;
       
   222 
       
   223     horizUncertVel->GetHorizUncertVel(bearing,horSpeed,uncertSpeed);
       
   224     //Initialize bearing,horSpeed,uncertSpeed
       
   225     }
       
   226 
       
   227 void CStubSuplPos::IntializeHorizVertUncertVelocity(const COMASuplHorizVelocity* aVelocity)
       
   228     {
       
   229     TUint16 bearing;
       
   230     TUint16 horSpeed;
       
   231     TUint8  verDirect;
       
   232     TUint8  verSpeed;
       
   233     TUint8  horizUncertSpeed;
       
   234     TUint8  vertUncertSpeed;
       
   235 
       
   236     COMASuplHorizAndVertUncertVelocity* horizVertUncertVel = (COMASuplHorizAndVertUncertVelocity*)aVelocity;
       
   237 
       
   238     horizVertUncertVel->GetHorizVertUncertVel(bearing,horSpeed,verDirect,verSpeed,
       
   239             horizUncertSpeed,vertUncertSpeed);
       
   240     //Initialize bearing,horSpeed,verDirect,verSpeed,horizUncertSpeed,vertUncertSpeed
       
   241     }