localconnectivityservice/dun/utils/src/DunSignalCopy.cpp
author hgs
Fri, 25 Jun 2010 16:54:01 +0800
changeset 29 3ae5cb0b4c02
child 52 866b4af7ffbe
permissions -rw-r--r--
201025_07
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) 2008-2010 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:  Copies signals changes between network and local media
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
#ifdef PRJ_USE_NETWORK_STUBS
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    20
#include <c32comm_stub.h>
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    21
#else
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    22
#include <d32comm.h>
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    23
#endif
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    24
#include "DunTransporter.h"
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    25
#include "DunSignalCopy.h"
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    26
#include "DunDebug.h"
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    27
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    28
const TUint KDunSixLowestBitsMask = 0x3F;  // Symbian magic
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    29
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    30
// ======== MEMBER FUNCTIONS ========
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    31
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    32
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    33
// Two-phased constructor.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    34
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    35
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    36
CDunSignalCopy* CDunSignalCopy::NewL()
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    37
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    38
    CDunSignalCopy* self = new (ELeave) CDunSignalCopy();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    39
    CleanupStack::PushL( self );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    40
    self->ConstructL();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    41
    CleanupStack::Pop( self );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    42
    return self;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    43
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    44
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    45
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    46
// Destructor
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    47
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    48
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    49
CDunSignalCopy::~CDunSignalCopy()
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    50
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    51
    FTRACE(FPrint( _L("CDunSignalCopy::~CDunSignalCopy()") ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    52
    ResetData();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    53
    FTRACE(FPrint( _L("CDunSignalCopy::~CDunSignalCopy() complete") ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    54
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    55
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    56
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    57
// Resets data to initial values
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    58
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    59
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    60
void CDunSignalCopy::ResetData()
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    61
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    62
    FTRACE(FPrint( _L("CDunSignalCopy::ResetData()") ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    63
    // APIs affecting this:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    64
    // IssueRequest()
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    65
    Stop();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    66
    // AddCallback()
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    67
    iCallbacks.Close();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    68
    // Internal
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    69
    Initialize();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    70
    FTRACE(FPrint( _L("CDunSignalCopy::ResetData() complete") ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    71
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    72
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    73
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    74
// Adds callback for line status change controlling
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    75
// The callback will be called when RunL error is detected
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    76
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    77
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    78
TInt CDunSignalCopy::AddCallback( MDunConnMon* aCallback )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    79
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    80
    FTRACE(FPrint( _L("CDunSignalCopy::AddCallback()" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    81
    if ( !aCallback )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    82
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    83
        FTRACE(FPrint( _L("CDunSignalCopy::AddCallback() (aCallback) not initialized!" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    84
        return KErrGeneral;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    85
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    86
    TInt retTemp = iCallbacks.Find( aCallback );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    87
    if ( retTemp != KErrNotFound )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    88
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    89
        FTRACE(FPrint( _L("CDunSignalCopy::AddCallback() (already exists) complete" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    90
        return KErrAlreadyExists;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    91
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    92
    retTemp = iCallbacks.Append( aCallback );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    93
    if ( retTemp != KErrNone )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    94
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    95
        FTRACE(FPrint( _L("CDunSignalCopy::AddCallback() (append failed!) complete" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    96
        return retTemp;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    97
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    98
    FTRACE(FPrint( _L("CDunSignalCopy::AddCallback() complete" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    99
    return KErrNone;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   100
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   101
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   102
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   103
// Sets media to use for this endpoint monitor
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   104
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   105
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   106
TInt CDunSignalCopy::SetMedia( RComm* aComm,
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   107
                               RComm* aNetwork,
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   108
                               TDunStreamType aStreamType )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   109
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   110
    FTRACE(FPrint( _L("CDunSignalCopy::SetMedia()" )));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   111
    if ( !aNetwork )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   112
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   113
        FTRACE(FPrint( _L("CDunSignalCopy::SetMedia() (aComm) not initialized!" )));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   114
        return KErrGeneral;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   115
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   116
    RComm* comm = NULL;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   117
    if ( aStreamType == EDunStreamTypeUpstream )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   118
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   119
        iContextInUse = EDunMediaContextLocal;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   120
        comm = aComm;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   121
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   122
    else if ( aStreamType == EDunStreamTypeDownstream )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   123
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   124
        iContextInUse = EDunMediaContextNetwork;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   125
        comm = aNetwork;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   126
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   127
    else
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   128
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   129
        FTRACE(FPrint( _L("CDunSignalCopy::SetMedia() (aStreamtype) not initialized!" )));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   130
        return KErrGeneral;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   131
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   132
    // No possibility to do iUtility->GetLocalId() here as aComm is not yet
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   133
    // in channel data; use aComm directly
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   134
    TCommCaps2 caps;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   135
    comm->Caps( caps );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   136
    if ( !(caps().iNotificationCaps & KNotifySignalsChangeSupported) )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   137
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   138
        FTRACE(FPrint( _L("CDunSignalCopy::SetMedia() (RComm) (not supported) complete" )));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   139
        return KErrNotSupported;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   140
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   141
    iComm = aComm;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   142
    iNetwork = aNetwork;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   143
    iStreamType = aStreamType;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   144
    FTRACE(FPrint( _L("CDunSignalCopy::SetMedia() (RComm) complete" )));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   145
    return KErrNone;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   146
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   147
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   148
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   149
// Issues request to start monitoring the endpoint for line status change
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   150
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   151
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   152
TInt CDunSignalCopy::IssueRequest()
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   153
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   154
    FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest()" )));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   155
    if ( iSignalCopyState != EDunStateIdle )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   156
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   157
        FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() (not ready) complete" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   158
        return KErrNotReady;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   159
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   160
    RComm* comm = NULL;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   161
    if ( iStreamType == EDunStreamTypeUpstream )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   162
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   163
        iListenSignals = KSignalDCEInputs;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   164
        comm = iComm;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   165
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   166
    else if ( iStreamType == EDunStreamTypeDownstream )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   167
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   168
        iListenSignals = KSignalDTEInputs;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   169
        comm = iNetwork;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   170
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   171
    else
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   172
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   173
        FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() (ERROR) complete" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   174
        return KErrGeneral;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   175
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   176
    TUint currentSignals = comm->Signals( iListenSignals );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   177
    TUint oldSignalsLow = iSignals & KDunSixLowestBitsMask;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   178
    TUint newSignalsLow = currentSignals & KDunSixLowestBitsMask;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   179
    TUint oldSignalsHigh = oldSignalsLow * KSignalChanged;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   180
    TUint newSignalsHigh = newSignalsLow * KSignalChanged;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   181
    FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() oldSignalsLow=0x%08X" ), oldSignalsLow ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   182
    FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() newSignalsLow=0x%08X" ), newSignalsLow ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   183
    FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() oldSignalsHigh=0x%08X" ), oldSignalsHigh ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   184
    FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() newSignalsHigh=0x%08X" ), newSignalsHigh ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   185
    if ( newSignalsLow != oldSignalsLow )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   186
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   187
        FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() signals already set..." ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   188
        iSignals = newSignalsLow | (oldSignalsHigh ^ newSignalsHigh);
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   189
        ManageSignalChange();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   190
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   191
    else
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   192
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   193
        FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() start waiting for change..." ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   194
        iStatus = KRequestPending;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   195
        comm->NotifySignalChange( iStatus, iSignals, iListenSignals );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   196
        SetActive();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   197
        iSignalCopyState = EDunStateSignalCopy;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   198
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   199
    FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() complete" )));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   200
    return KErrNone;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   201
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   202
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   203
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   204
// Stops monitoring the endpoint for line status change
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   205
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   206
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   207
TInt CDunSignalCopy::Stop()
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   208
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   209
    FTRACE(FPrint( _L("CDunSignalCopy::Stop()" )));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   210
    if ( iSignalCopyState != EDunStateSignalCopy )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   211
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   212
        FTRACE(FPrint( _L("CDunSignalCopy::Stop() (not ready) complete" )));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   213
        return KErrNotReady;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   214
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   215
    if ( iStreamType == EDunStreamTypeUpstream )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   216
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   217
        iComm->NotifySignalChangeCancel();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   218
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   219
    else if ( iStreamType == EDunStreamTypeDownstream )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   220
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   221
        iNetwork->NotifySignalChangeCancel();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   222
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   223
    else
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   224
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   225
        FTRACE(FPrint( _L("CDunSignalCopy::Stop() (ERROR) complete" )));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   226
        return KErrGeneral;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   227
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   228
    Cancel();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   229
    iSignalCopyState = EDunStateIdle;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   230
    FTRACE(FPrint( _L("CDunSignalCopy::Stop() complete" )));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   231
    return KErrNone;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   232
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   233
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   234
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   235
// CDunSignalCopy::CDunSignalCopy
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   236
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   237
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   238
CDunSignalCopy::CDunSignalCopy() :
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   239
    CActive( EPriorityHigh )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   240
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   241
    Initialize();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   242
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   243
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   244
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   245
// CDunSignalCopy::ConstructL
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   246
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   247
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   248
void CDunSignalCopy::ConstructL()
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   249
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   250
    FTRACE(FPrint( _L("CDunSignalCopy::ConstructL()" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   251
    CActiveScheduler::Add( this );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   252
    FTRACE(FPrint( _L("CDunSignalCopy::ConstructL() complete" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   253
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   254
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   255
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   256
// Initializes this class
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   257
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   258
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   259
void CDunSignalCopy::Initialize()
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   260
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   261
    FTRACE(FPrint( _L("CDunSignalCopy::Initialize()" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   262
    iContextInUse = EDunMediaContextUndefined;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   263
    iStreamType = EDunStreamTypeUndefined;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   264
    iSignalCopyState = EDunStateIdle;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   265
    iListenSignals = 0;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   266
    iSignals = 0;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   267
    iNetwork = NULL;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   268
    iComm = NULL;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   269
    FTRACE(FPrint( _L("CDunSignalCopy::Initialize() complete" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   270
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   271
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   272
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   273
// Manages signal changes
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   274
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   275
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   276
void CDunSignalCopy::ManageSignalChange()
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   277
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   278
    FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChange()" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   279
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   280
    if ( iStreamType == EDunStreamTypeUpstream )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   281
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   282
        // Manage upstream case
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   283
        ManageSignalChangeUpstream();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   284
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   285
    else  // iStreamType == EDunStreamTypeDownstream
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   286
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   287
        // Manage downstream case
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   288
        ManageSignalChangeDownstream();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   289
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   290
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   291
    FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChange() complete" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   292
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   293
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   294
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   295
// Manages upstream signal changes
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   296
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   297
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   298
void CDunSignalCopy::ManageSignalChangeUpstream()
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   299
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   300
    FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeUpstream()" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   301
    // For upstream the following signals are set for local media:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   302
    // KSignalDCEInputs = KSignalRTS | KSignalDTR
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   303
    if ( iSignals & KRTSChanged )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   304
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   305
        FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeUpstream() checking RTS..." ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   306
        if ( iSignals & KSignalRTS )  // RTS changed to high
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   307
            {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   308
            ChangeUpstreamSignal( KSignalRTS, 0 );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   309
            FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeUpstream() RTS changed high" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   310
            }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   311
        else  // RTS changed to low
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   312
            {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   313
            ChangeUpstreamSignal( 0, KSignalRTS );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   314
            FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeUpstream() RTS changed low" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   315
            }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   316
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   317
    if ( iSignals & KDTRChanged )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   318
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   319
        FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeUpstream() checking DTR..." ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   320
        if ( iSignals & KSignalDTR )  // DTR changed to high
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   321
            {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   322
            ChangeUpstreamSignal( KSignalDTR, 0 );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   323
            FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeUpstream() DTR changed high" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   324
            }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   325
        else  // DTR changed to low
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   326
            {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   327
            ChangeUpstreamSignal( 0, KSignalDTR );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   328
            FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeUpstream() DTR changed low" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   329
            }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   330
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   331
    IssueRequest();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   332
    FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeUpstream() complete" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   333
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   334
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   335
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   336
// Manages downstream signal changes
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   337
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   338
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   339
void CDunSignalCopy::ManageSignalChangeDownstream()
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   340
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   341
    FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream()" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   342
    // For downstream the following signals are set for network:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   343
    // KSignalDTEInputs = KSignalCTS | KSignalDSR | KSignalDCD | KSignalRNG
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   344
    if ( iSignals & KCTSChanged )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   345
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   346
        FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() checking CTS..." ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   347
        if ( iSignals & KSignalCTS )  // CTS changed to high or initially high
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   348
            {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   349
            ChangeDownstreamSignal( KSignalCTS, 0 );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   350
            FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() CTS changed high" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   351
            }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   352
        else  // CTS changed to low
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   353
            {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   354
            ChangeDownstreamSignal( 0, KSignalCTS );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   355
            FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() CTS changed low" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   356
            }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   357
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   358
    if ( iSignals & KDSRChanged )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   359
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   360
        FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() checking DSR..." ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   361
        if ( iSignals & KSignalDSR )  // DSR changed to high
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   362
            {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   363
            ChangeDownstreamSignal( KSignalDSR, 0 );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   364
            FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() DSR changed high" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   365
            }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   366
        else  // DSR changed to low
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   367
            {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   368
            ChangeDownstreamSignal( 0, KSignalDSR );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   369
            FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() DSR changed low" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   370
            }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   371
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   372
    if ( iSignals & KDCDChanged )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   373
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   374
        FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() checking DCD..." ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   375
        if ( iSignals & KSignalDCD )  // DCD changed to high
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   376
            {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   377
            ChangeDownstreamSignal( KSignalDCD, 0 );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   378
            FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() DCD changed high" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   379
            }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   380
        else  // DCD changed to low
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   381
            {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   382
            ChangeDownstreamSignal( 0, KSignalDCD );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   383
            FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() DCD changed low" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   384
            }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   385
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   386
    if ( iSignals & KRNGChanged )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   387
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   388
        FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() checking RNG..." ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   389
        if ( iSignals & KSignalRNG )  // RNG changed to high
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   390
            {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   391
            ChangeDownstreamSignal( KSignalRNG, 0 );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   392
            FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() RNG changed high" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   393
            }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   394
        else  // RNG changed to low
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   395
            {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   396
            ChangeDownstreamSignal( 0, KSignalRNG );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   397
            FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() RNG changed low" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   398
            }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   399
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   400
    IssueRequest();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   401
    FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() complete" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   402
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   403
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   404
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   405
// Changes upstream signal
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   406
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   407
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   408
void CDunSignalCopy::ChangeUpstreamSignal( TUint aSetMask, TUint aClearMask )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   409
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   410
    FTRACE(FPrint( _L("CDunSignalCopy::ChangeUpstreamSignal()" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   411
    if ( iNetwork )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   412
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   413
        iNetwork->SetSignals( aSetMask, aClearMask );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   414
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   415
    // Add other cases here if necessary
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   416
    FTRACE(FPrint( _L("CDunSignalCopy::ChangeUpstreamSignal() complete" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   417
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   418
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   419
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   420
// Changes downstream signal
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   421
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   422
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   423
void CDunSignalCopy::ChangeDownstreamSignal( TUint aSetMask, TUint aClearMask )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   424
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   425
    FTRACE(FPrint( _L("CDunSignalCopy::ChangeDownstreamSignal()" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   426
    if ( iComm )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   427
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   428
        iComm->SetSignals( aSetMask, aClearMask );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   429
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   430
    // Add other cases here if necessary
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   431
    FTRACE(FPrint( _L("CDunSignalCopy::ChangeDownstreamSignal() complete" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   432
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   433
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   434
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   435
// From class CActive.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   436
// Gets called when line status changes
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   437
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   438
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   439
void CDunSignalCopy::RunL()
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   440
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   441
    FTRACE(FPrint( _L("CDunSignalCopy::RunL()" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   442
    iSignalCopyState = EDunStateIdle;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   443
    TInt retTemp = iStatus.Int();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   444
    if ( retTemp != KErrNone )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   445
        {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   446
        FTRACE(FPrint( _L("CDunSignalCopy::RunL() (failed) complete (%d)"), retTemp));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   447
        TInt i;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   448
        TInt count = iCallbacks.Count();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   449
        TDunConnectionReason connReason;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   450
        connReason.iReasonType = EDunReasonTypeRunL;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   451
        connReason.iContext = iContextInUse;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   452
        connReason.iSignalType = 0;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   453
        connReason.iSignalHigh = EFalse;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   454
        connReason.iDirection = EDunDirectionUndefined;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   455
        connReason.iErrorCode = retTemp;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   456
        for ( i=0; i<count; i++ )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   457
            {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   458
            TRAP_IGNORE(
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   459
                iCallbacks[i]->NotifyProgressChangeL( iComm, connReason ) );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   460
            }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   461
        return;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   462
        }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   463
    FTRACE(FPrint( _L("CDunSignalCopy::RunL() managing signal 0x%08X" ), iSignals ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   464
    ManageSignalChange();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   465
    FTRACE(FPrint( _L("CDunSignalCopy::RunL() complete" ) ));
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   466
    }
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   467
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   468
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   469
// From class CActive.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   470
// Gets called on cancel
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   471
// ---------------------------------------------------------------------------
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   472
//
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   473
void CDunSignalCopy::DoCancel()
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   474
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   475
    }