localconnectivityservice/obexsendservices/obexserviceirsend/src/IRSSProvider.cpp
branchRCL_3
changeset 39 4096754ee773
parent 38 3dcb815346df
child 40 52a167391590
equal deleted inserted replaced
38:3dcb815346df 39:4096754ee773
     1 /*
       
     2 * Copyright (c) 2002 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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 
       
    21 #include <AiwCommon.hrh>
       
    22 
       
    23 #include <AiwMenu.h>
       
    24 #include <irssmenu.rsg>
       
    25 #include <btnotif.h>        	// Notifier UID's
       
    26 #include <aknnotewrappers.h> 	//For notifier
       
    27 #include <featmgr.h>
       
    28 #include "IrSSProvider.h"
       
    29 #include "IrSendingServiceDebug.h"
       
    30 #include "IRClient.h"
       
    31 
       
    32 #include <data_caging_path_literals.hrh>
       
    33 
       
    34 _LIT( KIRSendingServiceFileDrive, "z:");
       
    35 _LIT( KIRSSResFileName,"IRSSMenu.rsc");
       
    36 
       
    37 // ============================ MEMBER FUNCTIONS ===============================
       
    38 
       
    39 // -----------------------------------------------------------------------------
       
    40 // CIRSSProvider::CIRSSProvider
       
    41 // C++ default constructor can NOT contain any code, that
       
    42 // might leave.
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 CIRSSProvider::CIRSSProvider()
       
    46 	{
       
    47 	}
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // CIRSSProvider::ConstructL
       
    51 // Symbian 2nd phase constructor can leave.
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 void CIRSSProvider::ConstructL()
       
    55     {
       
    56    
       
    57     }
       
    58 
       
    59 // -----------------------------------------------------------------------------
       
    60 // CIRSSProvider::NewL
       
    61 // Two-phased constructor.
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 CIRSSProvider* CIRSSProvider::NewL()
       
    65     {
       
    66     CIRSSProvider* self = new( ELeave ) CIRSSProvider;
       
    67     CleanupStack::PushL( self );
       
    68     self->ConstructL();
       
    69     CleanupStack::Pop();
       
    70     return self;
       
    71     }
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // Destructor
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 CIRSSProvider::~CIRSSProvider()
       
    78 	{ 
       
    79 	
       
    80 	}
       
    81 
       
    82 // -----------------------------------------------------------------------------
       
    83 // CIRSSProvider::InitialiseL
       
    84 // -----------------------------------------------------------------------------
       
    85 //
       
    86 void CIRSSProvider::InitialiseL(MAiwNotifyCallback& /*aFrameworkCallback*/,
       
    87 								      const RCriteriaArray& /*aInterest*/)
       
    88 	{
       
    89 	// Not needed.
       
    90 	}
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 // CIRSSProvider::HandleMenuCmdL
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 
       
    97 void CIRSSProvider::HandleMenuCmdL( TInt    aCmdId,
       
    98 								    	    const CAiwGenericParamList& aInParamList,
       
    99 											CAiwGenericParamList& /*aOutParamList*/,
       
   100 											TUint /*aCmdOptions*/,
       
   101 											const MAiwNotifyCallback* /*aCallback*/ )
       
   102 	{	
       
   103     FeatureManager::InitializeLibL();
       
   104     if(!FeatureManager::FeatureSupported(KFeatureIdIrda))
       
   105         {
       
   106    		FLOG(_L("[IRSS]\t FeatMgr doesn't find IrDA, show not_supported "));
       
   107 	    RNotifier notifier;    
       
   108 	    User::LeaveIfError( notifier.Connect() );
       
   109 		TBTGenericInfoNotiferParamsPckg paramsPckg;
       
   110 		paramsPckg().iMessageType=EIRNotSupported;		
       
   111 		TInt status = notifier.StartNotifier(KBTGenericInfoNotifierUid, paramsPckg);
       
   112 	    if ( status != KErrNone )
       
   113 	        {
       
   114 	        FTRACE(FPrint(_L("[IRSS]\t void CIRSSProvider::HandleMenuCmdL()  ERROR: StartNotifier() failed. Code: %d "), status));
       
   115 	        }	    
       
   116 	    notifier.Close();    	
       
   117 	    User::Leave(KErrNone);
       
   118     	}    	
       
   119 	FeatureManager::UnInitializeLib();
       
   120 	
       
   121     if ( &aInParamList == NULL || aInParamList.Count() <= 0 )
       
   122         {
       
   123         FLOG(_L("[IRSS]\t CIRSSProvider::HandleServiceCmdL() aOutParamList check failed: Leave"));
       
   124         User::Leave( KErrArgument );
       
   125         }
       
   126 
       
   127     if ( !iIRClient )
       
   128 	    {
       
   129 		iIRClient = CIRClient::NewL();
       
   130 		}
       
   131 	iIRClient->StartSendL( aInParamList );
       
   132 
       
   133     FLOG(_L("[BTSS]\t CBTSSProvider::HandleServiceCmdL() completed"));
       
   134     }
       
   135     
       
   136  // -----------------------------------------------------------------------------
       
   137 // CIRSSProvider::InitializeMenuPaneL
       
   138 // -----------------------------------------------------------------------------
       
   139 //
       
   140     
       
   141  void CIRSSProvider::InitializeMenuPaneL(  CAiwMenuPane& aMenuPane,
       
   142                                             TInt aIndex,
       
   143                                             TInt /* aCascadeId */,
       
   144                                             const CAiwGenericParamList& /*aInParamList*/ )
       
   145     {
       
   146     TFileName resourceFile;
       
   147     TInt resId;
       
   148     
       
   149     resourceFile += KIRSendingServiceFileDrive;
       
   150     resourceFile += KDC_RESOURCE_FILES_DIR;
       
   151     resourceFile += KIRSSResFileName;    
       
   152     resId=R_SEND_VIA_IR_MENU;
       
   153     
       
   154     aMenuPane.AddMenuItemsL(
       
   155             resourceFile, 
       
   156             resId,
       
   157             KAiwCmdSend,
       
   158             aIndex);
       
   159     }
       
   160     
       
   161  void CIRSSProvider::HandleServiceCmdL( const TInt& aCmdId, 
       
   162                                         const CAiwGenericParamList& aInParamList,
       
   163                                         CAiwGenericParamList& aOutParamList,
       
   164                                         TUint aCmdOptions,
       
   165                                         const MAiwNotifyCallback* aCallback )
       
   166     {
       
   167     HandleMenuCmdL(aCmdId,aInParamList,aOutParamList,aCmdOptions,aCallback);
       
   168     }
       
   169 
       
   170 // End of file