|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the GNU Lesser General Public License as published by |
|
7 * the Free Software Foundation, version 2.1 of the License. |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU Lesser General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU Lesser General Public License |
|
15 * along with this program. If not, |
|
16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". |
|
17 * |
|
18 * Description: Service Framework IPC Server |
|
19 * |
|
20 */ |
|
21 |
|
22 #include "xqservicelog.h" |
|
23 |
|
24 #include "xqserviceipcserver.h" |
|
25 #include "xqserviceipcserver_p.h" |
|
26 #include "xqserviceipcserverfactory.h" |
|
27 #include "xqserviceipcobserver.h" |
|
28 |
|
29 namespace QtService |
|
30 { |
|
31 /*! |
|
32 \class ServiceFwIPCServer |
|
33 \brief Service Framework IPC Server public class |
|
34 */ |
|
35 |
|
36 /*! |
|
37 Constructor. |
|
38 \param aObserver Engine observer to call back to handle new requests. |
|
39 \param aParent QObject's parent. |
|
40 \param aBackend Backend to instantiate. |
|
41 */ |
|
42 ServiceFwIPCServer::ServiceFwIPCServer( MServiceIPCObserver* aObserver, |
|
43 QObject* aParent, |
|
44 TServiceIPCBackends aBackend ) : |
|
45 QObject(aParent ), |
|
46 iObserver( aObserver ) |
|
47 { |
|
48 XQSERVICE_DEBUG_PRINT("ServiceFwIPCServer::ServiceFwIPCServer"); |
|
49 XQSERVICE_DEBUG_PRINT("aBackend: %d", aBackend); |
|
50 d = ServiceFwIPCServerFactory::createBackend( aParent,aBackend ); |
|
51 d->q = this; |
|
52 } |
|
53 |
|
54 /*! |
|
55 Destructor. |
|
56 */ |
|
57 ServiceFwIPCServer::~ServiceFwIPCServer() |
|
58 { |
|
59 XQSERVICE_DEBUG_PRINT("ServiceFwIPCServer::~ServiceFwIPCServer"); |
|
60 delete d; |
|
61 } |
|
62 |
|
63 /*! |
|
64 Start listening for new service requests. |
|
65 \param aServerName Name of the server. |
|
66 \return true if connected. |
|
67 */ |
|
68 bool ServiceFwIPCServer::listen(const QString& aServerName) |
|
69 { |
|
70 XQSERVICE_DEBUG_PRINT("aServerName: %s", qPrintable(aServerName)); |
|
71 XQSERVICE_DEBUG_PRINT("ServiceFwIPCServer::listen"); |
|
72 return d->listen(aServerName); |
|
73 } |
|
74 |
|
75 /*! |
|
76 Shutdown the server and stop serving clients. |
|
77 */ |
|
78 void ServiceFwIPCServer::disconnect() |
|
79 { |
|
80 XQSERVICE_DEBUG_PRINT("ServiceFwIPCServer::disconnect"); |
|
81 d->disconnect(); |
|
82 } |
|
83 } |
|
84 // END OF FILE |