connectivitymodules/SeCon/plugins/hapticsconnplugin/inc/hapticsmsghandler.h
branchRCL_3
changeset 19 0aa8cc770c8a
parent 18 453dfc402455
child 20 4a793f564d72
equal deleted inserted replaced
18:453dfc402455 19:0aa8cc770c8a
     1 /*
       
     2 * Copyright (c) 2009 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:  Handles messaging between file system and haptics 
       
    15 *                client interface.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef C_HAPTICSMSGHANDLER_H
       
    21 #define C_HAPTICSMSGHANDLER_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <e32debug.h>
       
    25 #include <f32file.h>
       
    26 
       
    27 #include "hapticsbridgeclient.h"
       
    28 
       
    29 class CHapticsConnTimer;
       
    30 
       
    31 /**
       
    32  * Interface to notify about connection timeout.
       
    33  */
       
    34 class MHapticsConnectionShutdown
       
    35     {
       
    36     public:
       
    37         /**
       
    38          * Called to notify about connection timeout.
       
    39          */
       
    40         virtual void NotifyShutdown() = 0;
       
    41     
       
    42     };
       
    43 
       
    44 /**
       
    45  * Helper class for Bridge functionality for handling RFs (File Session)
       
    46  * change notifications for VibeTonz request file.
       
    47  *
       
    48  * @since S60 5.1
       
    49  */
       
    50 class CHapticsMsgHandler : public CActive,
       
    51                            public MHapticsConnectionShutdown
       
    52     {        
       
    53 public:    
       
    54     /**
       
    55      * 2-phased constructor.
       
    56      */
       
    57     static CHapticsMsgHandler* NewL();
       
    58     
       
    59     /**
       
    60      * Destructor
       
    61      */
       
    62     virtual ~CHapticsMsgHandler();
       
    63 
       
    64     /**
       
    65      * Method for starting the listening for change notifications    
       
    66      */
       
    67     void StartNotifier();
       
    68         
       
    69     /**
       
    70      * From MHapticsConnectionShutdown.
       
    71      * Called to notify about connection timeout.
       
    72      */        
       
    73     void NotifyShutdown();   
       
    74     
       
    75 protected: // From CActive.    
       
    76     /**
       
    77      * @see CActive
       
    78      */
       
    79     void RunL();
       
    80     /**
       
    81      * @see CActive
       
    82      */    
       
    83     TInt RunError(TInt aError);
       
    84     /**
       
    85      * @see CActive
       
    86      */    
       
    87     void DoCancel();
       
    88         
       
    89 private:
       
    90 
       
    91     /**
       
    92      * Constructor
       
    93      */
       
    94     CHapticsMsgHandler();
       
    95 
       
    96     /**
       
    97      * Two-phase construction ConstructL
       
    98      */
       
    99     void ConstructL();
       
   100     
       
   101     /**
       
   102      * Method for connecting to file system. Also sets the paths and
       
   103      * creates directories (if not already exists).
       
   104      */
       
   105     void ConnectToFilesystemL();            	
       
   106  
       
   107     /**
       
   108      * Helper for clearing the possible left-over request file from
       
   109      * previous runs.
       
   110      */
       
   111     void ClearRequestFile();
       
   112 
       
   113 private: // data
       
   114     
       
   115     /**
       
   116      * File server session through which all file server related 
       
   117      * services are requested.
       
   118      */
       
   119     RFs iFs;
       
   120     
       
   121     /**
       
   122      * Buffer for the request file data
       
   123      */
       
   124     HBufC8* iReqBuf;    
       
   125 
       
   126     /**
       
   127      * The RHapticsBridgeClient object that is responsible for further
       
   128      * handling of received Bridge commands
       
   129      */
       
   130     RHapticsBridgeClient iClient;
       
   131     
       
   132     CHapticsConnTimer* iConnectionTimeout;
       
   133         
       
   134   };
       
   135 
       
   136 #endif // C_HAPTICSMSGHANDLER_H