qthighway/xqserviceipc/xqserviceipcserver/xqserviceipcserver.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 03 May 2010 13:18:40 +0300
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 24 9d760f716ca8
permissions -rw-r--r--
Revision: 201015 Kit: 201018

/*
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 2.1 of the License.
* 
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program.  If not, 
* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
*
* Description:  Service Framework IPC Server
*
*/

#include "xqservicelog.h"

#include "xqserviceipcserver.h"
#include "xqserviceipcserver_p.h"
#include "xqserviceipcserverfactory.h"
#include "xqserviceipcobserver.h"

namespace QtService
{
/*!
 \class ServiceFwIPCServer
 Service Framework IPC Server public class
 */

/*!
    Constructor
    @param aBackend backend to instantiate
    @param aObserver engine observer to call back to handle new requests
    @param aParent QObject's parent
*/
ServiceFwIPCServer::ServiceFwIPCServer( MServiceIPCObserver* aObserver, 
                                        QObject* aParent, 
                                        TServiceIPCBackends aBackend ) :
                                        QObject(aParent ),
                                        iObserver( aObserver )
{
    XQSERVICE_DEBUG_PRINT("ServiceFwIPCServer::ServiceFwIPCServer");
    XQSERVICE_DEBUG_PRINT("aBackend: %d", aBackend);
    d = ServiceFwIPCServerFactory::createBackend( aParent,aBackend );
    d->q = this;
}

/*!
 Destructor
 */
ServiceFwIPCServer::~ServiceFwIPCServer()
{
    XQSERVICE_DEBUG_PRINT("ServiceFwIPCServer::~ServiceFwIPCServer");
    delete d;
}

/*!
 Start listening for new service requests
 @param aServerName name of the server
 @return bool if connected
 */
bool ServiceFwIPCServer::listen(const QString& aServerName)
{
    XQSERVICE_DEBUG_PRINT("aServerName: %s", qPrintable(aServerName));
    XQSERVICE_DEBUG_PRINT("ServiceFwIPCServer::listen");
    return d->listen(aServerName);
}

/*!
 Shutdown the server and stop serving clients 
 @return void
 */
void ServiceFwIPCServer::disconnect()
{
    XQSERVICE_DEBUG_PRINT("ServiceFwIPCServer::disconnect");
    d->disconnect();
}
}
// END OF FILE