sdkcreationmw/sdkruntimes/AsyStub/src/AsyStubObserver.cpp
author Shabe Razvi <shaber@symbian.org>
Thu, 04 Nov 2010 17:22:05 +0000
changeset 4 b3b823debf08
parent 0 b26acd06ea60
permissions -rw-r--r--
Workaround for Bug 3917 - CWinsockInterface::DataSent calls NotifyDataSent which is not implemented.

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: 
*
*/
// INCLUDE FILES
#include "TfAccessoryTestControlTypes.h"
#include "AsyStubObserver.h" 

// ----------------------------------------------------------------------------------
// CASYStubObserver* CASYStubObserver::NewL()
// ----------------------------------------------------------------------------------	

CASYStubObserver* CASYStubObserver::NewL(CASYStubService& aService)
    {
    CASYStubObserver* result = new (ELeave) CASYStubObserver(aService);
    CleanupStack::PushL(result);	
    CleanupStack::Pop();
    return result;	
    }

// ----------------------------------------------------------------------------------
// CASYStubObserver::CASYStubObserver() 
// ----------------------------------------------------------------------------------	
CASYStubObserver::CASYStubObserver(CASYStubService& aService) 
: CActive( CActive::EPriorityStandard ),iService(&aService)
	{						
	TInt retval(KErrNone);
	retval = RProperty::Define(KTFAccessoryTestProperty, KTFAccessoryMethod, RProperty::EByteArray);    
    if(retval != KErrAlreadyExists)
    	User::LeaveIfError(retval);       
    
    retval =  iSubscribe.Attach(KTFAccessoryTestProperty, KTFAccessoryMethod);
    User::LeaveIfError(retval);       
    
	CActiveScheduler::Add( this );		    		     	
	}
//
// ----------------------------------------------------------------------------------
// CASYStubObserver::~CASYStubObserver()
// ----------------------------------------------------------------------------------	
CASYStubObserver::~CASYStubObserver()
	{				
	}
//
// ----------------------------------------------------------------------------------
// CASYStubObserver::RunL()
// ----------------------------------------------------------------------------------
void CASYStubObserver::RunL()
    {                      
	TInt retval(KErrNone);	
    TPckgBuf< TTFAccessoryPublishAndSubscribe > buf;
	retval = iSubscribe.Get( KTFAccessoryTestProperty, KTFAccessoryMethod, buf );	
	User::LeaveIfError(retval);			
	
	iService->Service( buf().iMethod,
	                   buf().iParam1 );	
	if(!IsActive())
		{
		iStatus = KRequestPending;
		iSubscribe.Subscribe(iStatus);		
		SetActive();		
		}	
    }        
//
// ----------------------------------------------------------------------------------
// CASYStubObserver::DoCancel()
// ----------------------------------------------------------------------------------
void CASYStubObserver::DoCancel()
    {
    }    

//
// ----------------------------------------------------------------------------------
// CASYStubObserver::DoCancel()
// ----------------------------------------------------------------------------------    
TInt CASYStubObserver::RunError( TInt aError )
    {
    TInt errorCode(KErrNone);
    errorCode=aError;
    return errorCode;
    }
//
// ----------------------------------------------------------------------------------
// CASYStubObserver::IssueRequest
// ----------------------------------------------------------------------------------  
void CASYStubObserver::IssueRequest() 			  
    {
    if(!IsActive())
        {
        iStatus = KRequestPending;
        iSubscribe.Subscribe(iStatus);		
        SetActive();		
        }
    }