servicediscoveryandcontrol/pnp/test/testplugin/src/ctestpnpservicepublisher.cpp
changeset 0 f5a58ecadc66
equal deleted inserted replaced
-1:000000000000 0:f5a58ecadc66
       
     1 // Copyright (c) 2008-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 // ctestpnpservicepublisherimpl.cpp
       
    15 // 
       
    16 //
       
    17 
       
    18 
       
    19 #include "ctestpnpservicepublisherimpl.h"
       
    20 #include "ctestcontrolchannel.h"
       
    21 
       
    22 
       
    23 
       
    24 CTestPnPServicePublisherImpl::CTestPnPServicePublisherImpl ()
       
    25 	{
       
    26 	}
       
    27 
       
    28 	
       
    29 CTestPnPServicePublisherImpl* CTestPnPServicePublisherImpl::NewL()
       
    30 	{
       
    31 	return new ( ELeave ) CTestPnPServicePublisherImpl;
       
    32 	}
       
    33 	
       
    34 CTestPnPServicePublisherImpl::~CTestPnPServicePublisherImpl ()
       
    35 	{
       
    36 	}
       
    37 
       
    38 
       
    39 TInt CTestPnPServicePublisherImpl::Construct(TUint)
       
    40 	{
       
    41 	return KErrNone;
       
    42 	}
       
    43 
       
    44 
       
    45 void CTestPnPServicePublisherImpl::Publish ( const RPnPParameterBundle& aServiceInfo )
       
    46 	{
       
    47 	TRAPD(err, PublishL( aServiceInfo ));
       
    48 	if(err != KErrNone )
       
    49 		aServiceInfo.PnPObserver()->OnPnPError(err);
       
    50 	}
       
    51 
       
    52 void CTestPnPServicePublisherImpl::PublishL ( const RPnPParameterBundle& aServiceInfo )
       
    53 	{
       
    54 	RPnPParameterBundle pnpBundle;
       
    55 	pnpBundle.Open ();
       
    56 	CleanupClosePushL( pnpBundle );
       
    57 	RParameterFamily pnpFamily = pnpBundle.CreateFamilyL (ETestPnPPublishResponseParamSet);
       
    58 	aServiceInfo.PnPObserver()->OnPnPEventL( pnpBundle );
       
    59 	CleanupStack::PopAndDestroy(&pnpBundle);
       
    60 	}
       
    61 
       
    62 
       
    63 void CTestPnPServicePublisherImpl::SendNotify ( const RPnPParameterBundle& aServiceInfo )
       
    64 	{
       
    65 	TRAPD( err, SendNotifyL( aServiceInfo ));
       
    66 	if ( err != KErrNone )
       
    67 		aServiceInfo.PnPObserver()->OnPnPError(err);
       
    68 	}
       
    69 	
       
    70 	
       
    71 void CTestPnPServicePublisherImpl::SendNotifyL ( const RPnPParameterBundle& /*aServiceInfo*/ )
       
    72 	{
       
    73 	RPnPParameterBundle pnpBundle;
       
    74 	pnpBundle.Open ();
       
    75 	CleanupClosePushL( pnpBundle );
       
    76 	CleanupStack::PopAndDestroy(&pnpBundle);
       
    77 	}
       
    78 	
       
    79 
       
    80 CControlChannelBase* CTestPnPServicePublisherImpl::InitiateControlL ()
       
    81 	{
       
    82 	CTestControlChannel* ctrlChannel = CTestControlChannel::NewL();
       
    83     return  ctrlChannel;
       
    84 	}
       
    85 
       
    86