phoneengine/phoneservices/src/dtmfservice.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 16 Apr 2010 14:58:25 +0300
changeset 22 6bb1b21d2484
parent 21 92ab7f8d0eab
child 30 ebdbd102c78a
permissions -rw-r--r--
Revision: 201011 Kit: 201015

/*!
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  DTMF API to be used through Qt Highway.
*
*/

#include <xqserviceutil.h>
#include <e32base.h>
#include "dtmfservice.h"
#include "qtphonelog.h"

DTMFService::DTMFService(MPECallControlIF &call, MPECallSettersIF &parameters, QObject* parent) : 
    XQServiceProvider(QLatin1String("com.nokia.services.telephony.dtmf"), parent), m_call (call), m_parameters (parameters)
{
    publishAll();
}

DTMFService::~DTMFService()
{
}

void DTMFService::executeKeySequence(const QString& keySequence)
{
    PHONE_DEBUG2("DTMFService::executeKeySequence keySequence:", keySequence);
    TPtrC16 keySequencePtr (reinterpret_cast<const TUint16*>(keySequence.utf16 ()));
    m_parameters.SetPhoneNumber (keySequencePtr);   
}

void DTMFService::playDTMFTone(const QChar& keyToPlay)
{
    PHONE_DEBUG2("DTMFService::playDTMFTone keyToPlay:", keyToPlay);
    m_parameters.SetKeyCode(keyToPlay.unicode());
    TRAP_IGNORE( m_call.HandlePlayDTMFL() );
}

void DTMFService::stopDTMFPlay()
{
    PHONE_DEBUG("DTMFService::stopDTMFPlay");
    m_call.HandleEndDTMF(); 
}