diff -r 02103bf20ee5 -r 90dbfc0435e3 bluetoothengine/headsetsimulator/core/inc/ProfileManager/hsprofilemanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/headsetsimulator/core/inc/ProfileManager/hsprofilemanager.h Wed Sep 15 15:59:44 2010 +0200 @@ -0,0 +1,249 @@ +/* + * Component Name: Headset Simulator + * Author: Comarch S.A. + * Version: 1.0 + * Copyright (c) 2010 Comarch S.A. + * + * This Software is submitted by Comarch S.A. to Symbian Foundation Limited on + * the basis of the Member Contribution Agreement entered between Comarch S.A. + * and Symbian Foundation Limited on 5th June 2009 (“Agreement”) and may be + * used only in accordance with the terms and conditions of the Agreement. + * Any other usage, duplication or redistribution of this Software is not + * allowed without written permission of Comarch S.A. + * + */ + +#ifndef HSPROFILEMANAGER_H +#define HSPROFILEMANAGER_H + +#include +#include +#include + +class CHsProfileBase; +class CHsCoDBase; +class CHsSdpBase; + +/** + * @brief Manages plugins loaded to Headset Simulator. + */ +class CHsProfileManager : public CBase +{ +public: + + /** + * Two-phased constructor. + * + * @return class instance + */ + static CHsProfileManager* NewL(); + + /** + * Two-phased constructor. + * + * @return class instance + */ + static CHsProfileManager* NewLC(); + + /** + * Destructor. + */ + ~CHsProfileManager(); + +public: + + /** + * Creates instance of profile's implementation + * + * @param aProfileUid implementation's Uid + */ + void LookupAndManageProfileL( const TUid aProfileUid ); + + /** + * Creates instance of profile's implementation + * + * @param aProfileName implementation's name + */ + void LookupAndManageProfileL( const TDesC8 &aProfileName ); + + /** + * Unloads profile implementation + */ + void UnloadProfile(); + + /** + * Creates instance of SDP plugin's implementation + * + * @pre call SetSdpServicePort() + * + * @param aSdpUid implementation's Uid + */ + void LookupAndManageSdpL( const TUid aSdpUid ); + + /** + * Creates instance of SDP plugin's implementation + * + * @pre call SetSdpServicePort() + * + * @param aSdpName implementation's name + */ + void LookupAndManageSdpL( const TDesC8 &aSdpName ); + + /** + * Sets port number for SDP record + * + * @param aPort port number + */ + void SetSdpServicePort( TInt aPort ); + + /** + * Reloads SDP plugin's implementation + */ + void RefreshSdp(); + + /** + * Loads SDP plugin's implementation + * @pre call LookupAndManageSdpL() + */ + void LoadSdpL(); + + /** + * Unloads SDP plugin's implementation + */ + void UnloadSdpL(); + + /** + * Creates instance of Class of Device plugin's implementation + * + * @param aCoDUid implementation's Uid + */ + void LookupAndManageCodL( const TUid aCoDUid ); + + /** + * Creates instance of Class of Device plugin's implementation + * + * @param aCoDName implementation's name + */ + void LookupAndManageCodL( const TDesC8 &aCoDName ); + + /** + * Loads Class of Device plugin + * + * @pre call LookupAndManageCoDL() + */ + void LoadCodL(); + + /** + * Unloads Class of Device plugin + */ + void UnloadCodL(); + + /** + * Checks if SDP plugin exists + * + * @return ETrue if plugin's instance is loaded. Otherwise EFalse + */ + TBool IsSdpPluginLoaded(); + + /** + * Checks if Profile plugin exists + * + * @return ETrue if plugin's instance is loaded. Otherwise EFalse + */ + TBool IsProfilePluginLoaded(); + + /** + * Checks if CoD plugin exists + * + * @return ETrue if plugin's instance is loaded. Otherwise EFalse + */ + TBool IsCoDPluginLoaded(); + + /** + * Handles AT commands passed to profile plugin + * + * @param aCommandsIn data passed to profile's implementation + * @param aCommandOut response from profile's implementation + * @param aFromAG denotes if passed command should be treated as + * sent from AG + */ + void HandleCommandL( const TDesC8 &aCommandsIn, TDes8 &aCommandOut, + TBool aFromAG = ETrue ); + + /** + * Handles client disconnection event + * + * @param aErr disconnection reason + */ + void HandleClientDisconnected( TInt aErr ); + + /** + * Handles client connection event. + * Profile may start initialization procedure if necessary. + * + * @param aCommandOut response from profile's implementation + */ + void HandleClientConnected( TDes8& aCommandOut ); + + /** + * Sends request to profile to accept incoming call. + * + * @param aProfileResponse AT response + */ + void AcceptIncomingCallL( TDes8& aProfileResponse ); + + /** + * Sends request to profile to release ongoing call. + * + * @param aProfileResponse AT response + */ + void ReleaseOngoingCallL( TDes8& aProfileResponse ); + +private: + /** + * Constructor for performing 1st stage construction + */ + CHsProfileManager(); + + /** + * Default constructor for performing 2nd stage construction + */ + void ConstructL(); + +private: + + /** + * Destroys profile plugin + */ + void DestroyProfile(); + + /** + * Destroys SDP plugin + */ + void DestroySdpL(); + + /** + * Destroys CoD plugin + */ + void DestroyCodL(); + +private: + + /** Port number */ + TInt iSdpServicePort; + + /** Denotes if SDP plugin exists */ + TBool iSdpSet; + + /** Pointer to profile plugin */ + CHsProfileBase *iProfilePlugin; + + /** Pointer to CoD plugin */ + CHsCoDBase *iCoDPlugin; + + /** Pointer to SDP plugin */ + CHsSdpBase *iSdpPlugin; + +}; + +#endif // HSPROFILMENAGER_H