mmserv/tms/tmsimpl/src/tmsglobalgaineffectbodyimpl.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 TMSGlobalGainEffectBodyImpl::TMSGlobalGainEffectBodyImpl() :
    26 TMSGlobalGainEffectBodyImpl::TMSGlobalGainEffectBodyImpl() :
    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 TMSGlobalGainEffectBodyImpl::~TMSGlobalGainEffectBodyImpl()
    33 TMSGlobalGainEffectBodyImpl::~TMSGlobalGainEffectBodyImpl()
    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 TMSGlobalGainEffectBodyImpl::Create(TMSGlobalGainEffectBody*& bodyimpl)
    46 gint TMSGlobalGainEffectBodyImpl::Create(TMSGlobalGainEffectBody*& bodyimpl)
    47     {
    47     {
    63 gint TMSGlobalGainEffectBodyImpl::PostConstruct()
    63 gint TMSGlobalGainEffectBodyImpl::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)
       
    69         {
       
    70         ret = TMS_RESULT_INSUFFICIENT_MEMORY;
       
    71         }
       
    72     RET_REASON_IF_ERR(ret);
    68 
    73 
    69     if (iProxy)
    74     if (iProxy->Connect() != TMS_RESULT_SUCCESS)
    70         {
    75         {
    71         if (iProxy->Connect() != TMS_RESULT_SUCCESS)
    76         delete iProxy;
    72             {
    77         iProxy = NULL;
    73             delete iProxy;
    78         ret = TMS_RESULT_FATAL_ERROR;
    74             iProxy = NULL;
       
    75             ret = TMS_RESULT_FATAL_ERROR;
       
    76             }
       
    77         }
    79         }
    78     else
    80     else
    79         {
    81         {
    80         ret = TMS_RESULT_INSUFFICIENT_MEMORY;
    82         // Starts TAR if not started already;
       
    83         ret = iProxy->StartRoutingNotifier();
    81         }
    84         }
       
    85     RET_REASON_IF_ERR(ret);
    82     return ret;
    86     return ret;
    83     }
    87     }
    84 
    88 
    85 gint TMSGlobalGainEffectBodyImpl::AddObserver(TMSEffectObserver& obsrvr,
    89 gint TMSGlobalGainEffectBodyImpl::AddObserver(TMSEffectObserver& obsrvr,
    86         gpointer /*user_data*/)
    90         gpointer user_data)
    87     {
    91     {
    88     gint ret(TMS_RESULT_SUCCESS);
    92     gint ret(TMS_RESULT_SUCCESS);
    89     if (!iObserver)
    93     if (!iObserver)
    90         {
    94         {
    91         iObserver = &obsrvr;
    95         iObserver = &obsrvr;
    92         //iUserData = user_data;
    96         iUserData = user_data;
    93         if (iProxy)
    97         if (iProxy)
    94             {
    98             {
    95             ret = iProxy->SetMsgQueueNotifier(EMsgQueueGlobalGainType,
    99             ret = iProxy->SetMsgQueueNotifier(EMsgQueueGlobalGainType,
    96                     iObserver, iGlobalEffect, iClientId);
   100                     iObserver, iParent, iClientId);
       
   101             if (ret == TMS_RESULT_SUCCESS)
       
   102                 {
       
   103                 ret = iProxy->StartGlobalEffectNotifier();
       
   104                 }
    97             }
   105             }
    98         else
   106         else
    99             {
   107             {
   100             ret = TMS_RESULT_DOES_NOT_EXIST;
   108             ret = TMS_RESULT_DOES_NOT_EXIST;
   101             }
   109             }
   102         }
   110         }
   103     else
   111     else
   104         {
   112         {
   105         ret = TMS_RESULT_ALREADY_EXIST;
   113         ret = TMS_RESULT_ALREADY_EXIST;
   106         }
   114         }
   107 
       
   108     return ret;
   115     return ret;
   109     }
   116     }
   110 
   117 
   111 gint TMSGlobalGainEffectBodyImpl::RemoveObserver(TMSEffectObserver& obsrvr)
   118 gint TMSGlobalGainEffectBodyImpl::RemoveObserver(TMSEffectObserver& obsrvr)
   112     {
   119     {
   113     gint ret(TMS_RESULT_SUCCESS);
   120     gint ret(TMS_RESULT_SUCCESS);
   114 
       
   115     if (iProxy && (&obsrvr == iObserver))
   121     if (iProxy && (&obsrvr == iObserver))
   116         {
   122         {
   117         ret = iProxy->RemoveMsgQueueNotifier(EMsgQueueGlobalGainType,
   123         ret = iProxy->RemoveMsgQueueNotifier(EMsgQueueGlobalGainType,
   118                 iObserver);
   124                 iObserver);
   119         iObserver = NULL;
   125         iObserver = NULL;
       
   126         ret = iProxy->CancelGlobalEffectNotifier();
       
   127         ret = iProxy->CancelRoutingNotifier();
   120         }
   128         }
   121     else
   129     else
   122         {
   130         {
   123         ret = TMS_RESULT_DOES_NOT_EXIST;
   131         ret = TMS_RESULT_DOES_NOT_EXIST;
   124         }
   132         }
   172     gint ret(TMS_RESULT_SUCCESS);
   180     gint ret(TMS_RESULT_SUCCESS);
   173     effecttype = TMS_EFFECT_GLOBAL_GAIN;
   181     effecttype = TMS_EFFECT_GLOBAL_GAIN;
   174     return ret;
   182     return ret;
   175     }
   183     }
   176 
   184 
   177 void TMSGlobalGainEffectBodyImpl::SetParentEffect(TMSEffect*& parenteffect)
   185 void TMSGlobalGainEffectBodyImpl::SetParent(TMSEffect*& parent)
   178     {
   186     {
   179     iGlobalEffect = NULL;
   187     iParent = parent;
   180     iGlobalEffect = parenteffect;
       
   181     }
   188     }
   182 
   189 
   183 // End of file