upnpframework/upnpcommand/src/upnpcommandcallbackadapter.cpp
changeset 0 7f85d04be362
child 38 5360b7ddc251
equal deleted inserted replaced
-1:000000000000 0:7f85d04be362
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Helper for upnp SHOW command
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <upnpcommandobserver.h>
       
    21 #include "upnpcommandcallbackadapter.h"
       
    22 
       
    23 // --------------------------------------------------------------------------
       
    24 // CUpnpCommandCallbackAdapter::CUpnpCommandCallbackAdapter
       
    25 // Constructor
       
    26 // --------------------------------------------------------------------------
       
    27 //
       
    28 CUpnpCommandCallbackAdapter::CUpnpCommandCallbackAdapter(
       
    29     MUpnpCommandObserver* aObserver )
       
    30     {
       
    31     iObserver = aObserver;
       
    32     }
       
    33 
       
    34 // --------------------------------------------------------------------------
       
    35 // CUpnpCommandCallbackAdapter::~CUpnpCommandCallbackAdapter
       
    36 // Destructor
       
    37 // --------------------------------------------------------------------------
       
    38 //
       
    39 CUpnpCommandCallbackAdapter::~CUpnpCommandCallbackAdapter()
       
    40     {
       
    41     }
       
    42 
       
    43 // --------------------------------------------------------------------------
       
    44 // CUpnpCommandCallbackAdapter::CommandEvent
       
    45 // Indicates that the command has been completed.
       
    46 // --------------------------------------------------------------------------
       
    47 //
       
    48 void CUpnpCommandCallbackAdapter::CommandEvent(
       
    49     UpnpCommand::TUpnpCommandEvent aEventType,
       
    50     TInt aStatusCode )
       
    51     {
       
    52     // If there is an observer, forward the callback
       
    53     if ( iObserver )
       
    54         {
       
    55         if ( aEventType == UpnpCommand::EEventComplete )
       
    56             {
       
    57             iObserver->CommandComplete( aStatusCode );
       
    58             }
       
    59         else if ( aEventType == UpnpCommand::EEventProgress && aStatusCode > 0 )
       
    60             {
       
    61             // Convert progress events to CommandComplete methods of the observer
       
    62             // ONLY if the progress code is a positive value. Therefore it does not
       
    63             // get mixed up with real CommandComplete notifications with either
       
    64             // KErrNone or an error value.
       
    65             iObserver->CommandComplete( aStatusCode );
       
    66             }
       
    67         else
       
    68             {
       
    69             // eat the event
       
    70             }
       
    71         }
       
    72     }
       
    73 
       
    74 // End of File