utilities/serviceipcserver/platform/qt/serviceipclocalsocketsession.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 serviceipclocalsocketsession_h
       
    19 #define serviceipclocalsocketsession_h
       
    20 
       
    21 #include "serviceipcserversession.h"
       
    22 #include "serviceipcserverlocalsocket_p.h"
       
    23 
       
    24 class MServiceIPCObserver;
       
    25 class QLocalSocket;
       
    26 
       
    27 namespace WRT {
       
    28     
       
    29     class MServiceIPCObserver;
       
    30     
       
    31     class LocalSocketSession : public ServiceIPCSession
       
    32     {
       
    33     Q_OBJECT
       
    34     public:
       
    35     
       
    36         virtual ~LocalSocketSession();
       
    37     
       
    38                         LocalSocketSession(QLocalSocket* aNewSocket,
       
    39                                            MServiceIPCObserver* aObserver);
       
    40     
       
    41         // From ServiceIPCSession
       
    42     
       
    43         bool write(const QByteArray& aData);
       
    44     
       
    45         bool completeRequest();
       
    46     
       
    47         void close();
       
    48         
       
    49         inline void releaseSessionId(int aSessionId) 
       
    50         {
       
    51             ((ServiceFwIPCServerLocalSocket* )parent())->releaseSessionId(aSessionId);
       
    52         };
       
    53         
       
    54         inline void appendBroadcastList(int aSessionId, ServiceIPCSession * aSession)
       
    55         {
       
    56             ((ServiceFwIPCServerLocalSocket*) parent())->appendBroadcastList(aSessionId, aSession);
       
    57         }; 
       
    58     
       
    59     public slots:
       
    60     
       
    61         void handleRequest();
       
    62     
       
    63     private slots:
       
    64     
       
    65         void handleDisconnect();
       
    66     
       
    67     private:
       
    68     
       
    69         void doCancelRequest();
       
    70     
       
    71         signals:
       
    72     
       
    73         void disconnected(ServiceIPCSession* aSession);
       
    74     
       
    75     private:
       
    76         QLocalSocket* m_socket;
       
    77     };
       
    78 
       
    79 }
       
    80 
       
    81 #endif // serviceipclocalsocketsession_h