| author | cgandhi |
| Thu, 05 Aug 2010 16:51:04 +0530 | |
| changeset 19 | c412f0526c34 |
| parent 18 | 013a02bf2bb0 |
| permissions | -rw-r--r-- |
| 10 | 1 |
/** |
2 |
* Copyright (c) 2010 Sasken Communication Technologies Ltd. |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of the "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 |
* Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* Manasij Roy, Nalina Hariharan |
|
|
13
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
14 |
* Description: |
|
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
15 |
* SMF Server implementation for platforms other than Symbian. |
|
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
16 |
* Uses QLocalServer-QLocalSocket classes |
|
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
17 |
* |
|
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
18 |
*/ |
| 10 | 19 |
|
| 18 | 20 |
#include <QLocalServer> |
21 |
#include <QLocalSocket> |
|
22 |
||
| 10 | 23 |
#include "smfserverqt_p.h" |
|
13
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
24 |
#include "smfserverqtsession.h" |
|
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
25 |
#include "smfserver.h" |
| 10 | 26 |
|
27 |
||
|
13
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
28 |
SmfServerQt::SmfServerQt(SmfServer *wrapper) |
|
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
29 |
: m_generic(wrapper) |
| 18 | 30 |
{
|
|
13
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
31 |
m_server = new QLocalServer(this); |
|
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
32 |
connect(m_server, SIGNAL(newConnection()), this, SLOT(newClientConnected())); |
| 18 | 33 |
} |
| 10 | 34 |
|
35 |
SmfServerQt::~SmfServerQt() |
|
| 18 | 36 |
{
|
|
13
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
37 |
m_server->close(); |
| 18 | 38 |
} |
| 10 | 39 |
|
|
13
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
40 |
/** |
|
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
41 |
* Start the server listening for connections. |
|
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
42 |
*/ |
| 10 | 43 |
bool SmfServerQt::start() |
| 18 | 44 |
{
|
|
13
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
45 |
const QString KServerName("SmfServerQt");
|
|
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
46 |
if (m_server->listen(KServerName)) |
| 18 | 47 |
{
|
|
14
a469c0e6e7fb
changes for SmfPost, SmfCredentialMgr, PLuginManager, SmfServer. Adding Sample Plugins and Sample Client Applications.
cgandhi <chandradeep.gandhi@sasken.com>
parents:
13
diff
changeset
|
48 |
qDebug()<<(QString(m_server->serverName() + ": listening for connections.")); |
|
13
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
49 |
return true; |
| 18 | 50 |
} |
|
13
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
51 |
else |
| 18 | 52 |
{
|
|
14
a469c0e6e7fb
changes for SmfPost, SmfCredentialMgr, PLuginManager, SmfServer. Adding Sample Plugins and Sample Client Applications.
cgandhi <chandradeep.gandhi@sasken.com>
parents:
13
diff
changeset
|
53 |
qDebug()<<(QString(KServerName + ": failed to start")); |
|
a469c0e6e7fb
changes for SmfPost, SmfCredentialMgr, PLuginManager, SmfServer. Adding Sample Plugins and Sample Client Applications.
cgandhi <chandradeep.gandhi@sasken.com>
parents:
13
diff
changeset
|
54 |
qDebug()<<(QString(m_server->errorString())); |
|
13
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
55 |
return false; |
| 18 | 56 |
} |
57 |
} |
|
| 10 | 58 |
|
|
13
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
59 |
/** |
|
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
60 |
* Return the number of open sessions |
|
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
61 |
*/ |
| 10 | 62 |
int SmfServerQt::sessionListCount() const |
| 18 | 63 |
{
|
|
13
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
64 |
return m_sessions.count(); |
| 18 | 65 |
} |
| 10 | 66 |
|
67 |
/** |
|
68 |
* Called by the SmfServer when client authorization finishes. |
|
69 |
* @param success success of the authorization |
|
70 |
*/ |
|
71 |
void SmfServerQt::clientAuthorizationFinished(bool success) |
|
| 18 | 72 |
{
|
| 10 | 73 |
Q_UNUSED(success); |
| 18 | 74 |
} |
| 10 | 75 |
|
|
13
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
76 |
/** |
|
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
77 |
* Slot to receive incoming connections |
|
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
78 |
*/ |
| 10 | 79 |
void SmfServerQt::newClientConnected() |
| 18 | 80 |
{
|
|
13
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
81 |
QLocalSocket *client(m_server->nextPendingConnection()); |
|
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
82 |
if (!client) |
| 18 | 83 |
{
|
84 |
qDebug()<<"SmfServerQt::newClientConnected(): no socket - client may have dropped."; |
|
|
13
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
85 |
return; |
| 18 | 86 |
} |
|
13
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
87 |
|
|
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
88 |
// Create a new session for this client. |
| 18 | 89 |
qDebug()<<"Client connected."; |
|
13
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
90 |
|
|
b5d63d5fc252
Basic functionality on desktop server build. Started a test for GetServices
James Aley <jamesa@symbian.org>
parents:
10
diff
changeset
|
91 |
m_sessions.append(new SmfServerQtSession(client, this)); |
| 18 | 92 |
} |
| 10 | 93 |
|
94 |
void SmfServerQt::removeFromList() |
|
| 18 | 95 |
{
|
96 |
} |
|
| 10 | 97 |
|
98 |
int SmfServerQt::findAndServiceclient(int requestID,QByteArray* parsedData,SmfError error) |
|
| 18 | 99 |
{
|
| 10 | 100 |
Q_UNUSED(requestID); |
101 |
Q_UNUSED(parsedData); |
|
102 |
Q_UNUSED(error); |
|
103 |
return 0; |
|
| 18 | 104 |
} |
| 10 | 105 |