mmserv/tms/tmsimpl/src/tmsglobalvoleffectbodyimpl.cpp
branchRCL_3
changeset 10 3d8c721bf319
parent 0 71ca22bcf22a
child 18 2eb3b066cc7d
equal deleted inserted replaced
8:e35735ece90c 10:3d8c721bf319
    24 using namespace TMS;
    24 using namespace TMS;
    25 
    25 
    26 TMSGlobalVolEffectBodyImpl::TMSGlobalVolEffectBodyImpl() :
    26 TMSGlobalVolEffectBodyImpl::TMSGlobalVolEffectBodyImpl() :
    27     iObserver(NULL),
    27     iObserver(NULL),
    28     iProxy(NULL),
    28     iProxy(NULL),
    29     iGlobalEffect(NULL)
    29     iParent(NULL)
    30     {
    30     {
    31     }
    31     }
    32 
    32 
    33 TMSGlobalVolEffectBodyImpl::~TMSGlobalVolEffectBodyImpl()
    33 TMSGlobalVolEffectBodyImpl::~TMSGlobalVolEffectBodyImpl()
    34     {
    34     {
    37         iProxy->Close();
    37         iProxy->Close();
    38         delete iProxy;
    38         delete iProxy;
    39         iProxy = NULL;
    39         iProxy = NULL;
    40         }
    40         }
    41     iObserver = NULL;
    41     iObserver = NULL;
    42     iGlobalEffect = NULL;
    42     iParent = NULL;
    43     iUserData = NULL;
    43     iUserData = NULL;
    44     }
    44     }
    45 
    45 
    46 gint TMSGlobalVolEffectBodyImpl::Create(TMSGlobalVolEffectBody*& bodyimpl)
    46 gint TMSGlobalVolEffectBodyImpl::Create(TMSGlobalVolEffectBody*& bodyimpl)
    47     {
    47     {
    63 gint TMSGlobalVolEffectBodyImpl::PostConstruct()
    63 gint TMSGlobalVolEffectBodyImpl::PostConstruct()
    64     {
    64     {
    65     gint ret(TMS_RESULT_SUCCESS);
    65     gint ret(TMS_RESULT_SUCCESS);
    66     iClientId = 1;
    66     iClientId = 1;
    67     iProxy = new TMSProxy;
    67     iProxy = new TMSProxy;
    68     if (iProxy)
    68     if (!iProxy)
    69         {
    69         {
    70         if (iProxy->Connect() != TMS_RESULT_SUCCESS)
    70         ret = TMS_RESULT_INSUFFICIENT_MEMORY;
    71             {
    71         }
    72             delete iProxy;
    72     RET_REASON_IF_ERR(ret);
    73             iProxy = NULL;
    73 
    74             ret = TMS_RESULT_FATAL_ERROR;
    74     if (iProxy->Connect() != TMS_RESULT_SUCCESS)
    75             }
    75         {
       
    76         delete iProxy;
       
    77         iProxy = NULL;
       
    78         ret = TMS_RESULT_FATAL_ERROR;
    76         }
    79         }
    77     else
    80     else
    78         {
    81         {
    79         ret = TMS_RESULT_UNINITIALIZED_OBJECT;
    82         // Starts TAR if not started already;
       
    83         ret = iProxy->StartRoutingNotifier();
    80         }
    84         }
       
    85     RET_REASON_IF_ERR(ret);
    81     return ret;
    86     return ret;
    82     }
    87     }
    83 
    88 
    84 gint TMSGlobalVolEffectBodyImpl::AddObserver(TMSEffectObserver& obsrvr,
    89 gint TMSGlobalVolEffectBodyImpl::AddObserver(TMSEffectObserver& obsrvr,
    85         gpointer /*user_data*/)
    90         gpointer user_data)
    86     {
    91     {
    87     gint ret(TMS_RESULT_SUCCESS);
    92     gint ret(TMS_RESULT_SUCCESS);
    88     if (!iObserver)
    93     if (!iObserver)
    89         {
    94         {
    90         iObserver = &obsrvr;
    95         iObserver = &obsrvr;
    91         //iUserData = user_data;
    96         iUserData = user_data;
    92         if (iProxy)
    97         if (iProxy)
    93             {
    98             {
    94             ret = iProxy->SetMsgQueueNotifier(EMsgQueueGlobalVolumeType,
    99             ret = iProxy->SetMsgQueueNotifier(EMsgQueueGlobalVolumeType,
    95                     iObserver, iGlobalEffect, iClientId);
   100                     iObserver, iParent, iClientId);
    96             if (ret == TMS_RESULT_SUCCESS)
   101             if (ret == TMS_RESULT_SUCCESS)
    97                 {
   102                 {
    98                 ret = iProxy->StartGlobalEffectNotifier();
   103                 ret = iProxy->StartGlobalEffectNotifier();
    99                 }
   104                 }
   100             }
   105             }
   111     }
   116     }
   112 
   117 
   113 gint TMSGlobalVolEffectBodyImpl::RemoveObserver(TMSEffectObserver& obsrvr)
   118 gint TMSGlobalVolEffectBodyImpl::RemoveObserver(TMSEffectObserver& obsrvr)
   114     {
   119     {
   115     gint ret(TMS_RESULT_SUCCESS);
   120     gint ret(TMS_RESULT_SUCCESS);
   116 
       
   117     if (iProxy && (&obsrvr == iObserver))
   121     if (iProxy && (&obsrvr == iObserver))
   118         {
   122         {
   119         iProxy->RemoveMsgQueueNotifier(EMsgQueueGlobalVolumeType, iObserver);
   123         ret = iProxy->RemoveMsgQueueNotifier(EMsgQueueGlobalVolumeType,
       
   124             iObserver);
   120         iObserver = NULL;
   125         iObserver = NULL;
   121         //ret = iProxy->StopEffectNotifier(obsrvr);
   126         ret = iProxy->CancelGlobalEffectNotifier();
       
   127         ret = iProxy->CancelRoutingNotifier();
   122         }
   128         }
   123     else
   129     else
   124         {
   130         {
   125         ret = TMS_RESULT_DOES_NOT_EXIST;
   131         ret = TMS_RESULT_DOES_NOT_EXIST;
   126         }
   132         }
   174     gint ret(TMS_RESULT_SUCCESS);
   180     gint ret(TMS_RESULT_SUCCESS);
   175     effecttype = TMS_EFFECT_GLOBAL_VOL;
   181     effecttype = TMS_EFFECT_GLOBAL_VOL;
   176     return ret;
   182     return ret;
   177     }
   183     }
   178 
   184 
   179 void TMSGlobalVolEffectBodyImpl::SetParentEffect(TMSEffect*& parenteffect)
   185 void TMSGlobalVolEffectBodyImpl::SetParent(TMSEffect*& parent)
   180     {
   186     {
   181     iGlobalEffect = NULL;
   187     iParent = parent;
   182     iGlobalEffect = parenteffect;
       
   183     }
   188     }
   184 
   189 
   185 // End of file