--- a/locationdataharvester/mylocationsengine/inc/mylocationsengine.h Fri Jun 11 16:23:56 2010 +0100
+++ b/locationdataharvester/mylocationsengine/inc/mylocationsengine.h Thu Jul 22 16:31:43 2010 +0100
@@ -20,7 +20,6 @@
#define __MYLOCATIONSENGINE_H__
// INCLUDES
-
// calendar related headers
#include <calsession.h>
#include <calentryview.h>
@@ -28,6 +27,10 @@
// Header for contact DB
#include <cntdb.h>
+//Qt contacts mobility apis
+#include <qtcontacts.h>
+#include <qcontactmanager.h>
+
// Header for landmarks db
#include<EPos_CPosLandmarkDatabase.h>
@@ -35,8 +38,12 @@
#include "maptileinterface.h"
#include "mylocationsdatabasemanager.h"
#include "lookupmaptiledb.h"
-#include "addresscomparision.h"
#include "calendernotification.h"
+#include "mylocationgeotagtimerao.h"
+class GeocodeUpdate;
+class CContactSubscriber;
+class CCalendarSubscriber;
+using namespace QTM_NAMESPACE;
/**
* This class contains the required data for maptile image processing.
@@ -55,7 +62,7 @@
CPosLandmark* iLandmarkInfo;
//single row address.
HBufC* iAddressDetails;
- //Contact id
+ //entry id
TInt32 iUId;
//Address type
TInt32 iAddressType;
@@ -65,6 +72,18 @@
TInt iEventType;
};
+/**
+ * This class stores the information required for maptile
+ * processing when it is triggered from the application(contact)
+ * viewer.
+ */
+class TAppAddressInfo
+{
+public:
+ TInt iUid;
+ TInt iAddressType;
+};
+
// CLASS DECLARATION
/** Class used to listen on various database change events from applications like calendar,
* contacts, landmarks
@@ -74,7 +93,8 @@
* This process starts on phone bootup and always runs in the background.
*/
class CMyLocationsEngine : public CActive, public MCalChangeCallBack2,
- public MContactDbObserver, public MMapTileObserver,public MNotifyChange
+ public MContactDbObserver, public MMapTileObserver,public MNotifyChange,
+ public MyLocationTimerObserver
{
@@ -130,8 +150,11 @@
*/
TEntryChangeType MapChangeType( TUidSourceType aSrcType, TUint32 aChangeType );
-
+#ifdef MYLOCATIONENGINE_UNIT_TEST
+public:
+#else
private:
+#endif
/**
* ConstructL.
@@ -146,30 +169,11 @@
CMyLocationsEngine();
/** Creates a landmark object from contact item's location details and checks whether address available.
- * @param[in] aContactItem A contact item whose location details needs to be used to create landmark object.
- * @param[in] aAddressType Mentions the address type ( prefered/work/home ) of the contact item to be used.
- * @returns A valid landmark object if location in the contact item is validated, NULL otherwise.
+ * @param[in] aContactAddress A contact address whose location details needs to be used to create landmark object.
+ * @returns A valid landmark object if location in the contact item is validated, NULL otherwise.
*/
- CPosLandmark* GetContactAddressDetailsLC( const CContactItem *aContactItem,
- TContactAddressType aAddressType );
+ CPosLandmark* GetContactAddressDetailsLC( QContactAddress& aContactAddress );
- /** Creates a landmark object from contact item's location details
- * @param[in] aContactItem A contact item whose location details needs to be used to create landmark object.
- * @param[in] aAddressType Mentions the address type ( prefered/work/home ) of the contact item to be used.
- * @returns A valid landmark object if location in the contact item is validated, NULL otherwise.
- */
- CPosLandmark* GetContactLocationDetailsLC( const CContactItem *aContactItem,
- TContactAddressType aAddressType );
-
- /** Finds the contact's field type id
- * @param[in] aContactItem A contact item whose field details needs to found.
- * @param[in] aAddressType Mentions the address type ( prefered/work/home ) of the contact item to be used.
- * @param[in] aField The field type of interest.
- * @return If found, the index of the field within the field set, or KErrNotFound if not found.
- */
- TInt FindContactsField( const CContactItem *aContactItem, TContactAddressType aAddressType,
- TUid aField );
-
/**
* A call back function for calendar change notification
* @param aChangeItems List of changes since the last notification.
@@ -189,18 +193,13 @@
void TriggerMaptileRequestL( TContactDbObserverEvent& aEvent );
/**
- * Process the contact database event and updates the landmark database
- * @param aEvent Provides information about the change event.
- */
- void HandlelandmarkDatabaseL( TContactDbObserverEvent& aEvent );
- /**
* Process the maptile database event and updates the maptile database
* @param aEventType Provides information about the type of request address.
* @param aLookupItem Provides information about single address of contact.
*/
- void HandleMaptileDatabaseL(TInt aEventType ,
+ void UpdateMaptileDatabaseL(TInt aEventType ,
TLookupItem& aLookupItem );
-
+
/**
* Handles active object's request completion event.
*/
@@ -211,6 +210,7 @@
*/
void DoCancel();
+
/**
* Requests for map tile image , structure serch.
* @param aLandmark Provides information about the address.
@@ -218,7 +218,7 @@
* @param aUId, uid of the event.
*/
void RequestMapTileImageL( CPosLandmark& aLandmark, const TUidSourceType aAddressType,
- const TInt32 aUId );
+ const TInt32 aUId, const TInt aEventType );
/**
* Requests for map tile image , one box serch.
@@ -227,7 +227,18 @@
* @param aUId, uid of the event.
*/
void RequestMapTileImageL(const TDesC& aAddressDetails,
- const TUidSourceType aAddressType, const TInt32 aUId);
+ const TUidSourceType aAddressType, const TInt32 aUId,const TInt aEventType);
+
+ /**
+ * Checks whether contact has a valid geocoordinates.
+ * @param aContact Provides all the required information about the contact.
+ * @param aAddressType Provides information about address type .
+ * @param aLatitude, Latitude information.
+ * @param aLongitude, Longitude information.
+ * @return If geocoordinate available returns TRUE otherwise FALSE
+ */
+ TBool IsGeoCoordinateAvailable( QContact& aContact,
+ QString aAddressType, double& aLatitude , double& aLongitude );
/**
* Add to maptile request queue.
@@ -246,12 +257,41 @@
void CalenderEntryAddedL(TCalChangeEntry aCalChangeEntry);
/**
+ * Calender entry modifyied.
+ */
+ void CalenderEntryModifyL(TCalChangeEntry aCalChangeEntry);
+ /**
* Update the mylocations database.
*/
void UpdateDatabaseL( CPosLandmark* aLandmark, const TUint32 aUid,
const TUint32 aSourceType, const TEntryChangeType aChangeType );
-
-
+
+ /**
+ * Informs the geocode completion
+ */
+ void UpdateGeoCodeToAppDataBase( TReal latitude,TReal longitude );
+
+ /**
+ * Process the pending maptile requests
+ */
+ void ProcessNextMaptileRequest();
+
+ /**
+ * maptile database manipulation.
+ */
+ void ManipulateMapTileDataBaseL(TLookupItem& aLookupItem);
+
+ /**
+ * Crop and create multiple maptile images for different applications requirements.
+ */
+ void CreateMultipleMaptiles( const TDesC& aMaptilePath );
+
+ /**
+ * Crop the maptile image and save the different files.
+ */
+ void CropAndSaveImage( QString filePath, int width,
+ int height, QString appType, QString orientationType );
+
public: //From MMapTileObserver
/**
@@ -259,15 +299,28 @@
*/
void MapTilefetchingCompleted( TInt aErrCode,const TDesC& aMapTilePath );
- /**
- * Informs the geocode completion
+ /**
+ * Informs the geo codes fetching completion
*/
- void RestGeoCodeCompleted( TReal latitude,TReal longitude);
-
+ void GeoCodefetchingCompleted( TInt aErrCode, const TReal& aLatitude,
+ const TReal& aLongitude, const TDesC& aMapTilePath );
public://from MNotifychange
void NotifyChangeL(TInt &aStatus);
+ void GetChangeNotificationL(TInt &aId, TInt &addressType, TInt &addressCount );
+ void SubscribeFromCalendarL(TInt aId);
+
+public: //from MyLocationTimerObserver
+ /**
+ * Notifies the timer expiry when 3AM timer was started to notify.
+ */
+ void MyLocationThreeAMTimerExpiredL();
+
+#ifdef MYLOCATIONENGINE_UNIT_TEST
+public:
+#else
private:
+#endif
// Data member
@@ -301,20 +354,42 @@
//Current event type
TInt iEventType;
- //Address comparison pointer
- CAddressComparision *iAddressCompare;
-
//Maptile image request queue
RArray<CMapTileRequest*> iMapTileRequestQueue;
+ // 3am Timer
+ CLocationGeoTagTimerAO *iMyLocationThreeAMTimer;
+
//Flag to check maptilegeocoder plugin availability
TBool iMaptileGeocoderPluginAvailable;
//Maptile image path
TFileName imageFilePath;
+
//Object to listen calender db create notification.
CCalenderNotification *iCalenderNotification;
+ //Contact manager instance for retrieving contact info.
+ QContactManager* iContactManager;
+
+ //Subscribe from contact
+ CContactSubscriber *iContactSubscriber;
+
+ //Subscribe from calendar
+ CCalendarSubscriber *iCalendarSubscriber;
+
+ //Geo-code class instance
+ GeocodeUpdate *iGeocodeUpdate;
+
+ //Last viewed contact id
+ TInt iLastContactId;
+
+ //Last viewed calendar id
+ TInt iLastCalendarId;
+
+ //Address information for viewver maptile processing.
+ RArray<TAppAddressInfo*> iAddressInfo;
+
};
#endif // __MYLOCATIONSENGINE_H__