mmshplugins/mmshaoplugin/src/musaoplugin.cpp
branchRCL_3
changeset 23 bc78a40cd63c
parent 22 73a1feb507fb
equal deleted inserted replaced
22:73a1feb507fb 23:bc78a40cd63c
    14 * Description:  Main plugin class
    14 * Description:  Main plugin class
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 #include "musmanager.h"
       
    20 #include "musresourceproperties.h"
    19 #include "musresourceproperties.h"
    21 #include "mussesseioninformationapi.h"
    20 #include "mussesseioninformationapi.h"
    22 #include "mussettingskeys.h"
    21 #include "mussettingskeys.h"
    23 #include "mussessionproperties.h"
    22 #include "mussessionproperties.h"
    24 #include "mussettings.inl"
    23 #include "mussettings.inl"
    31 #include "muslogger.h"
    30 #include "muslogger.h"
    32 
    31 
    33 #include <AlwaysOnlineManagerCommon.h>
    32 #include <AlwaysOnlineManagerCommon.h>
    34 #include <AlwaysOnlineManagerClient.h>
    33 #include <AlwaysOnlineManagerClient.h>
    35 #include <mmtsy_names.h>
    34 #include <mmtsy_names.h>
       
    35 #include <featmgr.h>
       
    36 
       
    37 using namespace NMusSessionInformationApi;
    36 
    38 
    37 // -----------------------------------------------------------------------------
    39 // -----------------------------------------------------------------------------
    38 // Symbian two-phase constructor.
    40 // Symbian two-phase constructor.
    39 // -----------------------------------------------------------------------------
    41 // -----------------------------------------------------------------------------
    40 //
    42 //
    63 // -----------------------------------------------------------------------------
    65 // -----------------------------------------------------------------------------
    64 //
    66 //
    65 void CMusAoPlugin::ConstructL()
    67 void CMusAoPlugin::ConstructL()
    66     {
    68     {
    67     MUS_LOG( "mus: [MUSAO]  -> CMusAoPlugin::ConstructL" )
    69     MUS_LOG( "mus: [MUSAO]  -> CMusAoPlugin::ConstructL" )
    68     DefinePropertiesL();
    70 	FeatureManager::InitializeLibL();
    69     User::LeaveIfError( iServer.Connect() );
    71     TBool support = FeatureManager::FeatureSupported( KFeatureIdMultimediaSharing );
    70     User::LeaveIfError( iPhone.Open( iServer, KMmTsyPhoneName() ) );        
    72 	FeatureManager::UnInitializeLib();
    71     iTsyPropertyMonitor = CMusTsyPropertyMonitor::NewL(iPhone, *this );    
    73 	if ( support )
    72     iPropertyMonitor = CMusPropertyMonitor::NewL(*this);    
    74 		{
    73     // Enable the below line if Kodiak Ptt has to be monitered
    75         DefinePropertiesL();
    74     // iPttCallMonitor = CMusPttCallMonitor::NewL(*iLineMonitor);    
    76         User::LeaveIfError( iServer.Connect() );
    75     
    77         User::LeaveIfError( iPhone.Open( iServer, KMmTsyPhoneName() ) );        
       
    78         iTsyPropertyMonitor = CMusTsyPropertyMonitor::NewL(iPhone);    
       
    79         iPropertyMonitor = CMusPropertyMonitor::NewL();    
       
    80         // Enable the below line if Kodiak Ptt has to be monitered
       
    81         // iPttCallMonitor = CMusPttCallMonitor::NewL(*iLineMonitor); 
       
    82 		}
    76     MUS_LOG( "mus: [MUSAO]  <- CMusAoPlugin::ConstructL" )
    83     MUS_LOG( "mus: [MUSAO]  <- CMusAoPlugin::ConstructL" )
    77     }
    84     }
    78 
    85 
    79 // -----------------------------------------------------------------------------
    86 // -----------------------------------------------------------------------------
    80 // C++ destructor.
    87 // C++ destructor.
    82 //
    89 //
    83 CMusAoPlugin::~CMusAoPlugin()
    90 CMusAoPlugin::~CMusAoPlugin()
    84     {
    91     {
    85     MUS_LOG( "-> CMusAoPlugin::~CMusAoPlugin" )
    92     MUS_LOG( "-> CMusAoPlugin::~CMusAoPlugin" )
    86     // should never come here, because service should always be on
    93     // should never come here, because service should always be on
    87     delete iManager;
       
    88     delete iPropertyMonitor;
    94     delete iPropertyMonitor;
    89     delete iTsyPropertyMonitor;
    95     delete iTsyPropertyMonitor;
    90     // Enable the below line if Kodiak Ptt has to be monitered
    96     // Enable the below line if Kodiak Ptt has to be monitered
    91     // delete iPttCallMonitor;
    97     // delete iPttCallMonitor;
    92     DeleteProperties();
    98     DeleteProperties();
   134                     RProperty::EText,KEmptyTelNumber); 
   140                     RProperty::EText,KEmptyTelNumber); 
   135     DefinePropertyL(NMusSessionInformationApi::KMUSForbidden,
   141     DefinePropertyL(NMusSessionInformationApi::KMUSForbidden,
   136                  RProperty::EInt,( TInt ) NMusSessionInformationApi::EMUSAllowed); 
   142                  RProperty::EInt,( TInt ) NMusSessionInformationApi::EMUSAllowed); 
   137     DefinePropertyL(NMusSessionInformationApi::KMusCallDirection,
   143     DefinePropertyL(NMusSessionInformationApi::KMusCallDirection,
   138                 RProperty::EInt,( TInt ) NMusSessionInformationApi::ENoDirection);  
   144                 RProperty::EInt,( TInt ) NMusSessionInformationApi::ENoDirection);  
   139     _LIT( KEmptyCallProvider,"" );
   145     DefinePropertyL(NMusSessionInformationApi::KMUSPrivacy,
   140     DefinePropertyL(NMusSessionInformationApi::KMUSCallProvider,
   146                 RProperty::EInt,( TInt ) NMusSessionInformationApi::EPrivacyOff);  
   141                         RProperty::EText,KEmptyCallProvider);
   147     DefinePropertyL(KMusClirSetting,
   142 
   148                 RProperty::EInt,( TInt ) ESendOwnNumber);  
       
   149                               
       
   150  
   143     MUS_LOG( "mus: [MUSAO]  <- CMusAoPlugin::DefineResourceProperties" )
   151     MUS_LOG( "mus: [MUSAO]  <- CMusAoPlugin::DefineResourceProperties" )
   144     }
   152     }
   145 
   153 
   146 // -----------------------------------------------------------------------------
   154 // -----------------------------------------------------------------------------
   147 // CMusAoPlugin::DefineProperty()
   155 // CMusAoPlugin::DefineProperty()
   218     DeleteProperty(NMusResourceApi::KKeypadAvailability);    
   226     DeleteProperty(NMusResourceApi::KKeypadAvailability);    
   219     DeleteProperty(NMusResourceApi::KCameraInformation);
   227     DeleteProperty(NMusResourceApi::KCameraInformation);
   220     DeleteProperty(NMusSessionInformationApi::KMusCallEvent);
   228     DeleteProperty(NMusSessionInformationApi::KMusCallEvent);
   221     DeleteProperty(NMusSessionInformationApi::KMusCallCount);
   229     DeleteProperty(NMusSessionInformationApi::KMusCallCount);
   222     DeleteProperty(NMusSessionInformationApi::KMusTelNumber);
   230     DeleteProperty(NMusSessionInformationApi::KMusTelNumber);
   223     DeleteProperty(NMusSessionInformationApi::KMUSCallProvider);
       
   224     DeleteProperty(NMusSessionInformationApi::KMUSForbidden);
   231     DeleteProperty(NMusSessionInformationApi::KMUSForbidden);
   225     DeleteProperty(NMusSessionInformationApi::KMusCallDirection);
   232     DeleteProperty(NMusSessionInformationApi::KMusCallDirection);
       
   233     DeleteProperty(NMusSessionInformationApi::KMUSPrivacy);
       
   234     DeleteProperty(KMusClirSetting);
   226     MUS_LOG( "mus: [MUSAO]  <- CMusAoPlugin::DeleteResourcePropertiesL" )
   235     MUS_LOG( "mus: [MUSAO]  <- CMusAoPlugin::DeleteResourcePropertiesL" )
   227     }
   236     }
   228 
   237 
   229 // -----------------------------------------------------------------------------
   238 // -----------------------------------------------------------------------------
   230 // CMusAoPlugin::DeleteProperty()
   239 // CMusAoPlugin::DeleteProperty()
   248     MUS_LOG( "mus: [MUSAO]  -> CMusAoPlugin::HandleServerCommandL" )
   257     MUS_LOG( "mus: [MUSAO]  -> CMusAoPlugin::HandleServerCommandL" )
   249     MUS_LOG( "mus: [MUSAO]  <- CMusAoPlugin::HandleServerCommandL: KErrNone" )
   258     MUS_LOG( "mus: [MUSAO]  <- CMusAoPlugin::HandleServerCommandL: KErrNone" )
   250     return &iError;;
   259     return &iError;;
   251     }
   260     }
   252 
   261 
   253 // -----------------------------------------------------------------------------
       
   254 // CMusAoPlugin::StartMusClient()
       
   255 // This will start the MusManager Client which inturn should start
       
   256 // MusManager Server and Availability Plugin.
       
   257 // -----------------------------------------------------------------------------
       
   258 //
       
   259 void CMusAoPlugin::StartMusClientL()
       
   260     {
       
   261     MUS_LOG( "mus: [MUSAO]  -> CMusAoPlugin::StartMusClient" )
       
   262     if( !iManager )
       
   263         {
       
   264         iManager = CMusManager::NewL();
       
   265         }
       
   266     iManager->ExamineAvailabilityL();   
       
   267     MUS_LOG( "mus: [MUSAO]  <- CMusAoPlugin::StartMusClient" ) 
       
   268     }
       
   269 
       
   270 // -----------------------------------------------------------------------------
       
   271 // CMusAoPlugin::StopMusClient()
       
   272 // This will stop the MusManager Client which inturn should stop
       
   273 // MusManager Server and Availability Plugin.
       
   274 // -----------------------------------------------------------------------------
       
   275 //
       
   276 void CMusAoPlugin::StopMusClient()
       
   277     {
       
   278     MUS_LOG( "mus: [MUSAO]  -> CMusAoPlugin::StopMusClient" )
       
   279     if( iManager )
       
   280         {
       
   281         delete iManager;
       
   282         iManager = NULL;
       
   283         }
       
   284     MUS_LOG( "mus: [MUSAO]  <- CMusAoPlugin::StopMusClient" )
       
   285     }
       
   286 
       
   287 // -----------------------------------------------------------------------------
       
   288 // From MMusCallStateObserver
       
   289 // CMusAoPlugin::MusCallStateChanged()
       
   290 // -----------------------------------------------------------------------------
       
   291 //
       
   292 void CMusAoPlugin::MusCallStateChanged( )
       
   293     {
       
   294     MUS_LOG( "mus: [MUSAO]  -> CMusAoPlugin::MusCallStateChanged" )
       
   295 
       
   296     TBool dataReady = EFalse;
       
   297     TRAPD( error, dataReady = iTsyPropertyMonitor->IsDataReadyL() )
       
   298     
       
   299     if ( error == KErrNone &&
       
   300             dataReady &&
       
   301             iPropertyMonitor->IsCallConnected() )
       
   302         {
       
   303         MUS_LOG( "mus: [MUSAO]  Starting Mush Client" )
       
   304         TRAP( error, StartMusClientL() )
       
   305         
       
   306         MUS_LOG1("mus: [MUSAO]  Error Ocurred = %d",error )
       
   307         
       
   308         if ( error != KErrNone )
       
   309             {
       
   310             StopMusClient();
       
   311             }
       
   312         }
       
   313     else
       
   314         {
       
   315         MUS_LOG( "mus: [MUSAO]  Stopping Mush Client" )
       
   316         StopMusClient();
       
   317         }
       
   318     MUS_LOG( "mus: [MUSAO]  <- CMusAoPlugin::MusCallStateChanged" )
       
   319     }
       
   320 
   262 
   321 // End of file
   263 // End of file