remotemgmt_plat/sync_service_api/inc/SyncService.h
branchRCL_3
changeset 26 19bba8228ff0
parent 0 b497e44ab2fc
equal deleted inserted replaced
25:b183ec05bd8c 26:19bba8228ff0
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Client-side service implementations
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef SYNCSERVICE_H
       
    20 #define SYNCSERVICE_H
       
    21 
       
    22 #include <AknServerApp.h>
       
    23 #include <SyncServiceConst.h>
       
    24 
       
    25 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    26 #include <apaidpartner.h>
       
    27 #else
       
    28 #include <apaid.h>
       
    29 #endif
       
    30 
       
    31 
       
    32 struct  TSyncServiceParam
       
    33  	{
       
    34  	TUint   iJobId;
       
    35  	TUint   iProfileId;
       
    36  	TUint   iServiceId;
       
    37  	TUint   iSilent;
       
    38  	};
       
    39  	
       
    40 /**
       
    41 *  RSyncService  
       
    42 *
       
    43 *  Lower level client side service class
       
    44 *
       
    45 *  @lib syncservice.lib
       
    46 *  @since Series 60 3.0
       
    47 */
       
    48 class RSyncService : public RAknAppServiceBase
       
    49 	{
       
    50 	public: 
       
    51 		/**
       
    52 		* Sends the synchronisation start command to the
       
    53 		* server side with parameters aParams
       
    54 		*/
       
    55 		void StartSyncL( TSyncServiceParam aParam );
       
    56 		
       
    57 		/**
       
    58 		* Sends command that enables or disables the SyncML session
       
    59 		* progress notes to the server side.
       
    60 		* @param aEnabled Should the progress note be enabled or disabled.
       
    61 		*/
       
    62 		void EnableProgressNoteL( TBool aEnabled );
       
    63 
       
    64 	private: // From RApaAppServiceBase
       
    65 		/**
       
    66 		* Returns the uid of the service
       
    67 		*/
       
    68 		TUid ServiceUid() const;
       
    69 	};
       
    70 
       
    71 /**
       
    72 *  CSyncService  
       
    73 *
       
    74 *  Higher level client side service class
       
    75 *
       
    76 *  @lib syncservice.lib
       
    77 *  @since Series 60 3.0
       
    78 */
       
    79 class CSyncService : public CBase
       
    80 	{
       
    81 	public:
       
    82 
       
    83         /**
       
    84         * Two-phased constructor.
       
    85         */
       
    86 		IMPORT_C static CSyncService* NewL( MAknServerAppExitObserver* aObserver,
       
    87 		                                    TUint aServiceId );
       
    88 		
       
    89         /**
       
    90         * Destructor.
       
    91         */
       
    92         virtual ~CSyncService();
       
    93 		
       
    94     public:
       
    95 
       
    96 		/**
       
    97 		* StartSyncL
       
    98 		*
       
    99 		* @param aParam Parameters for the service so that it
       
   100 		*               knows which service command to issue
       
   101         * @return None
       
   102 		*/
       
   103     	IMPORT_C TUid StartSyncL( TSyncServiceParam aParam );
       
   104 
       
   105 		/**
       
   106 		* Sends a command to the sync or devman application to
       
   107 		* indicate that the progress note should be enabled
       
   108 		* or disabled.
       
   109 		* @param aEnabled Should the progress not be shown.
       
   110         * @return None
       
   111 		*/
       
   112         IMPORT_C void EnableProgressNoteL( TBool aEnabled );
       
   113         
       
   114 	private:
       
   115 	
       
   116         /**
       
   117         * C++ default constructor.
       
   118         */
       
   119 		CSyncService();
       
   120 	
       
   121 		/**
       
   122 		* 2nd phase constructor
       
   123 		* First calls Discover to find the right application with aParams.
       
   124 		* Then calls iService to connect to right application.
       
   125 		* Creates an instance of CApaServerAppExitMonitor		
       
   126 		* Creates an instance of CSyncService.
       
   127 		* Sets itself as observer for the service.
       
   128 		*
       
   129 		* @param aObserver  pointer of MAknServerAppExitObserver to be passed to iMonitor
       
   130 		* @param aServiceId parameters for the service so that it
       
   131 		*                   knows which application to start	
       
   132         * @return None
       
   133 		*/
       
   134 		void ConstructL(  MAknServerAppExitObserver* aObserver,
       
   135 		                  TUint aServiceId );
       
   136 
       
   137 		/**
       
   138 		* DiscoverL
       
   139 		* Finds the right application id to be started and returns it.
       
   140 		* Connects RApaLsSession and initializes
       
   141 		* it with GetServerApps command. Then gets all the services that
       
   142 		* implement the service by using GetServiceImplementationsLC. 
       
   143 		* Calls TryMatchL for each service and if there's a match,
       
   144 		* the appId is returned. If no implementation is found, 0 is returned.
       
   145 		*
       
   146 		* @param aServiceId parameters for the service so that it
       
   147 		*                   knows which application to start	
       
   148         * @return None
       
   149 		*/
       
   150     	TUid DiscoverL( TUint aServiceId );
       
   151 
       
   152 		/**
       
   153 		* TryMatchL
       
   154 		* Reads the service type information from OpaqueData.
       
   155 		* Sets aAppUi as the application id.
       
   156 		*
       
   157 		* @param aInfo      Application service information.
       
   158         * @param aAppUid    Application Uid
       
   159 		* @param aServiceId Parameters for the service so that it
       
   160 		*                   knows which application to start
       
   161         * @return Boolean   ETrue if not found, returns EFalse.
       
   162 		*/
       
   163     	TBool TryMatchL( const TApaAppServiceInfo aInfo,
       
   164     	                 TUid& aAppUid,
       
   165     	                 TUint aServiceId );
       
   166 
       
   167 	private:
       
   168 		// Lower level client-side service implementation
       
   169 		RSyncService 		        iService;
       
   170 		// Monitor for checking events from the server side
       
   171 		CApaServerAppExitMonitor* 	iMonitor;
       
   172 		TSyncServiceParam           iParameters;
       
   173 		TUid                        iUid;
       
   174 		TUint                       iServiceId;
       
   175 	};
       
   176 
       
   177 #endif  // SYNCSERVICE_H
       
   178 
       
   179 // End of File
       
   180