mmshplugins/mmshaoplugin/src/musaoplugin.cpp
branchRCL_3
changeset 22 73a1feb507fb
parent 0 f0cf47e981f9
child 23 bc78a40cd63c
equal deleted inserted replaced
21:33a5d2bbf6fc 22:73a1feb507fb
    14 * Description:  Main plugin class
    14 * Description:  Main plugin class
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
       
    19 #include "musmanager.h"
    19 #include "musresourceproperties.h"
    20 #include "musresourceproperties.h"
    20 #include "mussesseioninformationapi.h"
    21 #include "mussesseioninformationapi.h"
    21 #include "mussettingskeys.h"
    22 #include "mussettingskeys.h"
    22 #include "mussessionproperties.h"
    23 #include "mussessionproperties.h"
    23 #include "mussettings.inl"
    24 #include "mussettings.inl"
    30 #include "muslogger.h"
    31 #include "muslogger.h"
    31 
    32 
    32 #include <AlwaysOnlineManagerCommon.h>
    33 #include <AlwaysOnlineManagerCommon.h>
    33 #include <AlwaysOnlineManagerClient.h>
    34 #include <AlwaysOnlineManagerClient.h>
    34 #include <mmtsy_names.h>
    35 #include <mmtsy_names.h>
    35 #include <featmgr.h>
       
    36 
       
    37 using namespace NMusSessionInformationApi;
       
    38 
    36 
    39 // -----------------------------------------------------------------------------
    37 // -----------------------------------------------------------------------------
    40 // Symbian two-phase constructor.
    38 // Symbian two-phase constructor.
    41 // -----------------------------------------------------------------------------
    39 // -----------------------------------------------------------------------------
    42 //
    40 //
    65 // -----------------------------------------------------------------------------
    63 // -----------------------------------------------------------------------------
    66 //
    64 //
    67 void CMusAoPlugin::ConstructL()
    65 void CMusAoPlugin::ConstructL()
    68     {
    66     {
    69     MUS_LOG( "mus: [MUSAO]  -> CMusAoPlugin::ConstructL" )
    67     MUS_LOG( "mus: [MUSAO]  -> CMusAoPlugin::ConstructL" )
    70 	FeatureManager::InitializeLibL();
    68     DefinePropertiesL();
    71     TBool support = FeatureManager::FeatureSupported( KFeatureIdMultimediaSharing );
    69     User::LeaveIfError( iServer.Connect() );
    72 	FeatureManager::UnInitializeLib();
    70     User::LeaveIfError( iPhone.Open( iServer, KMmTsyPhoneName() ) );        
    73 	if ( support )
    71     iTsyPropertyMonitor = CMusTsyPropertyMonitor::NewL(iPhone, *this );    
    74 		{
    72     iPropertyMonitor = CMusPropertyMonitor::NewL(*this);    
    75         DefinePropertiesL();
    73     // Enable the below line if Kodiak Ptt has to be monitered
    76         User::LeaveIfError( iServer.Connect() );
    74     // iPttCallMonitor = CMusPttCallMonitor::NewL(*iLineMonitor);    
    77         User::LeaveIfError( iPhone.Open( iServer, KMmTsyPhoneName() ) );        
    75     
    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 		}
       
    83     MUS_LOG( "mus: [MUSAO]  <- CMusAoPlugin::ConstructL" )
    76     MUS_LOG( "mus: [MUSAO]  <- CMusAoPlugin::ConstructL" )
    84     }
    77     }
    85 
    78 
    86 // -----------------------------------------------------------------------------
    79 // -----------------------------------------------------------------------------
    87 // C++ destructor.
    80 // C++ destructor.
    89 //
    82 //
    90 CMusAoPlugin::~CMusAoPlugin()
    83 CMusAoPlugin::~CMusAoPlugin()
    91     {
    84     {
    92     MUS_LOG( "-> CMusAoPlugin::~CMusAoPlugin" )
    85     MUS_LOG( "-> CMusAoPlugin::~CMusAoPlugin" )
    93     // should never come here, because service should always be on
    86     // should never come here, because service should always be on
       
    87     delete iManager;
    94     delete iPropertyMonitor;
    88     delete iPropertyMonitor;
    95     delete iTsyPropertyMonitor;
    89     delete iTsyPropertyMonitor;
    96     // Enable the below line if Kodiak Ptt has to be monitered
    90     // Enable the below line if Kodiak Ptt has to be monitered
    97     // delete iPttCallMonitor;
    91     // delete iPttCallMonitor;
    98     DeleteProperties();
    92     DeleteProperties();
   140                     RProperty::EText,KEmptyTelNumber); 
   134                     RProperty::EText,KEmptyTelNumber); 
   141     DefinePropertyL(NMusSessionInformationApi::KMUSForbidden,
   135     DefinePropertyL(NMusSessionInformationApi::KMUSForbidden,
   142                  RProperty::EInt,( TInt ) NMusSessionInformationApi::EMUSAllowed); 
   136                  RProperty::EInt,( TInt ) NMusSessionInformationApi::EMUSAllowed); 
   143     DefinePropertyL(NMusSessionInformationApi::KMusCallDirection,
   137     DefinePropertyL(NMusSessionInformationApi::KMusCallDirection,
   144                 RProperty::EInt,( TInt ) NMusSessionInformationApi::ENoDirection);  
   138                 RProperty::EInt,( TInt ) NMusSessionInformationApi::ENoDirection);  
   145     DefinePropertyL(NMusSessionInformationApi::KMUSPrivacy,
   139     _LIT( KEmptyCallProvider,"" );
   146                 RProperty::EInt,( TInt ) NMusSessionInformationApi::EPrivacyOff);  
   140     DefinePropertyL(NMusSessionInformationApi::KMUSCallProvider,
   147     DefinePropertyL(KMusClirSetting,
   141                         RProperty::EText,KEmptyCallProvider);
   148                 RProperty::EInt,( TInt ) ESendOwnNumber);  
   142 
   149                               
       
   150  
       
   151     MUS_LOG( "mus: [MUSAO]  <- CMusAoPlugin::DefineResourceProperties" )
   143     MUS_LOG( "mus: [MUSAO]  <- CMusAoPlugin::DefineResourceProperties" )
   152     }
   144     }
   153 
   145 
   154 // -----------------------------------------------------------------------------
   146 // -----------------------------------------------------------------------------
   155 // CMusAoPlugin::DefineProperty()
   147 // CMusAoPlugin::DefineProperty()
   226     DeleteProperty(NMusResourceApi::KKeypadAvailability);    
   218     DeleteProperty(NMusResourceApi::KKeypadAvailability);    
   227     DeleteProperty(NMusResourceApi::KCameraInformation);
   219     DeleteProperty(NMusResourceApi::KCameraInformation);
   228     DeleteProperty(NMusSessionInformationApi::KMusCallEvent);
   220     DeleteProperty(NMusSessionInformationApi::KMusCallEvent);
   229     DeleteProperty(NMusSessionInformationApi::KMusCallCount);
   221     DeleteProperty(NMusSessionInformationApi::KMusCallCount);
   230     DeleteProperty(NMusSessionInformationApi::KMusTelNumber);
   222     DeleteProperty(NMusSessionInformationApi::KMusTelNumber);
       
   223     DeleteProperty(NMusSessionInformationApi::KMUSCallProvider);
   231     DeleteProperty(NMusSessionInformationApi::KMUSForbidden);
   224     DeleteProperty(NMusSessionInformationApi::KMUSForbidden);
   232     DeleteProperty(NMusSessionInformationApi::KMusCallDirection);
   225     DeleteProperty(NMusSessionInformationApi::KMusCallDirection);
   233     DeleteProperty(NMusSessionInformationApi::KMUSPrivacy);
       
   234     DeleteProperty(KMusClirSetting);
       
   235     MUS_LOG( "mus: [MUSAO]  <- CMusAoPlugin::DeleteResourcePropertiesL" )
   226     MUS_LOG( "mus: [MUSAO]  <- CMusAoPlugin::DeleteResourcePropertiesL" )
   236     }
   227     }
   237 
   228 
   238 // -----------------------------------------------------------------------------
   229 // -----------------------------------------------------------------------------
   239 // CMusAoPlugin::DeleteProperty()
   230 // CMusAoPlugin::DeleteProperty()
   257     MUS_LOG( "mus: [MUSAO]  -> CMusAoPlugin::HandleServerCommandL" )
   248     MUS_LOG( "mus: [MUSAO]  -> CMusAoPlugin::HandleServerCommandL" )
   258     MUS_LOG( "mus: [MUSAO]  <- CMusAoPlugin::HandleServerCommandL: KErrNone" )
   249     MUS_LOG( "mus: [MUSAO]  <- CMusAoPlugin::HandleServerCommandL: KErrNone" )
   259     return &iError;;
   250     return &iError;;
   260     }
   251     }
   261 
   252 
       
   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     }
   262 
   320 
   263 // End of file
   321 // End of file