ccservices/cmsservices/presencetrafficlights/inc/cmsonecontactstatus.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2008 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMSONECONTACTSTATUS_H_
       
    20 #define CMSONECONTACTSTATUS_H_
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <badesca.h>
       
    24 
       
    25 #include "bpasobserver.h"
       
    26 
       
    27 class MPresenceIconNotifier;
       
    28 class MVPbkContactLink;
       
    29 class CBPAS;
       
    30 class CBPASInfo;
       
    31 class CCmsOneServiceStatus;
       
    32 
       
    33 
       
    34 /**
       
    35  *  Branded presence icons handling class.
       
    36  *
       
    37  *  @lib cmsserver.exe
       
    38  *  @since S60 v5.0
       
    39  */
       
    40 NONSHARABLE_CLASS(CCmsOneContactStatus):  public CBase, public MBPASObserver
       
    41     {
       
    42 
       
    43 public: 
       
    44 
       
    45     /**
       
    46      * Symbian constructors.
       
    47      *
       
    48      * @param aCallback callback method for notifications
       
    49      * @return CCmsBrandedIcons
       
    50      */
       
    51     static CCmsOneContactStatus* NewL( MPresenceIconNotifier& aCallback,
       
    52             MVPbkContactLink* aContact,            
       
    53             HBufC8* aDefaultTrafficLightBrandId, 
       
    54             HBufC8* aDefaultOnlineElementId, 
       
    55             HBufC8* aDefaultOfflineElementId,
       
    56             TInt aId );
       
    57 
       
    58     /**
       
    59      * Public destructor. 
       
    60      */
       
    61     virtual ~CCmsOneContactStatus();
       
    62     
       
    63 // new methods
       
    64 
       
    65     /*
       
    66      * Subscribe common branded icon
       
    67      */
       
    68     void SubscribeL( MDesC16Array* aIdentities );
       
    69     
       
    70     /**
       
    71      * Get all services brandings at once
       
    72      */
       
    73     void GetAllL( MDesC16Array* aIdentities );    
       
    74               
       
    75     TBool IsSameContact( MVPbkContactLink* aLink, MPresenceIconNotifier* aCallback);
       
    76     
       
    77 // from base class MBPASObserver 
       
    78 
       
    79     /**
       
    80      * Defined in a base class
       
    81      */
       
    82     void HandleInfosL( TInt aErrorCode, RPointerArray<CBPASInfo>& aInfos );
       
    83     
       
    84     /**
       
    85      * Defined in a base class
       
    86      */
       
    87     void HandleSubscribedInfoL(CBPASInfo* aInfo);
       
    88         
       
    89             
       
    90 private:
       
    91  
       
    92     CCmsOneContactStatus( MPresenceIconNotifier& aCallback,            
       
    93             HBufC8* aDefaultTrafficLightBrandId, 
       
    94             HBufC8* aDefaultOnlineElementId, 
       
    95             HBufC8* aDefaultOfflineElementId,
       
    96             TInt aId );            
       
    97     
       
    98     void ConstructL( MVPbkContactLink* aContact );
       
    99     
       
   100 // new methods    
       
   101     
       
   102     /**
       
   103      * Update presence data and send notification if needed.
       
   104      */
       
   105     void UpdateStatusL( TBool aGetAllOnce );
       
   106     
       
   107     /*
       
   108      * Update one common branded icon status
       
   109      */
       
   110     void UpdateCommonStatusL( ); 
       
   111     
       
   112     /*
       
   113      * Update all services status separately
       
   114      */
       
   115     void UpdateAllAtOnceStatus( );      
       
   116     
       
   117     void DoHandleInfosL( RPointerArray<CBPASInfo>& aInfos, TBool aDelete, TBool aGetAllOnce );
       
   118     
       
   119     void DoHandleInfoL( CBPASInfo* aInfo );    
       
   120     
       
   121     TPtrC ExtractServiceL( const TDesC& aXspId );
       
   122     
       
   123     CCmsOneServiceStatus* FindService( const TDesC& aService );
       
   124     
       
   125     void SendNotificationWhenNeededL( CCmsOneServiceStatus* aOnlyStatus );  
       
   126     
       
   127     void DoSendNotificationL( const TDesC8& aService, const TDesC8& aElement, TInt aBrandLanguage );    
       
   128         
       
   129     void RemoveService( CCmsOneServiceStatus* aService );
       
   130     
       
   131     TPtrC8 TrafficLightService();
       
   132     
       
   133     TPtrC8 TrafficLightOnline();
       
   134     
       
   135     TPtrC8 TrafficLightOffline();
       
   136     
       
   137     TPtrC8 LastBrand( );
       
   138     
       
   139     TPtrC8 LastElement( );    
       
   140     
       
   141 private:
       
   142 
       
   143     /**
       
   144      * Callback implementation
       
   145      */
       
   146     MPresenceIconNotifier& iCallback;
       
   147     
       
   148     /* NOT OWN */
       
   149     HBufC8* iDefaultTrafficLightBrandId;
       
   150     /* NOT OWN */    
       
   151     HBufC8* iDefaultOnlineElementId;
       
   152     /* NOT OWN */    
       
   153     HBufC8* iDefaultOfflineElementId; 
       
   154     
       
   155     /**
       
   156      * Contact link
       
   157      * OWN
       
   158      */
       
   159     MVPbkContactLink* iContactLink;  
       
   160     
       
   161     /**
       
   162      * BPAS entity.
       
   163      * OWN
       
   164      */
       
   165     CBPAS* iBrandedPresence;    
       
   166         
       
   167     /**
       
   168      * Number of services available
       
   169      */
       
   170     TInt iAvailableServices;
       
   171     
       
   172     /**
       
   173      * Number of services currently online.
       
   174      */
       
   175     TInt iOnlineServices;    
       
   176     
       
   177     /**
       
   178      * services for the contact
       
   179      */
       
   180     RPointerArray<CCmsOneServiceStatus> iServices;
       
   181     
       
   182     /**
       
   183      * Last sent service
       
   184      * OWN.
       
   185      */
       
   186     HBufC8* iLastService;
       
   187     
       
   188     /**
       
   189      * Last sent element
       
   190      * OWN.
       
   191      */
       
   192     HBufC8* iLastElement;
       
   193     
       
   194     /**
       
   195      * Id to identify the request responses
       
   196      */
       
   197     TInt iId;
       
   198     };
       
   199 
       
   200 
       
   201 #endif /*CCMSONECONTACTSTATUS_H_*/