mmserv/tms/tmsserver/src/tmseteldtmfstopmonitor.cpp
author hgs
Fri, 09 Jul 2010 16:43:35 -0500
changeset 33 5e8b14bae8c3
permissions -rw-r--r--
201027
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
 * All rights reserved.
hgs
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
 *
hgs
parents:
diff changeset
     9
 * Initial Contributors:
hgs
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
 *
hgs
parents:
diff changeset
    12
 * Contributors:
hgs
parents:
diff changeset
    13
 *
hgs
parents:
diff changeset
    14
 * Description: Telephony Multimedia Service
hgs
parents:
diff changeset
    15
 *
hgs
parents:
diff changeset
    16
 */
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
#include <gsmerror.h>
hgs
parents:
diff changeset
    19
#include "tmsutility.h"
hgs
parents:
diff changeset
    20
#include "tmsdtmfobserver.h"
hgs
parents:
diff changeset
    21
#include "tmsdtmfprovider.h"
hgs
parents:
diff changeset
    22
#include "tmseteldtmfstopmonitor.h"
hgs
parents:
diff changeset
    23
hgs
parents:
diff changeset
    24
using namespace TMS;
hgs
parents:
diff changeset
    25
hgs
parents:
diff changeset
    26
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    27
// TMSEtelDtmfStopMonitor::NewL.
hgs
parents:
diff changeset
    28
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    29
//
hgs
parents:
diff changeset
    30
TMSEtelDtmfStopMonitor* TMSEtelDtmfStopMonitor::NewL(TMSDTMFProvider& aObserver,
hgs
parents:
diff changeset
    31
        RMobilePhone& aPhone)
hgs
parents:
diff changeset
    32
    {
hgs
parents:
diff changeset
    33
    TRACE_PRN_FN_EXT;
hgs
parents:
diff changeset
    34
    TMSEtelDtmfStopMonitor* self = new (ELeave) TMSEtelDtmfStopMonitor(
hgs
parents:
diff changeset
    35
            aObserver, aPhone);
hgs
parents:
diff changeset
    36
    TRACE_PRN_FN_EXT;
hgs
parents:
diff changeset
    37
    return self;
hgs
parents:
diff changeset
    38
    }
hgs
parents:
diff changeset
    39
hgs
parents:
diff changeset
    40
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    41
// Constructs the monitor.
hgs
parents:
diff changeset
    42
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    43
//
hgs
parents:
diff changeset
    44
TMSEtelDtmfStopMonitor::TMSEtelDtmfStopMonitor(TMSDTMFProvider& aObserver,
hgs
parents:
diff changeset
    45
        RMobilePhone& aPhone) :
hgs
parents:
diff changeset
    46
    CActive(EPriorityStandard),
hgs
parents:
diff changeset
    47
    iObserver(aObserver),
hgs
parents:
diff changeset
    48
    iPhone(aPhone)
hgs
parents:
diff changeset
    49
    {
hgs
parents:
diff changeset
    50
    TRACE_PRN_FN_ENT;
hgs
parents:
diff changeset
    51
    CActiveScheduler::Add(this);
hgs
parents:
diff changeset
    52
    TRACE_PRN_FN_EXT;
hgs
parents:
diff changeset
    53
    }
hgs
parents:
diff changeset
    54
hgs
parents:
diff changeset
    55
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    56
// Destructs the object by canceling first ongoing monitoring.
hgs
parents:
diff changeset
    57
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    58
//
hgs
parents:
diff changeset
    59
TMSEtelDtmfStopMonitor::~TMSEtelDtmfStopMonitor()
hgs
parents:
diff changeset
    60
    {
hgs
parents:
diff changeset
    61
    TRACE_PRN_FN_ENT;
hgs
parents:
diff changeset
    62
    Cancel();
hgs
parents:
diff changeset
    63
    TRACE_PRN_FN_EXT;
hgs
parents:
diff changeset
    64
    }
hgs
parents:
diff changeset
    65
hgs
parents:
diff changeset
    66
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    67
// Starts the monitor.
hgs
parents:
diff changeset
    68
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    69
//
hgs
parents:
diff changeset
    70
