installationservices/swinstallationfw/inc_private/sifnotification_internal.h
branchRCL_3
changeset 26 8b7f4e561641
parent 25 7333d7932ef7
child 27 e8965914fac7
equal deleted inserted replaced
25:7333d7932ef7 26:8b7f4e561641
     1 /*
       
     2 * Copyright (c) 2010 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 the License "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 * sifnotification_internal.h - Internal classes used by the Sif notifier.
       
    16 *
       
    17 */
       
    18 
       
    19 /**
       
    20  @file
       
    21  @released
       
    22  @internal
       
    23 */
       
    24 
       
    25 #ifndef __SIFNOTIFICATION_INTERNAL_H__
       
    26 #define __SIFNOTIFICATION_INTERNAL_H__
       
    27 
       
    28 #include <e32std.h>
       
    29 #include <usif/sif/sifnotification.h>
       
    30 
       
    31 namespace Usif {
       
    32 
       
    33 const TUint KBufferSize = 100;
       
    34 const TInt KMaxNumberOfOperations = 11;//One more than the maximum number of operations that that could be tracked
       
    35 //The Global operation key, this property will contain the total number and list of all the ongoing operations.
       
    36 const TUint KSifOperationKey = 0x2002ED64; 
       
    37 //StartEnd and progress key for the first operation
       
    38 const TUint KSifFirstOperationStartEndKey = 0x2002ED65; 
       
    39 //StartEnd and progress key for the second operation
       
    40 const TUint KSifSecondOperationStartEndKey = 0x2002ED67;
       
    41 //StartEnd and progress key for the third operation
       
    42 const TUint KSifThirdOperationStartEndKey = 0x2002ED69;
       
    43 //StartEnd and progress key for the fourth operation
       
    44 const TUint KSifFourthOperationStartEndKey = 0x2002F7C4;
       
    45 //StartEnd and progress key for the fifth operation
       
    46 const TUint KSifFifthOperationStartEndKey = 0x2002F7C6;
       
    47 //StartEnd and progress key for the sixth operation
       
    48 const TUint KSifSixthOperationStartEndKey = 0x2002F7C8;
       
    49 //StartEnd and progress key for the seventh operation
       
    50 const TUint KSifSeventhOperationStartEndKey = 0x2002F7CA;
       
    51 //StartEnd and progress key for the eight operation
       
    52 const TUint KSifEightOperationStartEndKey = 0x2002F7CC;
       
    53 //StartEnd and progress key for the ninth operation
       
    54 const TUint KSifNinthOperationStartEndKey = 0x2002F7CE;
       
    55 //StartEnd and progress key for the tenth operation
       
    56 const TUint KSifTenthOperationStartEndKey = 0x2002F7D0;
       
    57 
       
    58 const TUint KSifPropertyTable [KMaxNumberOfOperations-1] = {KSifFirstOperationStartEndKey, KSifSecondOperationStartEndKey, KSifThirdOperationStartEndKey,
       
    59                                                             KSifFourthOperationStartEndKey, KSifFifthOperationStartEndKey, KSifSixthOperationStartEndKey,
       
    60                                                             KSifSeventhOperationStartEndKey, KSifEightOperationStartEndKey, KSifNinthOperationStartEndKey, KSifTenthOperationStartEndKey};
       
    61 
       
    62 const TInt KDeleteKeyDelay = 2000000; // 2 seconds
       
    63 
       
    64 const TInt KStartBufLength = 100;
       
    65 const TInt KProgressBufLength = 25;
       
    66 
       
    67 _LIT_SECURITY_POLICY_C1(KSecurityPolicyNone, ECapability_None);
       
    68 _LIT_SECURITY_POLICY_C1(KSecurityPolicyWDD, ECapabilityWriteDeviceData);
       
    69 
       
    70 /**
       
    71  * This class will be used internally to start timer after publishing the completion data.
       
    72  * The property which holds the Start-End and Progress data will be deleted after this timer.
       
    73  */
       
    74 NONSHARABLE_CLASS(CDeleteKeyTimer) : public CTimer
       
    75     {
       
    76 public:
       
    77     static CDeleteKeyTimer* NewL(const TUint aKey);
       
    78     CDeleteKeyTimer();
       
    79     ~CDeleteKeyTimer();
       
    80     void Start();
       
    81 private:
       
    82     void ConstructL(const TUint aKey);
       
    83     void RunL();
       
    84     TInt RunError(TInt aError);
       
    85     TUint iKey;//StartEnd key to be deleted
       
    86     };
       
    87 
       
    88 
       
    89 NONSHARABLE_CLASS(CSifOperationKey) : public CBase
       
    90     /**
       
    91      * This class will be used internally to hold contents of KSIFOperationKey
       
    92      */
       
    93     {
       
    94 public:
       
    95     IMPORT_C static CSifOperationKey* NewL();
       
    96     IMPORT_C static CSifOperationKey* NewLC();    
       
    97     static CSifOperationKey* NewL(RReadStream& aStream);
       
    98     ~CSifOperationKey(); 
       
    99     void AddKeyL(TUint aKey);
       
   100     void DeleteKey(TUint aPos);
       
   101     const RArray<TUint>& StartEndKeys() const;
       
   102     IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
       
   103 private:
       
   104     void InternalizeL(RReadStream& aStream);
       
   105     CSifOperationKey();
       
   106     void ConstructL();
       
   107 
       
   108 private:
       
   109     RArray<TUint> iStartEndKeyArray; 
       
   110     };
       
   111 
       
   112 
       
   113 /**
       
   114  * This class will be used internally to subscribe to changes in individual operations requested by the client.
       
   115  */
       
   116 class CSifNotifierBase : public CActive
       
   117     {
       
   118 public:
       
   119 	enum TNotifierType
       
   120         {
       
   121         EStartEndNotifier =1,
       
   122         EProgressNotifier
       
   123         };
       
   124 
       
   125     IMPORT_C static CSifNotifierBase* NewL(MSifOperationsHandler& aHandler, TUint aKey, TNotifierType aType);
       
   126     IMPORT_C static CSifNotifierBase* NewLC(MSifOperationsHandler& aHandler, TUint aKey, TNotifierType aType);
       
   127     IMPORT_C TUint Key();
       
   128     IMPORT_C ~CSifNotifierBase();
       
   129     
       
   130 private:
       
   131     CSifNotifierBase(MSifOperationsHandler& aHandler, TUint aKey, TNotifierType aType);
       
   132     void WaitForChangeL();
       
   133     void ConstructL();
       
   134     void RunL();
       
   135     TInt RunError(TInt aError);
       
   136     void DoCancel();
       
   137     
       
   138 private:
       
   139     MSifOperationsHandler& iHandler; 
       
   140     TUint iKey;
       
   141     RProperty iProperty;
       
   142     TInt iBufferSize;
       
   143     TNotifierType iType;
       
   144     };
       
   145 
       
   146 
       
   147 } //namespace 
       
   148 
       
   149 #endif //__SIFNOTIFICATION_INTERNAL_H__