qtms/src/qtmsglobalroutingimpl.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 <tmsglobalrouting.h>
       
    20 #include "tmsutility.h"
       
    21 #include "qtmsglobalroutingimpl.h"
       
    22 
       
    23 using namespace QTMS;
       
    24 using namespace TMS;
       
    25 
       
    26 QTMSGlobalRoutingImpl::QTMSGlobalRoutingImpl()
       
    27 {
       
    28 }
       
    29 
       
    30 QTMSGlobalRoutingImpl::~QTMSGlobalRoutingImpl()
       
    31 {
       
    32     RemoveObserver(*this);
       
    33 }
       
    34 
       
    35 gint QTMSGlobalRoutingImpl::Create(QTMSGlobalRouting*& qrouting, TMS::TMSGlobalRouting*& tmsrouting)
       
    36 {
       
    37     gint ret(QTMS_RESULT_INSUFFICIENT_MEMORY);
       
    38     QTMSGlobalRoutingImpl* self = new QTMSGlobalRoutingImpl();
       
    39     if (self) {
       
    40         ret = self->PostConstruct();
       
    41         if (ret != QTMS_RESULT_SUCCESS) {
       
    42             delete self;
       
    43             self = NULL;
       
    44         }
       
    45         self->iRouting = tmsrouting;
       
    46         ret = self->AddObserver(*self, NULL);
       
    47     }
       
    48     qrouting = self;
       
    49     return ret;
       
    50 }
       
    51 
       
    52 gint QTMSGlobalRoutingImpl::PostConstruct()
       
    53 {
       
    54     gint ret(QTMS_RESULT_SUCCESS);
       
    55     return ret;
       
    56 }
       
    57 
       
    58 gint QTMSGlobalRoutingImpl::AddObserver(TMS::TMSGlobalRoutingObserver& obsrvr, gpointer user_data)
       
    59 {
       
    60     gint ret(QTMS_RESULT_SUCCESS);
       
    61 
       
    62     if (iRouting) {
       
    63         ret = iRouting->AddObserver(obsrvr, user_data);
       
    64     }
       
    65     return ret;
       
    66 }
       
    67 
       
    68 gint QTMSGlobalRoutingImpl::RemoveObserver(TMS::TMSGlobalRoutingObserver& obsrvr)
       
    69 {
       
    70     gint ret(QTMS_RESULT_SUCCESS);
       
    71 
       
    72     if (iRouting) {
       
    73         ret = iRouting->RemoveObserver(obsrvr);
       
    74     }
       
    75     return ret;
       
    76 }
       
    77 
       
    78 void QTMSGlobalRoutingImpl::GlobalRoutingEvent(const TMS::TMSGlobalRouting& /*routing*/,
       
    79     TMS::TMSSignalEvent event, TMS::TMSAudioOutput output)
       
    80 {
       
    81     QTMSSignalEvent qevent;
       
    82     QTMSAudioOutput qoutput;
       
    83 
       
    84     qevent.type = event.type;
       
    85     qevent.reason = event.reason;
       
    86     qevent.curr_state = event.curr_state;
       
    87     qevent.prev_state = event.prev_state;
       
    88     qevent.event_data = event.event_data;
       
    89     qevent.user_data = event.user_data;
       
    90     qoutput = output;
       
    91 
       
    92     emit QTMS::QTMSGlobalRouting::GlobalRoutingEvent(static_cast<QTMSGlobalRouting&> (*this),
       
    93         qevent, qoutput);
       
    94 }
       
    95 
       
    96 // End of file