locationmanager/locationtrail/src/clocationrecord.cpp
changeset 51 87e65c44ff3a
parent 48 1389872e7c51
child 60 79f826a55db2
equal deleted inserted replaced
48:1389872e7c51 51:87e65c44ff3a
    30 #include "cnetworkinfo.h"
    30 #include "cnetworkinfo.h"
    31 #include "locationmanagerdebug.h"
    31 #include "locationmanagerdebug.h"
    32 #include "locationtraildefs.h"
    32 #include "locationtraildefs.h"
    33 #include "locationtrailpskeys.h"
    33 #include "locationtrailpskeys.h"
    34 #include "mdeconstants.h"
    34 #include "mdeconstants.h"
    35 #ifdef LOC_REVERSEGEOCODE
    35 
    36 #include "reversegeocoderplugin.h"
       
    37 const TUid KReverseGeoCodeUid = {0x2002DD12}; 
       
    38 #endif	
       
    39 
    36 
    40 
    37 
    41 using namespace MdeConstants;
    38 using namespace MdeConstants;
    42 
    39 
    43 const TUint KNetQueryBit = 1; // 1 bit
    40 const TUint KNetQueryBit = 1; // 1 bit
   134     iNetworkInfoTimer = CPeriodic::NewL( CActive::EPriorityStandard );
   131     iNetworkInfoTimer = CPeriodic::NewL( CActive::EPriorityStandard );
   135 
   132 
   136 #ifdef LOC_REVERSEGEOCODE
   133 #ifdef LOC_REVERSEGEOCODE
   137     iTagCreator = CTagCreator::NewL();
   134     iTagCreator = CTagCreator::NewL();
   138 
   135 
   139     iRevGeocoderPlugin = reinterpret_cast<CReverseGeoCoderPlugin*>(
   136 	  TInt pluginerr = KErrNone;
   140           REComSession::CreateImplementationL(KReverseGeoCodeUid,iDtorKey));
   137     TRAP(pluginerr,iRevGeocoderPlugin = CReverseGeoCoderPlugin::NewL());
   141      if( iRevGeocoderPlugin )
   138     		
   142 	 	{
   139    if(pluginerr == KErrNone)
   143      	iRevGeocoderPlugin->AddObserverL(*this);
   140    	{
       
   141 		iRevGeocoderPlugin->AddObserverL(*this);
   144 	 	}
   142 	 	}
   145 
       
   146 
       
   147  
       
   148  #endif
   143  #endif
   149 
   144 
   150 	
   145 	
   151     TInt interval( 0 );
   146     TInt interval( 0 );
   152     TRAP(err, ReadCenRepValueL(KIntervalKey, interval));
   147     TRAP(err, ReadCenRepValueL(KIntervalKey, interval));
   255 		}	
   250 		}	
   256 	delete iTagCreator;
   251 	delete iTagCreator;
   257 	// set the pointer to NULL, ECOM will destroy object.
   252 	// set the pointer to NULL, ECOM will destroy object.
   258     delete iRevGeocoderPlugin;
   253     delete iRevGeocoderPlugin;
   259     iRevGeocoderPlugin = NULL;
   254     iRevGeocoderPlugin = NULL;
   260     REComSession::DestroyedImplementation(iDtorKey);
       
   261 #endif
   255 #endif
   262     LOG( "CLocationRecord::~CLocationRecord(), end" );	
   256     LOG( "CLocationRecord::~CLocationRecord(), end" );	
   263     }
   257     }
   264 
   258 
   265 // --------------------------------------------------------------------------
   259 // --------------------------------------------------------------------------
  1114                             newItem = NULL;
  1108                             newItem = NULL;
  1115                             }           
  1109                             }           
  1116                         delete firstPtr;            
  1110                         delete firstPtr;            
  1117                         firstPtr = NULL;
  1111                         firstPtr = NULL;
  1118 					    }
  1112 					    }
       
  1113 					//check newItem for validity
  1119 					else if (newItem)
  1114 					else if (newItem)
  1120 					    {
  1115 					    {
  1121 					    // country tag not found.. go for reverse geocoding..
  1116 					    // country tag not found.. go for reverse geocoding..
  1122 					    newItem->iLocationId = lastLocationId;
  1117 					    newItem->iLocationId = lastLocationId;
  1123 					    iLocationItems.Append( newItem );
  1118 					    iLocationItems.Append( newItem );
  1818         {
  1813         {
  1819         CMdEItem& item = aQuery.ResultItem(0);
  1814         CMdEItem& item = aQuery.ResultItem(0);
  1820         CMdEObject& locationObject = static_cast<CMdEObject&>(item);
  1815         CMdEObject& locationObject = static_cast<CMdEObject&>(item);
  1821         locationId = locationObject.Id();
  1816         locationId = locationObject.Id();
  1822         
  1817         
       
  1818         iMediaItems[0]->iLocationId = locationId;
  1823         TRAP( error, CreateRelationL( iMediaItems[0]->iObjectId, locationId ) );
  1819         TRAP( error, CreateRelationL( iMediaItems[0]->iObjectId, locationId ) );
  1824 #ifdef LOC_REVERSEGEOCODE
  1820 #ifdef LOC_REVERSEGEOCODE
  1825         //check if found location object has lat, long
  1821         //check if found location object has lat, long
  1826         CMdEProperty* latProp = NULL;
  1822         CMdEProperty* latProp = NULL;
  1827         CMdEProperty* lonProp = NULL; 
  1823         CMdEProperty* lonProp = NULL;