sensorservices/sensorserver/inc/server/sensrvsession.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2006-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:  Server side client session implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef SENSRVSESSION_H
       
    20 #define SENSRVSESSION_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include "sensrvtypes.h"
       
    24 #include "sensrvresourcechannelinfo.h"
       
    25 
       
    26 //Forward declarations
       
    27 class CSensrvServer;
       
    28 class CSensrvProxyManager;
       
    29 class CSensrvMessage;
       
    30 class CSensrvChannelChangeQueue;
       
    31 
       
    32 /**
       
    33 *  Represents a session for a client thread on the server-side.
       
    34 *  A session acts as a channel of communication between the client 
       
    35 *  and the server. 
       
    36 *
       
    37 *  @since S60 5.0
       
    38 */
       
    39 class CSensrvSession : public CSession2
       
    40     {
       
    41     public:  // Constructors and destructor
       
    42         
       
    43         /**
       
    44         * Two-phased constructor.
       
    45         */
       
    46         static CSensrvSession* NewL( CSensrvServer& aServer, 
       
    47                                      CSensrvProxyManager& aProxyManager,
       
    48                                      TSecureId aSecureId );
       
    49         
       
    50         /**
       
    51         * Destructor.
       
    52         */
       
    53         virtual ~CSensrvSession();
       
    54         
       
    55         /**
       
    56         * Get the Secure ID of the client process.
       
    57         *
       
    58         * @since S60 5.0
       
    59         * @return Secure ID of the process.
       
    60         */
       
    61         TSecureId SecureId();
       
    62         
       
    63         /**
       
    64         * Notifies client if it is interested in channel change notifications
       
    65         *
       
    66         * @since S60 5.0
       
    67         * @param[in] aChangedChannel Channel information of the channel.
       
    68         * @param[in] aChangeType If ESensrvChannelAdded, channel is a newly available
       
    69         *                        channel. 
       
    70         *                        If ESensrvChannelRemoved, channel was removed and is  
       
    71         *                        no longer available.        
       
    72         */
       
    73         void NotifyChannelChange( const TSensrvResourceChannelInfo& aChangedChannel,
       
    74                                   TSensrvChannelChangeType aChangeType );
       
    75         
       
    76     protected:  // Functions from base classes
       
    77         
       
    78         /**
       
    79         * From CSession2
       
    80         *
       
    81         * @since S60 5.0
       
    82         * @param aMessage The message containing the client request
       
    83         */
       
    84         virtual void ServiceL( const RMessage2& aMessage );
       
    85 
       
    86     private:
       
    87 
       
    88         /**
       
    89         * C++ default constructor.
       
    90         */
       
    91         CSensrvSession( CSensrvServer& aServer, 
       
    92                         CSensrvProxyManager& aProxyManager,
       
    93                         TSecureId aSecureId );
       
    94 
       
    95         /**
       
    96         * By default Symbian 2nd phase constructor is private.
       
    97         */
       
    98         void ConstructL();
       
    99 
       
   100         /**
       
   101         * Completes asynchronous change notification message.     
       
   102         * Message must exist and have valid handle
       
   103         * 
       
   104         * @since S60 5.0
       
   105         * @param aSet Set that was met. There must be met data in this set.
       
   106         *        The set is removed from met sets list and deleted if
       
   107         *        completion of message is successful. Otherwise
       
   108         *        the set remains in the list.
       
   109         */
       
   110         void CompleteChangeNotificationMessage(const TSensrvResourceChannelInfo& aChangedChannel,
       
   111                                                TSensrvChannelChangeType aChangeType);
       
   112 
       
   113     private:    // Data
       
   114 
       
   115         /**
       
   116         * Server reference. 
       
   117         * Not own.
       
   118         */
       
   119         CSensrvServer& iServer; 
       
   120         
       
   121         /**
       
   122         * Proxy manager reference.
       
   123         * Not own.
       
   124         */
       
   125         CSensrvProxyManager& iProxyManager;
       
   126         
       
   127         /**
       
   128         * Reuse synchronous messages to improve OOM cleanup.
       
   129         * Own
       
   130         */
       
   131         CSensrvMessage* iSyncMessage;
       
   132         
       
   133         /**
       
   134         * Reuse data listening messages to improve cleanup and performance.
       
   135         * Own
       
   136         */
       
   137         CSensrvMessage* iAsyncDataMessage;
       
   138         
       
   139         /**
       
   140         * Reuse property listening messages to improve cleanup and performance.
       
   141         * Own
       
   142         */
       
   143         CSensrvMessage* iAsyncPropertyMessage;
       
   144 
       
   145         /**
       
   146         * Reuse condition listening messages to improve cleanup and performance.
       
   147         * Own
       
   148         */
       
   149         CSensrvMessage* iAsyncConditionMessage;
       
   150         
       
   151         /**
       
   152         * Reuse channel change messages to improve cleanup and performance.
       
   153         * Own
       
   154         */
       
   155         CSensrvMessage* iAsyncChannelChangeMessage;
       
   156 
       
   157         /**
       
   158         * Secure ID of the process which has been created this session.
       
   159         */
       
   160         TSecureId iSecureId; 
       
   161         
       
   162         /**
       
   163         * Queue for channel change notifications.
       
   164         * Own
       
   165         */
       
   166         CSensrvChannelChangeQueue* iChannelChangeQueue;
       
   167         
       
   168         /**
       
   169         * Search params of the active channel change notification.
       
   170         */
       
   171         TSensrvResourceChannelInfo iChannelChangeSearchParams;
       
   172 
       
   173     };
       
   174 
       
   175 
       
   176 #endif // SENSRVSESSION_H