bluetoothengine/headsetsimulator/core/inc/ProfileManager/hsprofilemanager.h
branchheadsetsimulator
changeset 60 90dbfc0435e3
equal deleted inserted replaced
59:02103bf20ee5 60:90dbfc0435e3
       
     1 /*
       
     2  * Component Name: Headset Simulator
       
     3  * Author: Comarch S.A.
       
     4  * Version: 1.0
       
     5  * Copyright (c) 2010 Comarch S.A.
       
     6  *  
       
     7  * This Software is submitted by Comarch S.A. to Symbian Foundation Limited on 
       
     8  * the basis of the Member Contribution Agreement entered between Comarch S.A. 
       
     9  * and Symbian Foundation Limited on 5th June 2009 (“Agreement”) and may be 
       
    10  * used only in accordance with the terms and conditions of the Agreement. 
       
    11  * Any other usage, duplication or redistribution of this Software is not 
       
    12  * allowed without written permission of Comarch S.A.
       
    13  * 
       
    14  */
       
    15 
       
    16 #ifndef HSPROFILEMANAGER_H
       
    17 #define HSPROFILEMANAGER_H
       
    18 
       
    19 #include <hssdppluginbase.h>
       
    20 #include <hscodpluginbase.h>
       
    21 #include <hsprofilepluginbase.h>
       
    22 
       
    23 class CHsProfileBase;
       
    24 class CHsCoDBase;
       
    25 class CHsSdpBase;
       
    26 
       
    27 /**
       
    28  * @brief Manages plugins loaded to Headset Simulator. 
       
    29  */
       
    30 class CHsProfileManager : public CBase
       
    31 {
       
    32 public:
       
    33 
       
    34     /**
       
    35      * Two-phased constructor.
       
    36      * 
       
    37      * @return class instance
       
    38      */
       
    39     static CHsProfileManager* NewL();
       
    40 
       
    41     /**
       
    42      * Two-phased constructor.
       
    43      * 
       
    44      * @return class instance
       
    45      */
       
    46     static CHsProfileManager* NewLC();
       
    47 
       
    48     /**
       
    49      * Destructor.
       
    50      */
       
    51     ~CHsProfileManager();
       
    52 
       
    53 public:
       
    54 
       
    55     /**
       
    56      * Creates instance of profile's implementation
       
    57      * 
       
    58      * @param aProfileUid implementation's Uid
       
    59      */
       
    60     void LookupAndManageProfileL( const TUid aProfileUid );
       
    61 
       
    62     /**
       
    63      * Creates instance of profile's implementation
       
    64      * 
       
    65      * @param aProfileName implementation's name
       
    66      */
       
    67     void LookupAndManageProfileL( const TDesC8 &aProfileName );
       
    68 
       
    69     /**
       
    70      * Unloads profile implementation
       
    71      */
       
    72     void UnloadProfile();
       
    73 
       
    74     /**
       
    75      * Creates instance of SDP plugin's implementation
       
    76      * 
       
    77      * @pre call SetSdpServicePort()
       
    78      * 
       
    79      * @param aSdpUid implementation's Uid
       
    80      */
       
    81     void LookupAndManageSdpL( const TUid aSdpUid );
       
    82 
       
    83     /**
       
    84      * Creates instance of SDP plugin's implementation
       
    85      * 
       
    86      * @pre call SetSdpServicePort()
       
    87      * 
       
    88      * @param aSdpName implementation's name
       
    89      */
       
    90     void LookupAndManageSdpL( const TDesC8 &aSdpName );
       
    91 
       
    92     /**
       
    93      * Sets port number for SDP record
       
    94      * 
       
    95      * @param aPort port number
       
    96      */
       
    97     void SetSdpServicePort( TInt aPort );
       
    98 
       
    99     /**
       
   100      * Reloads SDP plugin's implementation
       
   101      */
       
   102     void RefreshSdp();
       
   103 
       
   104     /**
       
   105      * Loads SDP plugin's implementation
       
   106      * @pre call LookupAndManageSdpL()
       
   107      */
       
   108     void LoadSdpL();
       
   109 
       
   110     /**
       
   111      * Unloads SDP plugin's implementation
       
   112      */
       
   113     void UnloadSdpL();
       
   114 
       
   115     /**
       
   116      * Creates instance of Class of Device plugin's implementation
       
   117      * 
       
   118      * @param aCoDUid implementation's Uid
       
   119      */
       
   120     void LookupAndManageCodL( const TUid aCoDUid );
       
   121 
       
   122     /**
       
   123      * Creates instance of Class of Device plugin's implementation
       
   124      * 
       
   125      * @param aCoDName implementation's name
       
   126      */
       
   127     void LookupAndManageCodL( const TDesC8 &aCoDName );
       
   128 
       
   129     /**
       
   130      * Loads Class of Device plugin
       
   131      * 
       
   132      * @pre call LookupAndManageCoDL() 
       
   133      */
       
   134     void LoadCodL();
       
   135 
       
   136     /**
       
   137      * Unloads Class of Device plugin
       
   138      */
       
   139     void UnloadCodL();
       
   140 
       
   141     /**
       
   142      * Checks if SDP plugin exists
       
   143      * 
       
   144      * @return ETrue if plugin's instance is loaded. Otherwise EFalse
       
   145      */
       
   146     TBool IsSdpPluginLoaded();
       
   147 
       
   148     /**
       
   149      * Checks if Profile plugin exists
       
   150      * 
       
   151      * @return ETrue if plugin's instance is loaded. Otherwise EFalse
       
   152      */
       
   153     TBool IsProfilePluginLoaded();
       
   154 
       
   155     /**
       
   156      * Checks if CoD plugin exists
       
   157      * 
       
   158      * @return ETrue if plugin's instance is loaded. Otherwise EFalse
       
   159      */
       
   160     TBool IsCoDPluginLoaded();
       
   161 
       
   162     /**
       
   163      * Handles AT commands passed to profile plugin
       
   164      * 
       
   165      * @param aCommandsIn data passed to profile's implementation
       
   166      * @param aCommandOut response from profile's implementation
       
   167      * @param aFromAG denotes if passed command should be treated as 
       
   168      *                sent from AG
       
   169      */
       
   170     void HandleCommandL( const TDesC8 &aCommandsIn, TDes8 &aCommandOut,
       
   171             TBool aFromAG = ETrue );
       
   172 
       
   173     /**
       
   174      * Handles client disconnection event
       
   175      * 
       
   176      * @param aErr disconnection reason
       
   177      */
       
   178     void HandleClientDisconnected( TInt aErr );
       
   179 
       
   180     /**
       
   181      * Handles client connection event.
       
   182      * Profile may start initialization procedure if necessary.
       
   183      * 
       
   184      * @param aCommandOut response from profile's implementation
       
   185      */
       
   186     void HandleClientConnected( TDes8& aCommandOut );
       
   187 
       
   188     /**
       
   189      * Sends request to profile to accept incoming call.
       
   190      * 
       
   191      * @param aProfileResponse AT response
       
   192      */
       
   193     void AcceptIncomingCallL( TDes8& aProfileResponse );
       
   194 
       
   195     /**
       
   196      * Sends request to profile to release ongoing call.
       
   197      * 
       
   198      * @param aProfileResponse AT response
       
   199      */
       
   200     void ReleaseOngoingCallL( TDes8& aProfileResponse );
       
   201     
       
   202 private:
       
   203     /**
       
   204      * Constructor for performing 1st stage construction
       
   205      */
       
   206     CHsProfileManager();
       
   207 
       
   208     /**
       
   209      * Default constructor for performing 2nd stage construction
       
   210      */
       
   211     void ConstructL();
       
   212 
       
   213 private:
       
   214 
       
   215     /**
       
   216      * Destroys profile plugin
       
   217      */
       
   218     void DestroyProfile();
       
   219 
       
   220     /**
       
   221      * Destroys SDP plugin
       
   222      */
       
   223     void DestroySdpL();
       
   224 
       
   225     /**
       
   226      * Destroys CoD plugin
       
   227      */
       
   228     void DestroyCodL();
       
   229 
       
   230 private:
       
   231 
       
   232     /** Port number */
       
   233     TInt iSdpServicePort;
       
   234 
       
   235     /** Denotes if SDP plugin exists */
       
   236     TBool iSdpSet;
       
   237 
       
   238     /** Pointer to profile plugin */
       
   239     CHsProfileBase *iProfilePlugin;
       
   240 
       
   241     /** Pointer to CoD plugin */
       
   242     CHsCoDBase *iCoDPlugin;
       
   243 
       
   244     /** Pointer to SDP plugin */
       
   245     CHsSdpBase *iSdpPlugin;
       
   246 
       
   247 };
       
   248 
       
   249 #endif // HSPROFILMENAGER_H