locationdataharvester/maptileservice/inc/maptileservice.h
changeset 30 96df3ab41000
parent 17 0f22fb80ebba
child 31 8db05346071b
equal deleted inserted replaced
26:f3533f6eae3f 30:96df3ab41000
    20 #define _MAPTILESERVICE_H_
    20 #define _MAPTILESERVICE_H_
    21 
    21 
    22 
    22 
    23 #include <QString>
    23 #include <QString>
    24 #include <QtGlobal>
    24 #include <QtGlobal>
       
    25 #include <QObject>
       
    26 #include <qmobilityglobal.h>
    25 
    27 
       
    28 QTM_BEGIN_NAMESPACE
       
    29 class QValueSpacePublisher;
       
    30 class QValueSpaceSubscriber;
       
    31 QTM_END_NAMESPACE
       
    32 
       
    33 QTM_USE_NAMESPACE
    26 
    34 
    27 #ifdef  MAPTILESERVICEDLL
    35 #ifdef  MAPTILESERVICEDLL
    28 #define MAPTILESERVICE_EXPORT Q_DECL_EXPORT
    36 #define MAPTILESERVICE_EXPORT Q_DECL_EXPORT
    29 #else
    37 #else
    30 #define MAPTILESERVICE_EXPORT Q_DECL_IMPORT
    38 #define MAPTILESERVICE_EXPORT Q_DECL_IMPORT
    31 #endif
    39 #endif
    32 
    40 
    33 
    41 class TLookupItem;
    34 
    42 
    35 // CLASS DECLARATION
    43 // CLASS DECLARATION
    36 
    44 
    37 /**
    45 /**
    38 *  Maptile service class,  provides interface to get map tile image associated with 
    46 *  Maptile service class,  provides interface to get map tile image associated with 
    39 *  contact. Also provides interface to check whether location feature is enabled or disabled.
    47 *  contact. Also provides interface to check whether location feature is enabled or disabled.
    40 *
    48 *
    41 *  Note: Location feature can be enabled or disabled by modifying conf\cntmaptileservice.confml file.
    49 *  Note: Location feature can be enabled or disabled by modifying conf\cntmaptileservice.confml file.
    42 */
    50 */
    43 class MAPTILESERVICE_EXPORT MapTileService 
    51 class MAPTILESERVICE_EXPORT MapTileService : public QObject
    44 {
    52 {
       
    53     Q_OBJECT
       
    54 public:
    45 
    55 
    46 public:
    56     /** 
       
    57      * Maptile fetching status
       
    58      */
       
    59     enum MapTileStatus
       
    60     {
       
    61         /** Map tile fetching completed */
       
    62         MapTileFetchingCompleted = 0,
       
    63         /** Map tile fetching in progress */
       
    64         MapTileFetchingInProgress,
       
    65         /** Map  tile fetching n/w error */
       
    66         MapTileFetchingNetworkError,
       
    67         /** Map tile fetching invalid address */
       
    68         MapTileFetchingInvalidAddress,
       
    69         /** Map tile fetching unknown erro */
       
    70         MapTileFetchingUnknownError
       
    71     };
    47 
    72 
    48     /**
    73     /**
    49      * Application types      
    74      * Application types      
    50      */
    75      */
    51     enum AppType
    76     enum AppType
    53         /** Contacts application */
    78         /** Contacts application */
    54         AppTypeContacts,
    79         AppTypeContacts,
    55         /** Calendar application */
    80         /** Calendar application */
    56         AppTypeCalendar
    81         AppTypeCalendar
    57     };
    82     };
       
    83 	
    58     /** 
    84     /** 
    59      * Address types
    85      * Address types
    60      */
    86      */
    61     enum AddressType      
    87     enum AddressType      
    62     {
    88     {
    65         /** Address Type Pref */
    91         /** Address Type Pref */
    66         AddressPreference,
    92         AddressPreference,
    67         /** Address type Work */
    93         /** Address type Work */
    68         AddressWork,
    94         AddressWork,
    69         /** Address type Home */
    95         /** Address type Home */
    70         AddressHome
    96         AddressHome,
       
    97         /** Address type Unknown */
       
    98         AddressUnknown
    71     };
    99     };
    72       
   100         
       
   101     MapTileService();
       
   102     
       
   103     ~MapTileService();
       
   104     
    73    /**
   105    /**
    74     * Checks whether location feature enabled or disabled for specific application.
   106     * Checks whether location feature enabled or disabled for specific application.
    75     * 
   107     * 
    76     * @return Returns true or false based on location feature setting.
   108     * @return Returns true or false based on location feature setting.
    77     */
   109     */
    78     static bool isLocationFeatureEnabled(AppType appType);
   110     bool isLocationFeatureEnabled(AppType appType);
    79             
   111             
    80    /**
   112    /**
    81     * Gets a maptile image associated with a id(contact id/calendar id). 
   113     * Gets a maptile image associated with a id(contact id/calendar id). 
    82     * Returns a maptile image path if it is available otherwise returns NULL.
   114     * Returns a maptile image path if it is available otherwise returns NULL.
    83     * 
   115     * 
    84     * @param contactId  Contact id     
   116     * @param contactId  app id     
    85     * @param sourceType Source address type( Preferred, Home , Work address )
   117     * @param sourceType Source address type( Preferred, Home , Work address )
       
   118     * @param imagePath  Maptile image path associated with the app id
    86     *      
   119     *      
    87     * @return Returns maptile image path if it is available, else NULL.
   120     * @return Returns the maptile fetching status.
    88     */
   121     */
    89     static QString getMapTileImage( int Id, AddressType sourceType  );  
   122     int getMapTileImage( int Id, AddressType sourceType, QString& imagePath  );  
    90      	
   123     
       
   124 public slots: 
       
   125     /**
       
   126      * Receives maptile status information and emits the maptilFetchingStatusUpdate
       
   127      * signal.
       
   128      */
       
   129     void setMaptileStatus();
       
   130 
       
   131 signals:
       
   132     /**
       
   133      * Signal to update the maptile fetchings status to contact/calendar application.
       
   134      * @param id  app id     
       
   135      * @param addressType Source address type( Preferred, Home , Work address )
       
   136      * @param status Maptile status for the associated address
       
   137      */
       
   138      void maptileFetchingStatusUpdate( int id, int addressType, int status );
       
   139     
       
   140 
       
   141 private:
       
   142 
       
   143     /**
       
   144      * Publish the contact entry id , AddressType and number of address
       
   145      * @param id, Contact id .
       
   146      * @param sourceType, address type( Preferred, Home , Work address )
       
   147      * @param addressCount ,number of address to be published. 
       
   148      */
       
   149     void publishValue(int id, AddressType sourceType, int addressCount );
       
   150     /**
       
   151     * Publish the calendar entry id , AddressType and number of address
       
   152     * @param id, calendar entry id .
       
   153     * @param sourceType, address type( plain) 
       
   154     * @param addressCount ,number of address to be published. 
       
   155     */
       
   156     void publishCalEntry(int id);
       
   157     
       
   158     /**
       
   159     * Read entry from database
       
   160     * @param id, Contact/calendar id .
       
   161     * @param sourceType, address type( plain ,Preferred, Home , Work address )
       
   162     * @param aLookupItem ,entry information
       
   163     * @param aNoOfAddress ,number of address read from databse 
       
   164     */
       
   165     int readEntryFromMaptileDataBase( int id, AddressType sourceType,
       
   166                 TLookupItem& aLookupItem, int& aNoOfAddress  );
       
   167 
       
   168 private:
       
   169     
       
   170     //The contact/calendar id for which maptile requested
       
   171     int mLastViewedEntryId;
       
   172 	
       
   173     //Maptile request publisher
       
   174     QValueSpacePublisher *mPublisher;
       
   175     //Maptile status request subscriber
       
   176     QValueSpaceSubscriber *mSubscriber;
       
   177 	//Calendar Maptile request publisher
       
   178     QValueSpacePublisher *mCalPublisher;
    91 };
   179 };
    92 
   180 
    93 #endif //MAPTILESERVICE_H_
   181 #endif //MAPTILESERVICE_H_
    94 
   182