hti/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommServer/inc/HtiBtCommServer.h
branchRCL_3
changeset 59 8ad140f3dd41
parent 0 a03f92240627
equal deleted inserted replaced
49:7fdc9a71d314 59:8ad140f3dd41
       
     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:  CHtiBtCommServer declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __HTIBTCOMMSERVER_H__
       
    20 #define __HTIBTCOMMSERVER_H__
       
    21 
       
    22 //  INCLUDES
       
    23 
       
    24 #include <e32def.h>
       
    25 #include <e32base.h>
       
    26 
       
    27 //  CONSTANTS
       
    28 
       
    29 // Reasons for BtCommServer panic
       
    30 enum TBtCommServerPanic
       
    31     {
       
    32     EBadRequest,
       
    33     EBadDescriptor,
       
    34     EMainSchedulerError,
       
    35     ESvrCreateServer,
       
    36     ESvrStartServer,
       
    37     ECreateTrapCleanup,
       
    38     ENotImplementedYet,
       
    39     EFailedToInitMessageBox,
       
    40     EFailedToOpenBTconnection,
       
    41     EFailedToOpenPhonetChannel,
       
    42     EFailedToRecPhonetMsg,
       
    43     EFailedToSendPhonetMsg,
       
    44     ETooManyAsyncRequests
       
    45     };
       
    46 
       
    47 //  FUNCTION PROTOTYPES
       
    48 
       
    49 // Function to panic the server
       
    50 GLREF_C void PanicServer( TBtCommServerPanic aPanic );
       
    51 
       
    52 // Thread function for server
       
    53 GLREF_C TInt BtCommServerThread( TAny * );
       
    54 
       
    55 //  FORWARD DECLARATIONS
       
    56 class CHtiBtCommServerSession;
       
    57 class CHtiBtReaderWriter;
       
    58 
       
    59 // CLASS DECLARATION
       
    60 
       
    61 /**
       
    62 * Server class for BT communication.
       
    63 */
       
    64 class CHtiBtCommServer : public CServer2
       
    65     {
       
    66 
       
    67     private: // Constructors and destructor
       
    68        /**
       
    69         * C++ default constructor.
       
    70         */
       
    71         CHtiBtCommServer( TInt aPriority );
       
    72 
       
    73        /**
       
    74         * Second Phase constructor
       
    75         */
       
    76         void ConstructL();
       
    77 
       
    78     public:
       
    79        /**
       
    80         * Symbian Two-phased constructor.
       
    81         */
       
    82         static CHtiBtCommServer* NewL();
       
    83 
       
    84        /**
       
    85         * Destructor.
       
    86         */
       
    87         ~CHtiBtCommServer();
       
    88 
       
    89     public: // callbacks from session
       
    90 
       
    91         /**
       
    92         * Session was deleted notification.
       
    93         * Session notifies server, when client is disconnecting
       
    94         * and session is being deleted. Server will start shutdown.
       
    95         */
       
    96         void SessionFreed();
       
    97 
       
    98         /**
       
    99         * Session was created notification.
       
   100         * @param aSession Session, which is notifying server of its creation.
       
   101         */
       
   102         void SessionCreated( CHtiBtCommServerSession* aSession );
       
   103 
       
   104     public:
       
   105        /**
       
   106         * Creates a new client session
       
   107         * @param aVersion Version of the server
       
   108         * @param aMessage Client message
       
   109         * @return Pointer to the client session
       
   110         */
       
   111         virtual CSession2* NewSessionL( const TVersion& aVersion,
       
   112             const RMessage2& aMessage ) const;
       
   113 
       
   114        /**
       
   115         * Creates server thread
       
   116         * @param aStarted semaphore
       
   117         * @return Error code
       
   118         */
       
   119         static TInt ThreadFunction( TAny* aStarted );
       
   120 
       
   121 public: // Data
       
   122     // Priority of the server
       
   123     enum TBtServPriority
       
   124         {
       
   125         EBtCommServerPriority = 100
       
   126         };
       
   127 
       
   128 private:
       
   129 
       
   130     CHtiBtCommServerSession* iSession; // Not owned. Only one session allowed!
       
   131 
       
   132     };
       
   133 
       
   134 #endif // __HTIBTCOMMSERVER_H__
       
   135 
       
   136 // End of file