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