phoneapp/phoneringingtoneplayer/inc/cphonetoneserver.h
changeset 78 baacf668fe89
equal deleted inserted replaced
76:cfea66083b62 78:baacf668fe89
       
     1 /*
       
     2 * Copyright (c) 2010-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 "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:  Phone ringing tone server definitions.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef PHONETONESERVER_H
       
    20 #define PHONETONESERVER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <f32file.h>
       
    24 #include <Profile.hrh>
       
    25 #include <e32base.h>
       
    26     
       
    27 #include "mphonetoneserver.h"
       
    28 
       
    29 // CONSTANTS
       
    30 const TInt KRingingToneSrvVersionMajor = 1;
       
    31 const TInt KRingingToneSrvVersionMinor = 0;
       
    32 const TInt KRingingToneSrvVersionBuild = 0;
       
    33 _LIT( KRingingToneServerName, "PhoneRingingToneSrv" );
       
    34 
       
    35 enum TRingingToneSrvOpcodes
       
    36     {
       
    37     EPlayAudioRingTone,
       
    38     EStopPlaying
       
    39     };
       
    40 
       
    41 // CLASS DECLARATION
       
    42 NONSHARABLE_CLASS( CPhoneToneServer ) : public CServer2, public MPhoneToneServer
       
    43     {
       
    44 public:
       
    45 
       
    46     static CPhoneToneServer* NewLC();
       
    47 
       
    48     ~CPhoneToneServer();
       
    49 
       
    50     
       
    51     /**
       
    52     * Thread entry function.
       
    53     *
       
    54     * @param aPtr
       
    55     * @return new instance.
       
    56     */    
       
    57 
       
    58     static TInt ThreadEntryFunc( TAny* aPtr );
       
    59 
       
    60 public: 
       
    61     
       
    62     /**
       
    63     * Derived from CServer2, creates a new session.
       
    64     * @param aVersion It is the version of the client api.
       
    65     * @param aMessage Connect message from Client.
       
    66     * @see CServer2
       
    67     * @return Returns a new session.
       
    68     */          
       
    69     CSession2* NewSessionL( const TVersion& aVersion,  
       
    70                             const RMessage2& aMessage ) const;
       
    71     
       
    72     /**
       
    73     * Runs server down.
       
    74     * @see MPhoneToneServer
       
    75     */    
       
    76     virtual void RunDown() const;
       
    77 
       
    78 private:
       
    79 
       
    80     CPhoneToneServer();
       
    81 
       
    82     void ConstructL();
       
    83 
       
    84 private:
       
    85 
       
    86     /**
       
    87     * Runs server.
       
    88     */
       
    89     static void RunServerL();
       
    90 
       
    91 private:
       
    92     
       
    93     /*
       
    94      * Server should be unique connectable to avoid IPC fuzzing. 
       
    95      * However, NewSessionL is a const function,
       
    96      * so we have to use mutable flag to define connection existence.
       
    97      */
       
    98     mutable TBool iHasConnection;
       
    99 };
       
   100 
       
   101 #endif   //  PHONETONESERVER_H
       
   102 
       
   103 // End of file