tacticonserver/server/inc/tacticonserver.h
changeset 0 d54f32e146dd
equal deleted inserted replaced
-1:000000000000 0:d54f32e146dd
       
     1 /*
       
     2 * Copyright (c) 2009 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: Tacticon server implementation.
       
    15 * Part of    : Tacticon Server
       
    16 */
       
    17 
       
    18 #ifndef C_TACTICONSERVER_H
       
    19 #define C_TACTICONSERVER_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <f32file.h>
       
    23 
       
    24 #include <tacticon.hrh>
       
    25 
       
    26 #include "tacticonplayer.h"
       
    27 #include "tacticonprivatecrkeys.h"
       
    28 #include "tacticondefs.h"
       
    29 
       
    30 class CRepository;
       
    31 class CTacticonShutdown;
       
    32 
       
    33 /** Total number of ranges */
       
    34 const TUint KTacticonRangeCount = 1;
       
    35 
       
    36 /** Definition of the ranges of IPC numbers */
       
    37 const TInt KTacticonRanges[KTacticonRangeCount] = 
       
    38     {
       
    39     0,
       
    40     }; 
       
    41 
       
    42 /** Policy to implement for each of the above ranges */       
       
    43 const TUint8 KTacticonElementsIndex[KTacticonRangeCount] = 
       
    44     {
       
    45     0,
       
    46     };
       
    47 
       
    48 const CPolicyServer::TPolicyElement KTacticonPolicyElements[] = 
       
    49     {
       
    50     _INIT_SECURITY_POLICY_C2(ECapability_None,
       
    51                                ECapability_None),
       
    52                                CPolicyServer::EFailClient
       
    53     };
       
    54 
       
    55 /** Package all the above together into a policy */
       
    56 const CPolicyServer::TPolicy KTacticonPolicy =
       
    57     {
       
    58     CPolicyServer::EAlwaysPass,     // all attempts should pass
       
    59     KTacticonRangeCount,     // number of ranges
       
    60     KTacticonRanges,         // ranges array
       
    61     KTacticonElementsIndex,  // elements<->ranges index
       
    62     KTacticonPolicyElements, // array of elements
       
    63     };
       
    64     
       
    65 /**
       
    66 *  A server class to initialize server. 
       
    67 *  @lib tacticonserver.lib
       
    68 *  @since S60 5.2
       
    69 */
       
    70 class CTacticonServer : public CPolicyServer
       
    71     {
       
    72 public:
       
    73     /**
       
    74     * 2-phased constructor.
       
    75     */
       
    76     static CTacticonServer* NewLC();
       
    77     
       
    78     /**
       
    79     * C++ destructor.
       
    80     */ 
       
    81     virtual ~CTacticonServer();
       
    82     
       
    83    
       
    84 public:
       
    85     /**
       
    86     * From CServer2, creates a new session.
       
    87     * @since S60 5.2
       
    88     * @param aVersion, Tacticon server version
       
    89     * @param aMessage, a message from client     
       
    90     */
       
    91     CSession2* NewSessionL( const TVersion& aVersion,
       
    92                             const RMessage2& aMessage ) const;
       
    93                             
       
    94 public:
       
    95     /**
       
    96      * Increase session count.
       
    97      * @since S60 5.2
       
    98      */
       
    99     void AddSession();
       
   100     
       
   101     /**
       
   102      * Decrease session count, close server if count is zero.
       
   103      * @since S60 5.2
       
   104      */
       
   105     void RemoveSession();  
       
   106     
       
   107 public:
       
   108     /**
       
   109      * Plays tacticon according to aTacticonType
       
   110      * @since S60 5.2
       
   111      * @param aTacticonType, Tacticon type to be played
       
   112      */
       
   113     void PlayTacticon( TTacticonType aTacticonType ); 
       
   114     
       
   115     /**
       
   116      * Stops playing tacticon
       
   117      * @since S60 5.2
       
   118      */    
       
   119     void StopTacticon();                             
       
   120 
       
   121     /**
       
   122      * Sets tacticons enabled/disabled.
       
   123      * @since S60 5.2
       
   124      */    
       
   125     void EnableTacticons( TBool aEnabled );
       
   126     
       
   127     /**
       
   128      * Returns boolean value whether tacticons are enabled or disabled.
       
   129      * @since S60 5.2
       
   130      */        
       
   131     TBool TacticonsEnabled();
       
   132 
       
   133 private:    
       
   134     /**
       
   135     * C++ constructor.
       
   136     */
       
   137     CTacticonServer();
       
   138     
       
   139     /**
       
   140     * 2nd phase constructor.
       
   141     */
       
   142     void ConstructL();
       
   143 
       
   144 private:
       
   145     /**
       
   146      * Counter of opened client sessions.
       
   147      */
       
   148     TInt iSessionCount;
       
   149 
       
   150     /**
       
   151      * Player plugin. 
       
   152      * Own.
       
   153      */
       
   154     CTacticonPlayer* iPlayer;  
       
   155     
       
   156      /**
       
   157      * Access to settings.
       
   158      * Own.
       
   159      */    
       
   160     CRepository* iRepository;
       
   161   
       
   162     /**
       
   163      * Timer for server shutdown
       
   164      * Own.
       
   165      */
       
   166     CTacticonShutdown* iShutdown; 
       
   167     
       
   168     /**
       
   169      * 
       
   170      */    
       
   171     TBool   iTacticonsEnabled;
       
   172 
       
   173     };
       
   174 
       
   175 
       
   176 #endif // C_TACTICONSERVER_H
       
   177