localconnectivityservice/dun/utils/src/DunDataWaiter.cpp
author hgs
Tue, 28 Sep 2010 20:14:08 +0800
changeset 52 866b4af7ffbe
parent 29 3ae5cb0b4c02
child 54 4dc88a4ac6f4
permissions -rw-r--r--
201039_01
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     1
/*
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     2
* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     3
* All rights reserved.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     8
*
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     9
* Initial Contributors:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    11
*
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    12
* Contributors:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    13
*
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    14
* Description:  Monitors for new data in RComm local media side
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    15
*
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    16
*/
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    17
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    18
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    19
#include "DunTransporter.h"
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    20
#include "DunDataWaiter.h"
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    21
#include "DunSignalCopy.h"
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    22
#include "DunDebug.h"
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    23
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    24
// ======== MEMBER FUNCTIONS ========
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    25
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    26
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    27
// Two-phased constructor.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    28
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    29
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    30
CDunDataWaiter* CDunDataWaiter::NewL( MDunChannelAllocator* aChannelCallback )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    31
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    32
    CDunDataWaiter* self = new (ELeave) CDunDataWaiter( aChannelCallback );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    33
    CleanupStack::PushL( self );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    34
    self->ConstructL();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    35
    CleanupStack::Pop( self );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    36
    return self;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    37
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    38
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    39
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    40
// Destructor.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    41
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    42
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    43
CDunDataWaiter::~CDunDataWaiter()
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    44
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    45
    FTRACE(FPrint( _L("CDunDataWaiter::~CDunDataWaiter()") ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    46
    ResetData();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    47
    FTRACE(FPrint( _L("CDunDataWaiter::~CDunDataWaiter() complete") ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    48
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    49
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    50
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    51
// Resets data to initial values
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    52
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    53
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    54
void CDunDataWaiter::ResetData()
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    55
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    56
    FTRACE(FPrint( _L("CDunDataWaiter::ResetData()") ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    57
    Stop();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    58
    // APIs affecting this:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    59
    // AddConnMonCallbackL()
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    60
    iCallbacks.Close();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    61
    // Internal
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    62
    Initialize();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    63
    FTRACE(FPrint( _L("CDunDataWaiter::ResetData() complete") ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    64
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    65
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    66
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    67
// Adds callback for RunL error controlling
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    68
// The callback will be called when error is detected in asynchronous
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    69
// operation
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    70
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    71
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    72
TInt CDunDataWaiter::AddCallback( MDunConnMon* aCallback )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    73
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    74
    FTRACE(FPrint( _L("CDunDataWaiter::AddCallback()" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    75
    if ( !aCallback )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    76
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    77
        FTRACE(FPrint( _L("CDunDataWaiter::AddCallback() (ERROR) complete" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    78
        return KErrGeneral;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    79
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    80
    TInt retTemp = iCallbacks.Find( aCallback );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    81
    if ( retTemp != KErrNotFound )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    82
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    83
        FTRACE(FPrint( _L("CDunDataWaiter::AddCallback() (already exists) complete" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    84
        return KErrAlreadyExists;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    85
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    86
    retTemp = iCallbacks.Append( aCallback );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    87
    if ( retTemp != KErrNone )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    88
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    89
        FTRACE(FPrint( _L("CDunDataWaiter::AddCallback() (append failed!) complete" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    90
        return retTemp;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    91
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    92
    FTRACE(FPrint( _L("CDunDataWaiter::AddCallback() complete" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    93
    return KErrNone;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    94
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    95
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    96
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    97
// Sets media to use for this endpoint
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    98
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    99
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   100
TInt CDunDataWaiter::SetMedia( RComm* aComm )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   101
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   102
    FTRACE(FPrint( _L("CDunDataWaiter::SetMedia(RComm) (addr=0x%08X)" ), aComm));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   103
    if ( !aComm )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   104
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   105
        FTRACE(FPrint( _L("CDunDataWaiter::SetMedia() (aComm) not initialized!" )));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   106
        return KErrGeneral;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   107
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   108
    TCommCaps2 caps;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   109
    aComm->Caps( caps );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   110
    if ( !(caps().iNotificationCaps & KNotifyDataAvailableSupported) )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   111
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   112
        FTRACE(FPrint( _L("CDunDataWaiter::SetMedia() (RComm) (not supported) complete" )));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   113
        return KErrNotSupported;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   114
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   115
    iComm = aComm;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   116
    FTRACE(FPrint( _L("CDunDataWaiter::SetMedia() (RComm) complete" )));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   117
    return KErrNone;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   118
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   119
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   120
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   121
// Issues request to start waiting for new data in RComm
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   122
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   123
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   124
TInt CDunDataWaiter::IssueRequest()
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   125
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   126
    FTRACE(FPrint( _L("CDunDataWaiter::IssueRequest()" )));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   127
    if ( iDataWaiterState != EDunStateIdle )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   128
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   129
        FTRACE(FPrint( _L("CDunDataWaiter::IssueRequest() (not ready) complete" )));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   130
        return KErrNotReady;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   131
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   132
    if ( !iComm )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   133
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   134
        FTRACE(FPrint( _L("CDunDataWaiter::IssueRequest() (iComm) not initialized!" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   135
        return KErrGeneral;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   136
        }
52
866b4af7ffbe 201039_01
hgs
parents: 29
diff changeset
   137
    iComm->ResetBuffers();
29
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   138
    iStatus = KRequestPending;
52
866b4af7ffbe 201039_01
hgs
parents: 29
diff changeset
   139
    iDataWaiterState = EDunStateDataWaiting;
29
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   140
    iComm->NotifyDataAvailable( iStatus );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   141
    SetActive();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   142
    FTRACE(FPrint( _L("CDunDataWaiter::IssueRequest() complete" )));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   143
    return KErrNone;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   144
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   145
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   146
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   147
// Stops monitoring for new data
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   148
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   149
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   150
TInt CDunDataWaiter::Stop()
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   151
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   152
    FTRACE(FPrint( _L("CDunDataWaiter::Stop()" )));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   153
    if ( iDataWaiterState != EDunStateDataWaiting )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   154
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   155
        FTRACE(FPrint( _L("CDunDataWaiter::Stop() (not ready) complete" )));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   156
        return KErrNotReady;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   157
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   158
    if ( !iComm )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   159
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   160
        FTRACE(FPrint( _L("CDunDataWaiter::Stop() (iComm) not initialized!" )));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   161
        return KErrGeneral;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   162
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   163
    iComm->NotifyDataAvailableCancel();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   164
    Cancel();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   165
    iDataWaiterState = EDunStateIdle;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   166
    FTRACE(FPrint( _L("CDunDataWaiter::Stop() complete" )));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   167
    return KErrNone;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   168
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   169
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   170
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   171
// CDunDataWaiter::CDunDataWaiter
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   172
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   173
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   174
CDunDataWaiter::CDunDataWaiter( MDunChannelAllocator* aChannelCallback ) :
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   175
    CActive( EPriorityHigh ),
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   176
    iChannelCallback( aChannelCallback )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   177
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   178
    Initialize();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   179
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   180
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   181
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   182
// CDunDataWaiter::ConstructL
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   183
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   184
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   185
void CDunDataWaiter::ConstructL()
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   186
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   187
    FTRACE(FPrint( _L("CDunDataWaiter::ConstructL()" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   188
    if ( !iChannelCallback )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   189
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   190
        User::Leave( KErrGeneral );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   191
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   192
    CActiveScheduler::Add( this );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   193
    FTRACE(FPrint( _L("CDunDataWaiter::ConstructL() complete" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   194
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   195
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   196
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   197
// Initializes this class
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   198
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   199
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   200
void CDunDataWaiter::Initialize()
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   201
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   202
    FTRACE(FPrint( _L("CDunDataWaiter::Initialize()" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   203
    // Don't initialize iChannelCallback here (it is set through NewL)
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   204
    iDataWaiterState = EDunStateIdle;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   205
    iComm = NULL;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   206
    FTRACE(FPrint( _L("CDunDataWaiter::Initialize() complete" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   207
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   208
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   209
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   210
// From class CActive.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   211
// Gets called when new data in RComm object
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   212
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   213
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   214
void CDunDataWaiter::RunL()
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   215
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   216
    FTRACE(FPrint( _L("CDunDataWaiter::RunL()" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   217
    iDataWaiterState = EDunStateIdle;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   218
    TInt retTemp = iStatus.Int();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   219
    if ( retTemp != KErrNone )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   220
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   221
        FTRACE(FPrint( _L("CDunDataWaiter::RunL() (failed) complete (%d)"), retTemp));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   222
        TInt count = iCallbacks.Count();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   223
        TDunConnectionReason connReason;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   224
        connReason.iReasonType = EDunReasonTypeRunL;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   225
        connReason.iContext = EDunMediaContextLocal;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   226
        connReason.iSignalType = 0;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   227
        connReason.iSignalHigh = EFalse;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   228
        connReason.iDirection = EDunDirectionUndefined;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   229
        connReason.iErrorCode = retTemp;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   230
        for ( TInt i=0; i<count; i++ )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   231
            {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   232
            TRAP_IGNORE(
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   233
                iCallbacks[i]->NotifyProgressChangeL( iComm, connReason ) );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   234
            }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   235
        return;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   236
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   237
    if ( iChannelCallback )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   238
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   239
        iChannelCallback->NotifyNewChannelRequest( iComm );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   240
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   241
    // Don't check other iMediaInUse values here
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   242
    // They can't be other than EDunMediaRComm (checked in IssueRequest())
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   243
    FTRACE(FPrint( _L("CDunDataWaiter::RunL() complete" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   244
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   245
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   246
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   247
// From class CActive.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   248
// Gets called on cancel
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   249
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   250
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   251
void CDunDataWaiter::DoCancel()
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   252
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   253
    }