messagingfw/suplsmshandler/test/connstarter/src/Te_LbsSuplConnStarter.cpp
changeset 62 db3f5fa34ec7
parent 0 8e480a14352b
equal deleted inserted replaced
60:9f5ae1728557 62:db3f5fa34ec7
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // The SUPL Ethernet Connection Starter plug-in class. 
       
    15 // 
       
    16 //
       
    17 
       
    18 #include <ecom/implementationproxy.h>
       
    19 
       
    20 #include "Te_LbsSuplConnStarter.h"
       
    21 
       
    22 const TImplementationProxy ImplementationTable[] = 
       
    23 	{
       
    24 	IMPLEMENTATION_PROXY_ENTRY(0x10283762, CTe_LbsSuplConnStarter::NewL)
       
    25 	};
       
    26 
       
    27 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
       
    28 	{
       
    29 	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
       
    30 	return ImplementationTable;
       
    31 	}
       
    32 
       
    33 
       
    34 CTe_LbsSuplConnStarter* CTe_LbsSuplConnStarter::NewL(TAny* /*aWatcherParams*/)
       
    35 	{
       
    36 	CTe_LbsSuplConnStarter* self= new (ELeave) CTe_LbsSuplConnStarter();
       
    37 	CleanupStack::PushL(self);
       
    38 	self->ConstructL();
       
    39 	CleanupStack::Pop();
       
    40 	return self;
       
    41 	}
       
    42 	
       
    43 CTe_LbsSuplConnStarter::~CTe_LbsSuplConnStarter()
       
    44 	{
       
    45 	Cancel();
       
    46 	iConnection.Close();
       
    47 	iSocketServ.Close();
       
    48 	}
       
    49 	
       
    50 CTe_LbsSuplConnStarter::CTe_LbsSuplConnStarter() : CActive(EPriorityStandard), iState(EDisconnected)
       
    51 	{
       
    52 	CActiveScheduler::Add(this);
       
    53 	}
       
    54 
       
    55 void CTe_LbsSuplConnStarter::ConstructL()
       
    56 	{
       
    57 	User::LeaveIfError(iSocketServ.Connect());
       
    58 	User::LeaveIfError(iConnection.Open(iSocketServ));
       
    59 	
       
    60 	StartConnection();
       
    61 	}
       
    62 
       
    63 void CTe_LbsSuplConnStarter::RunL()
       
    64 	{
       
    65 	__ASSERT_ALWAYS(iState==EConnecting, User::Invariant());
       
    66 	__ASSERT_ALWAYS(iStatus==KErrNone, User::Invariant());
       
    67 	iState = EConnected;
       
    68 	}
       
    69 
       
    70 void CTe_LbsSuplConnStarter::DoCancel()
       
    71 	{
       
    72 	//intentionally left blank here
       
    73 	}
       
    74 
       
    75 void CTe_LbsSuplConnStarter::StartConnection()
       
    76 	{
       
    77 	iConnection.Start(iStatus);
       
    78 	SetActive();
       
    79 	iState = EConnecting;
       
    80 	}
       
    81 
       
    82 
       
    83