21 |
21 |
22 #include "xqservicelog.h" |
22 #include "xqservicelog.h" |
23 |
23 |
24 #include "xqserviceipcserver_apasymbianserver.h" |
24 #include "xqserviceipcserver_apasymbianserver.h" |
25 #include "xqserviceipcserver_apasymbiansession.h" |
25 #include "xqserviceipcserver_apasymbiansession.h" |
|
26 |
|
27 #include <xqserviceutil.h> |
|
28 #include <xqpublishandsubscribeutils.h> |
|
29 #include <xqsettingskey.h> |
|
30 #include <xqapplicationmanager.h> |
26 |
31 |
27 namespace QtService |
32 namespace QtService |
28 { |
33 { |
29 // Server Security Policy |
34 // Server Security Policy |
30 const TUint KServerRangeCount = 2; |
35 const TUint KServerRangeCount = 2; |
112 TInt err=0; |
120 TInt err=0; |
113 TRAP( err, StartL(serverName) ); |
121 TRAP( err, StartL(serverName) ); |
114 XQSERVICE_DEBUG_PRINT("listen status=%d", err); |
122 XQSERVICE_DEBUG_PRINT("listen status=%d", err); |
115 if (err != KErrNone) { |
123 if (err != KErrNone) { |
116 listening = false; |
124 listening = false; |
117 } |
125 } else { |
|
126 QString normalizedServerName = aServerName.toLower(); |
|
127 quint32 id = XQServiceUtil::serviceIdFromName(normalizedServerName.toLatin1().data()); |
|
128 |
|
129 delete stateNotifyKey; |
|
130 |
|
131 RProcess currentProcess; |
|
132 const TSecureId secureId = currentProcess.SecureId(); |
|
133 |
|
134 stateNotifyKey = new XQPublishAndSubscribeSettingsKey(secureId.iId, id); |
|
135 |
|
136 XQPublishAndSubscribeUtils utils(settingsManager); |
|
137 if (!utils.defineProperty(*stateNotifyKey, XQSettingsManager::TypeInt) && (settingsManager.error() != XQSettingsManager::AlreadyExistsError)) { |
|
138 XQSERVICE_WARNING_PRINT("CApaSymbianServer::listen: property for service UID:%s could not be created. Notifications may not work.", stateNotifyKey->uid()); |
|
139 } else { |
|
140 settingsManager.writeItemValue(*stateNotifyKey, static_cast<int>(XQApplicationManager::ServiceStarted)); |
|
141 } |
|
142 } |
118 // Complete the server rendezvous that th client started |
143 // Complete the server rendezvous that th client started |
119 XQSERVICE_DEBUG_PRINT("CApaSymbianServer::Rendezvouz"); |
144 XQSERVICE_DEBUG_PRINT("CApaSymbianServer::Rendezvouz"); |
120 RProcess::Rendezvous(KErrNone); |
145 RProcess::Rendezvous(KErrNone); |
121 XQSERVICE_DEBUG_PRINT("CApaSymbianServer::Rendezvouz done"); |
146 XQSERVICE_DEBUG_PRINT("CApaSymbianServer::Rendezvouz done"); |
122 XQSERVICE_DEBUG_PRINT("listening: %d", listening); |
147 XQSERVICE_DEBUG_PRINT("listening: %d", listening); |
129 void CApaSymbianServer::disconnect() |
154 void CApaSymbianServer::disconnect() |
130 { |
155 { |
131 XQSERVICE_DEBUG_PRINT("CApaSymbianServer::disconnect"); |
156 XQSERVICE_DEBUG_PRINT("CApaSymbianServer::disconnect"); |
132 // Symbian Servers do not have disconnect, |
157 // Symbian Servers do not have disconnect, |
133 // the process has to exit |
158 // the process has to exit |
|
159 |
|
160 if (stateNotifyKey != 0) { |
|
161 settingsManager.writeItemValue(*stateNotifyKey, QVariant(XQApplicationManager::ServiceStopped)); |
|
162 } |
|
163 |
|
164 delete stateNotifyKey; |
|
165 stateNotifyKey = 0; |
134 } |
166 } |
135 |
167 |
136 /*! |
168 /*! |
137 Create a new session, derived from CPolicyServer. |
169 Create a new session, derived from CPolicyServer. |
138 \param aVersion Version of the server. |
170 \param aVersion Version of the server. |