void TMSEtelDtmfStopMonitor::StartMonitoring()
hgs
parents:
diff changeset
    71
    {
hgs
parents:
diff changeset
    72
    TRACE_PRN_FN_ENT;
hgs
parents:
diff changeset
    73
    if (!IsActive())
hgs
parents:
diff changeset
    74
        {
hgs
parents:
diff changeset
    75
        iStatus = KRequestPending;
hgs
parents:
diff changeset
    76
        iPhone.NotifyStopInDTMFString(iStatus);
hgs
parents:
diff changeset
    77
        SetActive();
hgs
parents:
diff changeset
    78
        }
hgs
parents:
diff changeset
    79
    TRACE_PRN_FN_EXT;
hgs
parents:
diff changeset
    80
    }
hgs
parents:
diff changeset
    81
hgs
parents:
diff changeset
    82
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    83
// From CActive.
hgs
parents:
diff changeset
    84
// Handles line status change notifying.
hgs
parents:
diff changeset
    85
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    86
//
hgs
parents:
diff changeset
    87
void TMSEtelDtmfStopMonitor::RunL()
hgs
parents:
diff changeset
    88
    {
hgs
parents:
diff changeset
    89
    TRACE_PRN_FN_ENT;
hgs
parents:
diff changeset
    90
    gint err = iStatus.Int();
hgs
parents:
diff changeset
    91
    TRACE_PRN_N1(_L("**TMS TMSEtelDtmfStopMonitor::RunL: status: %d"), err);
hgs
parents:
diff changeset
    92
hgs
parents:
diff changeset
    93
    if (err != KErrCancel && err != KErrServerTerminated)
hgs
parents:
diff changeset
    94
        {
hgs
parents:
diff changeset
    95
        TChar tone = NULL;
hgs
parents:
diff changeset
    96
        TMSDTMFObserver::TCCPDtmfEvent event =
hgs
parents:
diff changeset
    97
                TMSDTMFObserver::ECCPDtmfStopInDtmfString;
hgs
parents:
diff changeset
    98
        iObserver.NotifyDTMFEvent(event, err, tone);
hgs
parents:
diff changeset
    99
        }
hgs
parents:
diff changeset
   100
    else
hgs
parents:
diff changeset
   101
        {
hgs
parents:
diff changeset
   102
        TRACE_PRN_N1(_L("**TMS TMSEtelDtmfStopMonitor::RunL: Error \
hgs
parents:
diff changeset
   103
                       from RMobilePhone: %d"),iStatus.Int());
hgs
parents:
diff changeset
   104
        }
hgs
parents:
diff changeset
   105
hgs
parents:
diff changeset
   106
    // Continue if not in offline mode
hgs
parents:
diff changeset
   107
    if (err != KErrGsmOfflineOpNotAllowed && err != KErrCancel
hgs
parents:
diff changeset
   108
            && err != KErrNotSupported)
hgs
parents:
diff changeset
   109
        {
hgs
parents:
diff changeset
   110
        StartMonitoring();
hgs
parents:
diff changeset
   111
        }
hgs
parents:
diff changeset
   112
    TRACE_PRN_IF_ERR(err);
hgs
parents:
diff changeset
   113
    TRACE_PRN_FN_EXT;
hgs
parents:
diff changeset
   114
    }
hgs
parents:
diff changeset
   115
hgs
parents:
diff changeset
   116
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   117
// From CActive
hgs
parents:
diff changeset
   118
// Canceling functionality.
hgs
parents:
diff changeset
   119
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   120
//
hgs
parents:
diff changeset
   121
void TMSEtelDtmfStopMonitor::DoCancel()
hgs
parents:
diff changeset
   122
    {
hgs
parents:
diff changeset
   123
    TRACE_PRN_FN_ENT;
hgs
parents:
diff changeset
   124
    iPhone.CancelAsyncRequest(EMobilePhoneNotifyStopInDTMFString);
hgs
parents:
diff changeset
   125
    TRACE_PRN_FN_EXT;
hgs
parents:
diff changeset
   126
    }
hgs
parents:
diff changeset
   127