[Common-dev] CR: Resend new network API implementation for Symbian Part 2 client
Ashish.As.Gupta at nokia.com Ashish.As.Gupta at nokia.com
This is part 2 of the CR, contains client changes.
Thanks
Ashish
-------------- next part --------------
? client/core/Makefile
? client/core/Umakefil.upp
? client/core/clntcore.def
? client/core/clntcore.lnk
? client/core/clntcore.uid.cpp
? client/core/clntcore_dll_stub.c
? client/core/clntcore_ordinal.dat
? client/core/clntcoredll.mak
? client/core/clntcoredll.upp
? client/core/clntcorelib.mak
? client/core/clntcorelib.upp
? client/core/rlink
? client/core/thumb-rel32
Index: client/core/clntcoredll_symbian.pcf
===================================================================
RCS file: /cvsroot/client/core/clntcoredll_symbian.pcf,v
retrieving revision 1.10
diff -u -w -r1.10 clntcoredll_symbian.pcf
--- client/core/clntcoredll_symbian.pcf 13 Apr 2005 21:14:43 -0000 1.10
+++ client/core/clntcoredll_symbian.pcf 5 Aug 2005 19:09:16 -0000
@@ -55,7 +55,11 @@
project.AddSystemLibraries('mediaclientaudiostream.lib')
project.AddSystemLibraries('apmime.lib', 'apgrfx.lib')
project.AddSystemLibraries('charconv.lib')
-project.AddSystemLibraries('intconninit.lib', 'commdb.lib')
+
+if (project.IsDefined('HELIX_FEATURE_NETSERVICES_SHIM')):
+ project.AddSystemLibraries('intconninit.lib')
+
+project.AddSystemLibraries('commdb.lib')
project.AddIncludes('.',
'pub/platform/symbian')
Index: client/core/clntcorelib_symbian.pcf
===================================================================
RCS file: /cvsroot/client/core/clntcorelib_symbian.pcf,v
retrieving revision 1.2
diff -u -w -r1.2 clntcorelib_symbian.pcf
--- client/core/clntcorelib_symbian.pcf 9 Jul 2004 18:42:31 -0000 1.2
+++ client/core/clntcorelib_symbian.pcf 5 Aug 2005 19:09:16 -0000
@@ -50,4 +50,5 @@
#
project.AddIncludes('.')
-
+project.AddModuleIncludes('common/netio/pub/platform/symbian'
+ ,'client/netwksvc/pub/platform/symbian')
Index: client/core/hxcleng.cpp
===================================================================
RCS file: /cvsroot/client/core/hxcleng.cpp,v
retrieving revision 1.86
diff -u -w -r1.86 hxcleng.cpp
--- client/core/hxcleng.cpp 1 Aug 2005 23:27:55 -0000 1.86
+++ client/core/hxcleng.cpp 5 Aug 2005 19:09:16 -0000
@@ -82,6 +82,8 @@
#if defined(HELIX_FEATURE_PLAYBACK_NET)
#if !defined(_SYMBIAN)
#include "chxclientnetservices.h"
+#else
+#include "hxsymbiannet.h" // new netapi
#endif /* _SYMBIAN */
#if defined(HELIX_FEATURE_NETSERVICES_SHIM) || defined(HELIX_FEATURE_NET_LEGACYAPI)
#include "hxnetapi.h" //HXNetworkServices (old net services)
-------------- next part --------------
? client/netwksvc/Makefile
? client/netwksvc/Umakefil.upp
? client/netwksvc/thumb-rel32
? client/netwksvc/platform/symbian/hxsymbianapmanao.cpp
? client/netwksvc/platform/symbian/hxsymbianapmanao.h
Index: client/netwksvc/symbian.pcf
===================================================================
RCS file: /cvsroot/client/netwksvc/symbian.pcf,v
retrieving revision 1.5
diff -u -w -r1.5 symbian.pcf
--- client/netwksvc/symbian.pcf 1 Apr 2005 21:21:19 -0000 1.5
+++ client/netwksvc/symbian.pcf 5 Aug 2005 19:14:07 -0000
@@ -54,6 +54,7 @@
"platform/symbian/hxsymbiantcpsock.cpp",
"platform/symbian/hxsymbianudpsock.cpp",
"platform/symbian/hxsymbiansockhlp.cpp",
+ "platform/symbian/hxsymbianapmanao.cpp",
"platform/symbian/hxsymbianapman.cpp")
if project.IsDefined("__CW32__"):
project.AddIncludes("platform/symbian")
Index: client/netwksvc/platform/symbian/hxsymbianapman.cpp
===================================================================
RCS file: /cvsroot/client/netwksvc/platform/symbian/hxsymbianapman.cpp,v
retrieving revision 1.5
diff -u -w -r1.5 hxsymbianapman.cpp
--- client/netwksvc/platform/symbian/hxsymbianapman.cpp 14 Mar 2005 20:32:07 -0000 1.5
+++ client/netwksvc/platform/symbian/hxsymbianapman.cpp 5 Aug 2005 19:14:08 -0000
@@ -47,7 +47,9 @@
*
* ***** END LICENSE BLOCK ***** */
+
#include "platform/symbian/hxsymbianapman.h"
+#include "hxsymbianapmanao.h"
#include "ihxpckts.h"
#include "debug.h"
@@ -62,143 +64,6 @@
*/
-class HXSymbianAPManAO : public CActive
-{
-public:
- HXSymbianAPManAO(HXSymbianAccessPointManager* pParent,
- CIntConnectionInitiator* pConnInit);
- ~HXSymbianAPManAO();
-
- HX_RESULT Connect(UINT32 ulAccessPointId);
-
- HX_RESULT Disconnect();
-
- void RunL();
- void DoCancel();
-
-private:
- HXSymbianAccessPointManager* m_pParent;
- CIntConnectionInitiator* m_pConnInit;
- CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref m_connPref;
- HXBOOL m_bConnecting;
-};
-
-HXSymbianAPManAO::HXSymbianAPManAO(HXSymbianAccessPointManager* pParent,
- CIntConnectionInitiator* pConnInit) :
- CActive(EPriorityStandard),
- m_pParent(pParent),
- m_pConnInit(pConnInit),
- m_bConnecting(FALSE)
-{
- CActiveScheduler::Add(this);
-}
-
-HXSymbianAPManAO::~HXSymbianAPManAO()
-{
- if (IsActive())
- {
- Cancel();
- }
-
- m_pParent = 0;
- m_pConnInit = 0;
-}
-
-HX_RESULT HXSymbianAPManAO::Connect(UINT32 ulAccessPointId)
-{
- HX_RESULT res = HXR_UNEXPECTED;
-
- if (m_pConnInit && !IsActive())
- {
- TInt theErr = KErrNone;
-
- m_bConnecting = TRUE;
- iStatus = KRequestPending;
-
- m_connPref.iRanking = 1; // Means always try this pref
- m_connPref.iDirection = ECommDbConnectionDirectionOutgoing;
- m_connPref.iDialogPref = ECommDbDialogPrefDoNotPrompt;
- m_connPref.iBearer.iBearerSet = (ECommDbBearerGPRS | ECommDbBearerCSD);
- m_connPref.iBearer.iIapId = ulAccessPointId;
-
- TRAP(theErr, m_pConnInit->ConnectL(m_connPref, iStatus));
-
- if (KErrNone == theErr)
- {
- SetActive();
- res = HXR_OK;
- }
- else
- {
- res = HXR_NET_CONNECT;
- }
- }
-
- return res;
-}
-
-HX_RESULT HXSymbianAPManAO::Disconnect()
-{
- HX_RESULT res = HXR_FAILED;
-
- if (m_pConnInit && !IsActive())
- {
- m_bConnecting = FALSE;
- iStatus = KRequestPending;
-
- if (KErrNone == m_pConnInit->TerminateActiveConnection(iStatus))
- {
- SetActive();
- res = HXR_OK;
- }
- }
-
- return res;
-}
-
-void HXSymbianAPManAO::RunL()
-{
- if (m_pParent)
- {
- HX_RESULT status = HXR_NET_CONNECT;
-
- if (m_bConnecting)
- {
- if ((iStatus == KErrNone) ||
- (iStatus == KConnectionPref1Exists) ||
- (iStatus == KConnectionExists) ||
- (iStatus == KConnectionPref1Created) ||
- (iStatus == KConnectionCreated) ||
- (iStatus == KErrOutstandingRequest))
- {
- status = HXR_OK;
- }
-
- m_pParent->ConnectDone(status);
- }
- else
- {
- if ((iStatus == KErrNone) ||
- (iStatus == KConnectionTerminated) ||
- (iStatus == KErrOutstandingRequest))
- {
- status = HXR_OK;
- }
-
- m_pParent->DisconnectDone(status);
- }
- }
-}
-
-void HXSymbianAPManAO::DoCancel()
-{
- // Cancel possible outstanding request
- if(m_pConnInit && m_pConnInit->IsActive())
- {
- m_pConnInit->Cancel();
- }
-}
-
BEGIN_INTERFACE_LIST(HXSymbianAccessPointManager)
INTERFACE_LIST_ENTRY_SIMPLE(IHXAccessPointManager)
INTERFACE_LIST_ENTRY_SIMPLE(IHXAccessPointSelectorResponse)
@@ -206,12 +71,12 @@
HXSymbianAccessPointManager::HXSymbianAccessPointManager():
m_state(apError),
- m_pConnInit(0),
m_pConnector(0),
m_pPreferredInfo(NULL),
m_pCCF(NULL),
m_pAPSelector(NULL),
- m_bSelectAPPending(FALSE)
+ m_bSelectAPPending(FALSE),
+ m_bInitialized(FALSE)
{
#ifdef _DEBUG
debug_level() |= D_AP_MANAGER;
@@ -219,36 +84,22 @@
DPRINTF(D_AP_MANAGER, ("HXSymbianAccessPointManager::HXSymbianAccessPointManager()\n"));
- TRAPD(theErr, m_pConnInit = CIntConnectionInitiator::NewL());
-
- m_pConnector = new HXSymbianAPManAO(this, m_pConnInit);
-
- if (m_pConnInit && m_pConnector &&
- (KErrNone == m_sockServ.Connect()) &&
- (KErrNone == theErr))
- {
- m_state = apIdle;
- }
}
HXSymbianAccessPointManager::~HXSymbianAccessPointManager()
{
DPRINTF(D_AP_MANAGER, ("HXSymbianAccessPointManager::~HXSymbianAccessPointManager()\n"));
- HX_DELETE(m_pConnector);
- HX_DELETE(m_pConnInit);
-
+ DoClose();
HX_RELEASE(m_pPreferredInfo);
HX_RELEASE(m_pCCF);
HX_RELEASE(m_pAPSelector);
- m_sockServ.Close();
-
DispatchConnectDones(HXR_FAILED);
}
+
/*
* IHXAccessPointManager methods
*/
-
/************************************************************************
* Method:
* IHXAccessPointManager::Connect
@@ -467,7 +318,8 @@
return res;
}
-void HXSymbianAccessPointManager::SetContext(IUnknown* pContext)
+void
+HXSymbianAccessPointManager::SetContext(IUnknown* pContext)
{
if (pContext)
{
@@ -475,6 +327,60 @@
}
}
+/*
+Initialize RConnection, SocketServ.
+This should be done before any network connection starts.
+*/
+
+HX_RESULT
+HXSymbianAccessPointManager::DoInit()
+{
+ HX_RESULT hxr=HXR_OK;
+ if(!m_bInitialized)
+ {
+ m_pConnector = new HXSymbianApManAO(this);
+
+ if (m_pConnector == NULL)
+ {
+ hxr = HXR_OUTOFMEMORY;
+ }
+ else if(m_sockServ.Connect() != KErrNone)
+ {
+ HX_DELETE(m_pConnector);
+ hxr = HXR_FAILED;
+ }
+ else if(m_rconn.Open(m_sockServ) != KErrNone)
+ {
+ HX_DELETE(m_pConnector);
+ m_sockServ.Close();
+ hxr = HXR_FAILED;
+ }
+ else
+ {
+ m_state = apIdle;
+ m_bInitialized = TRUE;
+ }
+ }
+ return hxr;
+}
+
+/*
+de-initialization.
+*/
+
+HX_RESULT
+HXSymbianAccessPointManager::DoClose()
+{
+ if(m_bInitialized)
+ {
+ HX_DELETE(m_pConnector);
+ m_rconn.Close();
+ m_sockServ.Close();
+ m_bInitialized = FALSE;
+ }
+ return HXR_OK;
+}
+
HX_RESULT
HXSymbianAccessPointManager::DoConnect(IHXAccessPointConnectResponse* pResp)
{
@@ -488,6 +394,19 @@
HXBOOL bQueueResponse = (pResp) ? TRUE : FALSE;
+ // make sure that RConnection, RSocketServ are ready for the connection.
+ if(DoInit() != HXR_OK)
+ {
+ if (pResp)
+ {
+ pResp->ConnectDone(res);
+ }
+ m_state = apIdle;
+ DispatchConnectDones(res);
+ return res;
+ }
+
+
if (HXR_OK == GetPreferredID(ulPreferredId))
{
// We have a preferred access point set
@@ -577,7 +496,8 @@
return res;
}
-HX_RESULT HXSymbianAccessPointManager::StartConnection()
+HX_RESULT
+HXSymbianAccessPointManager::StartConnection()
{
DPRINTF(D_AP_MANAGER, ("HXSymbianAccessPointManager::StartConnection()\n"));
@@ -616,7 +536,8 @@
return res;
}
-void HXSymbianAccessPointManager::ConnectDone(HX_RESULT status)
+void
+HXSymbianAccessPointManager::ConnectDone(HX_RESULT status)
{
DPRINTF(D_AP_MANAGER,
("HXSymbianAccessPointManager::ConnectDone(%08x)\n",
@@ -660,27 +581,24 @@
}
}
-HX_RESULT HXSymbianAccessPointManager::StartDisconnect()
+HX_RESULT
+HXSymbianAccessPointManager::StartDisconnect()
{
DPRINTF(D_AP_MANAGER, ("HXSymbianAccessPointManager::StartDisconnect()\n"));
- HX_RESULT res = HXR_FAILED;
+ HX_RESULT res = HXR_OK;
- if (HXR_OK == m_pConnector->Disconnect())
- {
m_state = apDisconnecting;
- res = HXR_OK;
- }
-
+ m_pConnector->Disconnect();
DPRINTF(D_AP_MANAGER,
("HXSymbianAccessPointManager::StartDisconnect() : res %08x\n",
res));
return res;
-
}
-void HXSymbianAccessPointManager::DisconnectDone(HX_RESULT status)
+void
+HXSymbianAccessPointManager::DisconnectDone(HX_RESULT status)
{
DPRINTF(D_AP_MANAGER,
("HXSymbianAccessPointManager::DisconnectDone(%08x)\n",
@@ -688,6 +606,7 @@
HX_ASSERT(apDisconnecting == m_state);
+ DoClose();
m_state = apIdle;
if (HXR_OK == status)
@@ -704,7 +623,8 @@
}
}
-void HXSymbianAccessPointManager::DispatchConnectDones(HX_RESULT status)
+void
+HXSymbianAccessPointManager::DispatchConnectDones(HX_RESULT status)
{
DPRINTF(D_AP_MANAGER,
("HXSymbianAccessPointManager::DispatchConnectDones(%08x)\n",
@@ -721,7 +641,8 @@
}
}
-HX_RESULT HXSymbianAccessPointManager::GetPreferredID(REF(ULONG32) ulID)
+HX_RESULT
+HXSymbianAccessPointManager::GetPreferredID(REF(ULONG32) ulID)
{
HX_RESULT res = HXR_FAILED;
@@ -733,16 +654,30 @@
return res;
}
-HX_RESULT HXSymbianAccessPointManager::GetActiveID(REF(ULONG32) ulID)
+HX_RESULT
+HXSymbianAccessPointManager::GetActiveID(REF(ULONG32) ulID)
{
HX_RESULT res = HXR_FAILED;
-
- TUint32 aIAPId = 0;
- if (m_pConnInit && (KErrNone == m_pConnInit->GetActiveIap(aIAPId)))
+ TUint32 iapId = 0;
+ if ( (m_state != apError) && m_state == apConnected &&
+ (m_rconn.GetIntSetting(_L("IAP\\Id"), iapId) == KErrNone)
+ )
{
- ulID = aIAPId;
+ ulID = iapId;
res = HXR_OK;
}
-
return res;
}
+
+RConnection&
+HXSymbianAccessPointManager::GetRConnection()
+{
+ return m_rconn;
+}
+
+RSocketServ&
+HXSymbianAccessPointManager::GetRSocketServ()
+{
+ return m_sockServ;
+}
+
Index: client/netwksvc/pub/platform/symbian/hxsymbianapman.h
===================================================================
RCS file: /cvsroot/client/netwksvc/pub/platform/symbian/hxsymbianapman.h,v
retrieving revision 1.4
diff -u -w -r1.4 hxsymbianapman.h
--- client/netwksvc/pub/platform/symbian/hxsymbianapman.h 14 Mar 2005 20:32:08 -0000 1.4
+++ client/netwksvc/pub/platform/symbian/hxsymbianapman.h 5 Aug 2005 19:14:08 -0000
@@ -55,7 +55,9 @@
#include "hxslist.h"
#include "hxccf.h"
-#include <intconninit.h>
+#include <es_sock.h>
+
+class HXSymbianApManAO;
class HXSymbianAPConnector;
@@ -143,8 +145,16 @@
void SetContext(IUnknown* pContext);
+
+ /************************************************************************
+ * It is required to Connect to access point before using GetRConnection
+ * and GetRSocketServ.
+ ************************************************************************/
+ RConnection& GetRConnection();
+ RSocketServ& GetRSocketServ();
+
protected:
- friend class HXSymbianAPManAO;
+ friend class HXSymbianApManAO;
void ConnectDone(HX_RESULT status);
void DisconnectDone(HX_RESULT status);
@@ -155,8 +165,10 @@
void DispatchConnectDones(HX_RESULT status);
- HX_RESULT DoConnect(IHXAccessPointConnectResponse* pResp);
+ HX_RESULT DoInit();
+ HX_RESULT DoClose();
+ HX_RESULT DoConnect(IHXAccessPointConnectResponse* pResp);
HX_RESULT StartConnection();
HX_RESULT StartDisconnect();
@@ -170,13 +182,15 @@
APState m_state;
RSocketServ m_sockServ;
- CIntConnectionInitiator* m_pConnInit;
- HXSymbianAPManAO* m_pConnector;
+ RConnection m_rconn;
+
+ HXSymbianApManAO* m_pConnector;
UINT32 m_ulRetryCount;
IHXValues* m_pPreferredInfo;
IHXCommonClassFactory* m_pCCF;
IHXAccessPointSelector* m_pAPSelector;
HXBOOL m_bSelectAPPending;
+ HXBOOL m_bInitialized;
};
#endif /* HXSYMBIANAPMAN_H */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: client.tar.gz
Type: application/x-gzip
Size: 26875 bytes
Desc: client.tar.gz
Url : http://lists.helixcommunity.org/pipermail/common-dev/attachments/20050816/e2e2a16e/client.tar-0001.gz