upnpframework/upnpcommand/src/upnpcommandcallbackadapter.cpp
author Sampo Huttunen <sampo.huttunen@nokia.com>
Wed, 24 Nov 2010 09:39:46 +0200
branchIOP_Improvements
changeset 45 a6c41ca11adf
parent 38 5360b7ddc251
permissions -rw-r--r--
Updated the SIS package, there was some BC issue with the earlier version. Also updated the platform UID to S^3 version.

/*
* Copyright (c) 2008 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:  Helper for upnp SHOW command
*
*/


// INCLUDE FILES
#include <upnpcommandobserver.h>
#include "upnpcommandcallbackadapter.h"

// --------------------------------------------------------------------------
// CUpnpCommandCallbackAdapter::CUpnpCommandCallbackAdapter
// Constructor
// --------------------------------------------------------------------------
//
CUpnpCommandCallbackAdapter::CUpnpCommandCallbackAdapter(
    MUpnpCommandObserver* aObserver )
    {
    iObserver = aObserver;
    }

// --------------------------------------------------------------------------
// CUpnpCommandCallbackAdapter::~CUpnpCommandCallbackAdapter
// Destructor
// --------------------------------------------------------------------------
//
CUpnpCommandCallbackAdapter::~CUpnpCommandCallbackAdapter()
    {
    }

// --------------------------------------------------------------------------
// CUpnpCommandCallbackAdapter::CommandEvent
// Indicates that the command has been completed.
// --------------------------------------------------------------------------
//
void CUpnpCommandCallbackAdapter::CommandEvent(
    UpnpCommand::TUpnpCommandEvent aEventType,
    TInt aStatusCode )
    {
    // If there is an observer, forward the callback
    if ( iObserver )
        {
        if ( aEventType == UpnpCommand::EEventComplete )
            {
            iObserver->CommandComplete( aStatusCode );
            }
        else if ( aEventType == UpnpCommand::EEventProgress 
                                                        && aStatusCode > 0 )
            {
            // Convert progress events to CommandComplete methods of the observer
            // ONLY if the progress code is a positive value. Therefore it does not
            // get mixed up with real CommandComplete notifications with either
            // KErrNone or an error value.
            iObserver->CommandComplete( aStatusCode );
            }
        else
            {
            // eat the event
            }
        }
    }

// End of File