applicationmanagement/inc/ApplicationManagementClient.h
changeset 18 7d11f9a6646f
parent 4 75a71fdb4c92
child 21 c707676bf59f
equal deleted inserted replaced
4:75a71fdb4c92 18:7d11f9a6646f
     1 /*
       
     2 * Copyright (c) 2000 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: Implementation of applicationmanagement components
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __APPLICATIONMANAGEMENTCLIENT_H__
       
    20 #define __APPLICATIONMANAGEMENTCLIENT_H__
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 #include <e32std.h>
       
    25 #include "ApplicationManagementCommon.h"
       
    26 #include "ApplicationManagementClientServer.h"
       
    27 #include "ApplicationManagementConst.h"
       
    28 #include <ssl.h>
       
    29 #include <f32file.h>
       
    30 #include <AknServerApp.h>
       
    31 #include <uikon.hrh>
       
    32 
       
    33 typedef RArray<TUint32> RElementIdArray;
       
    34 
       
    35 namespace NApplicationManagement
       
    36 	{
       
    37 
       
    38 // CLASS DECLARATION
       
    39 
       
    40 /**
       
    41 *  RApplicationManagement class to establish ApplicationManagement server connection
       
    42 */
       
    43 class RAMTC : public RSessionBase
       
    44 	{
       
    45 		public:
       
    46     /**
       
    47 	* Connect Connects client side to application management server
       
    48     * @return KErrNone Symbian error code
       
    49     */
       
    50 	IMPORT_C TInt Connect();
       
    51 	
       
    52 	
       
    53     /**
       
    54 	* Close Close server connection
       
    55     */
       
    56 	IMPORT_C void Close();
       
    57 
       
    58 	/**
       
    59 	* GetApplicationUidL finds uid for given deployment component.
       
    60 	* @param aInternalId Id of the deployment component, whose uid is wished
       
    61 	* @param aUid	After successful call, will hold the uid
       
    62 	*/	
       
    63 	IMPORT_C void GetApplicationUidL( TInt aInternalId, TUid &aUid );
       
    64 	};
       
    65 	
       
    66 
       
    67 
       
    68 class RApplicationManagement : public RAknAppServiceBase
       
    69 	{
       
    70 	public:
       
    71 
       
    72 	       public: // Constructors 
       
    73 
       
    74 	IMPORT_C RApplicationManagement();
       
    75 	    /**
       
    76 		* Connect Connects client side to application management server
       
    77 	    * @return KErrNone Symbian error code
       
    78         */
       
    79 		IMPORT_C TInt Connect( const TCertInfo &aCertInfo );
       
    80 		IMPORT_C TInt Connect( );
       
    81 		
       
    82 	    /**
       
    83 		* Close Close server connection
       
    84         */
       
    85 		IMPORT_C void Close();
       
    86 		
       
    87 	
       
    88 //Session management		
       
    89 	    /**
       
    90 		* DeliverL Add deployment component to the system. At least some parameter
       
    91 		* (in the aInfo or aData) must not be empty.
       
    92 		*
       
    93 		* @param aInfo  TDeploymentComponentInfo containing the essentials of component
       
    94 		* @param aData The Delivery deployment component Data
       
    95 		* @param aInstallOpts Optional install options
       
    96 		* @param aMetaData Optional meta data for install operation
       
    97 	    * @return Created Internal Id for the deployment component
       
    98         */
       
    99 	
       
   100 		/**
       
   101 		* DownloadL Adds deployment component with EDCSDownload to the system. 
       
   102 		* @param aUserId The user id of the component
       
   103 	    * @return Created Internal Id for the deployment component
       
   104         */
       
   105 		IMPORT_C TUint32 DownloadL( const TDCUserId &aUserId ) const;
       
   106 			
       
   107 		IMPORT_C TUint32 DeliverL( const TDCUserId &aUserId ) const;
       
   108 		/**
       
   109 		* DeploymentComponent Returns the deployment component having the given Id.
       
   110 		* If there's no such deployment component, method returns
       
   111 		* KErrNotFound. 
       
   112 		
       
   113 		* @param aId Id of the component to be found
       
   114 	    * @return KErrNone  Symbian error code (KErrNotFound if not found)
       
   115 		*/
       
   116 		IMPORT_C TInt DeploymentComponent( 
       
   117 			TUint32 aInternalId, TDeploymentComponent &aReturnValue ) const;
       
   118 			
       
   119 		/**
       
   120 		* DeploymentComponentUserId Returns the user id of deployment component 
       
   121 		* having the given internal Id.
       
   122 		* @param aId Id of the component to be found
       
   123 		* @param aResponse The buffer in which the user id will be placed
       
   124 	    * @return KErrNone  Symbian error code (KErrNotFound if not found)
       
   125 		*/
       
   126 		IMPORT_C void DeploymentComponentUserIdL( 
       
   127 			TUint32 aInternalId, TDCUserId &aResponse ) const;
       
   128 	
       
   129 		/**
       
   130 		* DeploymentComponentDataL Fetches data for component that's in EDCSDelivered state.
       
   131 		* @param aInternalId Id of the component to be found
       
   132 		* @param aDataType Type of the data to be found. Must be one of EDCInstallOptions
       
   133 		*		EDCMetaData, EDCData, 
       
   134 		* @param aBuffer The buffer that will be filled with the data
       
   135 	    * @return 
       
   136 		*/
       
   137 		IMPORT_C void DeploymentComponentDataL( 
       
   138 			TUint32 aInternalId, TDeplCompAttrType aDataType, CBufBase &aBuffer ) const;
       
   139 			
       
   140 		
       
   141 		/**
       
   142 		* UpdateDeploymentComponentL Updates deployment component.
       
   143 		* @param aInternalId Id of the component to be updated
       
   144 		* @param aItem Type of the data to be updated.
       
   145 		* @param aItemData The data
       
   146 	    * @leave The deployment component, or NULL if there's not one
       
   147 		*/
       
   148 		IMPORT_C void UpdateDeploymentComponentL( TUint32 aInternalId,
       
   149 			TDeplCompAttrType aItem, const TDesC8 &aItemData ) const;
       
   150 		
       
   151 		/**
       
   152 		* UpdateDeploymentComponentL Updates deployment component with mime type too.
       
   153 		* @param aInternalId Id of the component to be updated
       
   154 		* @param aItem Type of the data to be updated. This must be 
       
   155 		*	EDCMetaData or EDCData for call to be successful
       
   156 		* @param aItemData The data
       
   157 		* @param aDataMime The data mime type
       
   158 	    * @leave The deployment component, or NULL if there's not one
       
   159 		*/	
       
   160 		IMPORT_C void UpdateDeploymentComponentDataL( 
       
   161 			TUint32 aInternalId, TDeplCompAttrType aItem, 
       
   162 			const TDesC8 &aItemData, const TDesC8 &aDataMime ) const; 
       
   163 
       
   164 		/**
       
   165 		* UpdateDeploymentComponentStreamedDataL Updates deployment component with mime type too.
       
   166 		* @param aInternalId Id of the component to be updated
       
   167 		* @param aItem Type of the data to be updated. This must be 
       
   168 		*	EDCMetaData or EDCData for call to be successful
       
   169 		* @param aDataMime The data mime type
       
   170 	    * @leave The deployment component, or NULL if there's not one
       
   171 		*/	
       
   172 		IMPORT_C void UpdateDeploymentComponentStreamedDataL( 
       
   173 			TUint32 aInternalId, TDeplCompAttrType aItem, const TDesC8 &aDataMime ) const; 
       
   174 		
       
   175 		/**
       
   176 		* DeploymentComponentIds Returns array of the deployment component Ids, that exist in the
       
   177 		* system. Optionally one can give a TDeploymentComponentState flag to restrict
       
   178 		* resulted ids to those components that has the given state.
       
   179 		* @param aArray Will hold the response
       
   180 		* @param aState Optional state of the wished deployment components
       
   181 	    * @return KErrNone Symbian error code
       
   182 		*/
       
   183 		IMPORT_C TInt DeploymentComponentIdsL(
       
   184 			RElementIdArray &aArray, 
       
   185 			const TDeploymentComponentState aState = EDCSNone  ) const;
       
   186 			
       
   187 		/**
       
   188 		* InstallL Installs given deployment component.
       
   189 		* @param aInternalId The id of deployment component to be installed
       
   190 	    * @param aTargetState Will the installed component be actibve or inactive (default active)
       
   191 		* @return KErrNone Symbian error code
       
   192 		*/
       
   193 		IMPORT_C void InstallL( TUint32 aInternalId , 
       
   194 			TDeploymentComponentState aTargetState = EDCSActive) const;
       
   195 
       
   196 		/**
       
   197 		* RemoveL Removes given deployment component.
       
   198 		* @param aInternalId The id of the component to be removed
       
   199 	    * @return 
       
   200 		*/
       
   201 		IMPORT_C void RemoveL( TUint32 aInternalId ) const;
       
   202 		
       
   203 		/**
       
   204 		* UpdateL Updates the given deployment
       
   205 		* @param aSourceInternalId The id of the component that is source of update
       
   206 		* @param aTargetInternalId The id of the component that is target of update
       
   207 	    * @leave 
       
   208 		*/
       
   209 		IMPORT_C void UpdateL( TUint32 aSourceInternalId, TUint32 aTargetInternalId ) const;
       
   210 		
       
   211 		/**
       
   212 		* StartDownloadL Starts download of deployment component.
       
   213 		* @param aInternalId The id of the component to be downloaded
       
   214 		* @param aTargetState The target state of download (
       
   215 	    * @return 
       
   216 		*/
       
   217 		IMPORT_C void StartDownloadL( TUint32 aInternalId, 
       
   218 			const TDownloadTarget aTarget= EDeliver  ) const;
       
   219 		
       
   220 		
       
   221 	 	/**
       
   222 		* StateChangingDCIds Returns array of the deployment component Ids, that are
       
   223 		* in the state changing list. Currently they are those that are being downloaded.
       
   224 		* @param aArray Will hold the response
       
   225 		
       
   226 	    * @return KErrNone Symbian error code
       
   227 		*/
       
   228 		IMPORT_C TInt StateChangingDCIdsL( RElementIdArray &aArray ) const;
       
   229 		
       
   230 		/**
       
   231 		* StateChangeComplete Informs server that the state of component is updated in the
       
   232 		*	adapter, and that it thus can be removed from the list of state changing objects.
       
   233 		* @param aInternalId The id of the component to be removed from list
       
   234 		*
       
   235 	    * @return KErrNone Symbian error code
       
   236 		*/
       
   237 		IMPORT_C TInt StateChangeComplete( TUint32 aInternalId ) const;
       
   238 		
       
   239 		/**
       
   240 		* ActivateL Tries to activate given deployment component
       
   241 		*	
       
   242 		* @param aInternalId The id of the component to be activated
       
   243 		*/
       
   244 		IMPORT_C void ActivateL( TUint32 aInternalId ) const;
       
   245 		
       
   246 		/**
       
   247 		* DeactivateL Tries to deactivate given deployment component
       
   248 		*	
       
   249 		* @param aInternalId The id of the component to be deactivated
       
   250 		*/
       
   251 		IMPORT_C void DeactivateL( TUint32 aInternalId ) const;
       
   252 		
       
   253 		/**
       
   254 		* DeploymentComponentDataSizeL Get deployment component attribute size
       
   255 		*	
       
   256 		* @param aInternalId The id of the component 
       
   257 		* @param aItem The type of attribute whose size is to be got
       
   258 		* @return The size
       
   259 		*/
       
   260 		IMPORT_C TInt DeploymentComponentDataSizeL( TUint32 aInternalId, 
       
   261 			const TDeplCompAttrType &aItem ) const;
       
   262 
       
   263 		/**
       
   264 		* DeploymentComponentTempInstFile ask file handle from server to be used
       
   265 		*	
       
   266 		* @param aTempFile temporary file handle 
       
   267 		* @param aItem The type of attribute whose type of temporary file to get
       
   268 	    * @return KErrNone Symbian error code
       
   269 		*/
       
   270 		IMPORT_C void DeploymentComponentTempInstFileL( TUint32 aInternalId, RFile& aTempFile, const TDeplCompAttrType &aItem ) const;
       
   271 
       
   272 		/**
       
   273 		 * GetFinalResultsForGAL ask results from AM Server. In response AM 
       
   274          * server returns final result and target URI of node
       
   275          *	
       
   276          * @param aInternalId The id of the component 
       
   277          * @param aFinalResult Final result of deployment component
       
   278          * @param aTargetURI Target URI of deployment component
       
   279          * @return void
       
   280          */
       
   281 		IMPORT_C void GetFinalResultsForGAL(TUint32 aInternalId, TInt& aFinalResult,  TDes8& aTargetURI) const;
       
   282 		
       
   283 		IMPORT_C void GenericAlertSentL(TUint32 aInternalId) const;
       
   284 		
       
   285 		/**
       
   286 		* Implementation of Service UID() from base class. Returns AM service UID 
       
   287 		* to framework
       
   288 		*	
       
   289 		* @return uid of AM service UID
       
   290 		*/	
       
   291 		TUid ServiceUid() const;  
       
   292         /**
       
   293          * CheckStatusNodes Checks all deployed,delivered and download component's status node values
       
   294          * and set the state accordingly. For ex, on first SCOMO session if status node = Download progress
       
   295          * which means that download operation is failed in previous sessiona and hence we need to set the
       
   296          * value of status node to Download failed.
       
   297          *   
       
   298          */
       
   299         IMPORT_C void CheckStatusNodesL( ) const;
       
   300 		  
       
   301 	private:	
       
   302 	};
       
   303 
       
   304 
       
   305 	}
       
   306 
       
   307 #endif //__APPLICATIONMANAGEMENTCLIENT_H__
       
   308 
       
   309 
       
   310 //  End of File