utilities/serviceipcserver/platform/s60/serviceipcserversymbiansession.h
changeset 16 3c88a81ff781
equal deleted inserted replaced
14:6aeb7a756187 16:3c88a81ff781
       
     1 /**
       
     2    This file is part of CWRT package **
       
     3 
       
     4    Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
       
     5 
       
     6    This program is free software: you can redistribute it and/or modify
       
     7    it under the terms of the GNU (Lesser) General Public License as
       
     8    published by the Free Software Foundation, version 2.1 of the License.
       
     9    This program is distributed in the hope that it will be useful, but
       
    10    WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
       
    12    (Lesser) General Public License for more details. You should have
       
    13    received a copy of the GNU (Lesser) General Public License along
       
    14    with this program. If not, see <http://www.gnu.org/licenses/>.
       
    15 */
       
    16 
       
    17 
       
    18 #ifndef serviceipcserversymbiansession_h
       
    19 #define serviceipcserversymbiansession_h
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <e32cmn.h> 
       
    23 #include "serviceipcserversession.h"
       
    24 #include "serviceipcserversymbianserver_p.h"
       
    25 
       
    26 namespace WRT {
       
    27     class CServiceSymbianSession : public CSession2, public ServiceIPCSession
       
    28     {
       
    29     public:
       
    30     
       
    31         static CServiceSymbianSession* NewL(MServiceIPCObserver* aObserver);
       
    32     
       
    33         virtual ~CServiceSymbianSession();
       
    34     
       
    35         // From ServiceIPCSession
       
    36     protected:
       
    37     
       
    38         bool write(const QByteArray& aData);
       
    39     
       
    40         bool completeRequest();
       
    41     
       
    42         void close();
       
    43     
       
    44         // From CSession2
       
    45     protected:
       
    46     
       
    47         void CreateL();
       
    48         
       
    49         void ServiceL(const RMessage2& aMessage);
       
    50     
       
    51         void Disconnect(const RMessage2 &aMessage);
       
    52     
       
    53         // Service methods
       
    54     private:
       
    55     
       
    56         void handleRequestL(const RMessage2& aMessage);
       
    57     
       
    58         void handleGetBufferL(const RMessage2& aMessage);
       
    59     
       
    60         HBufC* ReadDesLC(const RMessage2& aMessage, TInt aMsgSlot);
       
    61     
       
    62         HBufC8* ReadDes8LC(const RMessage2& aMessage, TInt aMsgSlot);
       
    63     private:
       
    64     
       
    65         CServiceSymbianSession(MServiceIPCObserver* aObserver);
       
    66     
       
    67         void ConstructL();
       
    68         
       
    69         inline CServiceSymbianServer& CServiceSymbianSession::Server()
       
    70             {return *reinterpret_cast<CServiceSymbianServer*>(const_cast<CServer2*>(CSession2::Server()));}
       
    71     
       
    72         inline void releaseSessionId(int aSessionId) 
       
    73         {
       
    74             Server().releaseSessionId(aSessionId);
       
    75         };
       
    76         
       
    77         inline void appendBroadcastList(int aSessionId, ServiceIPCSession * aSession)
       
    78         {
       
    79             Server().appendBroadcastList(aSessionId, aSession);
       
    80         }; 
       
    81     private:
       
    82         // data
       
    83         RMessage2 m_message;
       
    84         QByteArray m_data;
       
    85     };
       
    86 }
       
    87 #endif // serviceipcserversymbiansession_h