qtms/src/qtmsinbandtoneimpl.cpp
changeset 27 cbb1bfb7ebfb
child 40 4a1905d205a2
equal deleted inserted replaced
25:d881023c13eb 27:cbb1bfb7ebfb
       
     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,
       
    36         TMS::TMSInbandTone*& tmsinband)
       
    37     {
       
    38     gint ret(QTMS_RESULT_INSUFFICIENT_MEMORY);
       
    39     QTMSInbandToneImpl* self = new QTMSInbandToneImpl();
       
    40     if (self)
       
    41         {
       
    42         ret = self->PostConstruct();
       
    43         if (ret != QTMS_RESULT_SUCCESS)
       
    44             {
       
    45             delete self;
       
    46             self = NULL;
       
    47             }
       
    48         self->iInbandTone = tmsinband;
       
    49         self->AddObserver(*self, NULL);
       
    50         }
       
    51     qinband = self;
       
    52     return ret;
       
    53     }
       
    54 
       
    55 gint QTMSInbandToneImpl::PostConstruct()
       
    56     {
       
    57     gint ret(QTMS_RESULT_SUCCESS);
       
    58     return ret;
       
    59     }
       
    60 
       
    61 gint QTMSInbandToneImpl::AddObserver(TMS::TMSInbandToneObserver& obsrvr,
       
    62         gpointer user_data)
       
    63     {
       
    64     gint ret(QTMS_RESULT_SUCCESS);
       
    65 
       
    66     if (iInbandTone)
       
    67         {
       
    68         ret = iInbandTone->AddObserver(obsrvr, user_data);
       
    69         }
       
    70     return ret;
       
    71     }
       
    72 
       
    73 gint QTMSInbandToneImpl::RemoveObserver(TMS::TMSInbandToneObserver& obsrvr)
       
    74     {
       
    75     gint ret(QTMS_RESULT_SUCCESS);
       
    76 
       
    77     if (iInbandTone)
       
    78         {
       
    79         ret = iInbandTone->RemoveObserver(obsrvr);
       
    80         }
       
    81     return ret;
       
    82     }
       
    83 
       
    84 void QTMSInbandToneImpl::InbandToneEvent(
       
    85         const TMS::TMSInbandTone& /*inbandtone*/, TMS::TMSSignalEvent event)
       
    86     {
       
    87     QTMSSignalEvent qevent;
       
    88 
       
    89     qevent.type = event.type;
       
    90     qevent.reason = event.reason;
       
    91     qevent.curr_state = event.curr_state;
       
    92     qevent.prev_state = event.prev_state;
       
    93     qevent.event_data = event.event_data;
       
    94     qevent.user_data = event.user_data;
       
    95 
       
    96     emit QTMS::QTMSInbandTone::InbandToneEvent(
       
    97             static_cast<QTMSInbandTone&> (*this), qevent);
       
    98     }
       
    99 
       
   100 // End of file