qtms/src/qtmsinbandtoneimpl.cpp
branchRCL_3
changeset 56 63223d4fd956
parent 55 6c1dfe4da5dd
child 59 666f9a5a90a9
equal deleted inserted replaced
55:6c1dfe4da5dd 56:63223d4fd956
     1 /*
       
     2  * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: QT Bindings for TMS
       
    15  *
       
    16  */
       
    17 
       
    18 #include <qtms.h>
       
    19 #include <tmsinbandtone.h>
       
    20 #include "tmsutility.h"
       
    21 #include "qtmsinbandtoneimpl.h"
       
    22 
       
    23 using namespace QTMS;
       
    24 using namespace TMS;
       
    25 
       
    26 QTMSInbandToneImpl::QTMSInbandToneImpl()
       
    27 {
       
    28 }
       
    29 
       
    30 QTMSInbandToneImpl::~QTMSInbandToneImpl()
       
    31 {
       
    32     RemoveObserver(*this);
       
    33 }
       
    34 
       
    35 gint QTMSInbandToneImpl::Create(QTMSInbandTone*& qinband, TMS::TMSInbandTone*& tmsinband)
       
    36 {
       
    37     gint ret(QTMS_RESULT_INSUFFICIENT_MEMORY);
       
    38     QTMSInbandToneImpl* self = new QTMSInbandToneImpl();
       
    39     if (self) {
       
    40         ret = self->PostConstruct();
       
    41         if (ret != QTMS_RESULT_SUCCESS) {
       
    42             delete self;
       
    43             self = NULL;
       
    44         }
       
    45         self->iInbandTone = tmsinband;
       
    46         self->AddObserver(*self, NULL);
       
    47     }
       
    48     qinband = self;
       
    49     return ret;
       
    50 }
       
    51 
       
    52 gint QTMSInbandToneImpl::PostConstruct()
       
    53 {
       
    54     gint ret(QTMS_RESULT_SUCCESS);
       
    55     return ret;
       
    56 }
       
    57 
       
    58 gint QTMSInbandToneImpl::AddObserver(TMS::TMSInbandToneObserver& obsrvr, gpointer user_data)
       
    59 {
       
    60     gint ret(QTMS_RESULT_SUCCESS);
       
    61 
       
    62     if (iInbandTone) {
       
    63         ret = iInbandTone->AddObserver(obsrvr, user_data);
       
    64     }
       
    65     return ret;
       
    66 }
       
    67 
       
    68 gint QTMSInbandToneImpl::RemoveObserver(TMS::TMSInbandToneObserver& obsrvr)
       
    69 {
       
    70     gint ret(QTMS_RESULT_SUCCESS);
       
    71 
       
    72     if (iInbandTone) {
       
    73         ret = iInbandTone->RemoveObserver(obsrvr);
       
    74     }
       
    75     return ret;
       
    76 }
       
    77 
       
    78 void QTMSInbandToneImpl::InbandToneEvent(const TMS::TMSInbandTone& /*inbandtone*/,
       
    79     TMS::TMSSignalEvent event)
       
    80 {
       
    81     QTMSSignalEvent qevent;
       
    82     qevent.type = event.type;
       
    83     qevent.reason = event.reason;
       
    84     qevent.curr_state = event.curr_state;
       
    85     qevent.prev_state = event.prev_state;
       
    86     qevent.event_data = event.event_data;
       
    87     qevent.user_data = event.user_data;
       
    88 
       
    89     emit QTMS::QTMSInbandTone::InbandToneEvent(static_cast<QTMSInbandTone&> (*this), qevent);
       
    90 }
       
    91 
       
    92 // End of file