bluetoothengine/bthid/common/inc/genericserver.h
changeset 0 f63038272f30
equal deleted inserted replaced
-1:000000000000 0:f63038272f30
       
     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:  Declares main application class.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __GENERICSERVER_H__
       
    20 #define __GENERICSERVER_H__
       
    21 
       
    22 #include <e32std.h>
       
    23 #include <e32base.h>
       
    24 
       
    25 // ----------------------------------------------------------------------
       
    26 
       
    27 /*
       
    28  *  Information passed to the server to allow it to signal the client.
       
    29  */
       
    30 struct TStartupRequest
       
    31     {
       
    32     inline TStartupRequest();
       
    33     inline TStartupRequest(TRequestStatus* status, TThreadId id);
       
    34 
       
    35     /** Request status to be signalled when the server has started */
       
    36     TRequestStatus* iStatus;
       
    37     /** ID of the client's thread */
       
    38     TThreadId iId;
       
    39     };
       
    40 
       
    41 const TInt KStartupTextLength = sizeof(TStartupRequest) / sizeof(TText);
       
    42 
       
    43 // ----------------------------------------------------------------------
       
    44 
       
    45 /*
       
    46  *  Base class for all servers.
       
    47  */
       
    48 class CGenericServer : public CPolicyServer
       
    49 
       
    50     {
       
    51 public:
       
    52     /**
       
    53      *  Extract the client startup information from the command line passed
       
    54      *  to the server process.
       
    55      *  @param startup Structure to receive the client information.
       
    56      *  @return TInt KErrNone if successful.
       
    57      */
       
    58     static TInt GetStartupFromCommandLine(TStartupRequest& startup);
       
    59 
       
    60 protected:
       
    61     // Constructor
       
    62     CGenericServer(TInt aPriority);
       
    63     // Signal the client that server startup has finished
       
    64     static void SignalStartup(TStartupRequest* startup, TInt aReason);
       
    65     };
       
    66 
       
    67 // ----------------------------------------------------------------------
       
    68 
       
    69 inline TStartupRequest::TStartupRequest() :
       
    70     iStatus(NULL), iId(0)
       
    71     {
       
    72     }
       
    73 
       
    74 inline TStartupRequest::TStartupRequest(TRequestStatus* status, TThreadId id) :
       
    75     iStatus(status), iId(id)
       
    76     {
       
    77     }
       
    78 
       
    79 #endif  // __GENERICSERVER_H__