connectivitymodules/SeCon/plugins/hapticsconnplugin/inc/hapticsbridgeclient.h
branchRCL_3
changeset 20 4a793f564d72
parent 0 d0791faffa3f
equal deleted inserted replaced
19:0aa8cc770c8a 20:4a793f564d72
       
     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:  Client interface to haptics server for haptics bridge 
       
    15 *                commands.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef C_HAPTICSBRIDGECLIENT_H
       
    21 #define C_HAPTICSBRIDGECLIENT_H
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 class CHWRMHapticsPacketizer;
       
    26 
       
    27 class RHapticsBridgeClient : public RSessionBase
       
    28 {
       
    29 public:
       
    30     /**
       
    31      * Constructor
       
    32      */
       
    33      RHapticsBridgeClient();
       
    34      
       
    35      /**
       
    36       * Destructor
       
    37       */
       
    38      virtual ~RHapticsBridgeClient();
       
    39 
       
    40 public:
       
    41     /**
       
    42      * Create a connection to haptics server.
       
    43      */
       
    44 	TInt Connect();
       
    45 
       
    46     /**
       
    47      * Close the connection to haptics server.
       
    48      */
       
    49 	void Close();
       
    50 
       
    51     /**
       
    52      * Send message to haptics server.
       
    53      * @param aReqData     Data request to be sent to haptics server.
       
    54      * @param aRetDataPckg Returned data from haptics server.
       
    55      * @return KErrNone if sent succesfully, otherwise system wide error code.
       
    56      */
       
    57 	TInt SendBridgeBuffer( const TDesC8& aReqData, TDes8& aRetDataPckg );
       
    58 
       
    59     /**
       
    60      * Sends a message clean-up commend to haptics server.
       
    61      */
       
    62 	void CleanUp();
       
    63     
       
    64 
       
    65 private:
       
    66 
       
    67     /**
       
    68      * Returns the version of the haptics server.
       
    69      * @return Version.
       
    70      */
       
    71 	TVersion ServerVersion() const;
       
    72 
       
    73     /**
       
    74      * Starts the server process if it is not already running.
       
    75      * @return KErrNone on success, otherwise a system error code.
       
    76      */
       
    77 	TInt StartServer() const;
       
    78 
       
    79     /**
       
    80      * Handles the device opening request.
       
    81      * @param aResponse Reference to a descriptor containing the response
       
    82      *                  received from haptics server.
       
    83      */
       
    84 	void HandleOpenDeviceResponseL( const TDesC8& aResponse );
       
    85 	
       
    86 	/**
       
    87 	 * Opens the haptic effect ("vibra") device.
       
    88 	 * @return KErrNone on success, otherwise a system error code.
       
    89 	 */
       
    90     TInt OpenHapticsDevice();
       
    91 
       
    92 private:
       
    93 
       
    94     /**
       
    95      * Haptic packetizer.
       
    96      * Owned.
       
    97      */
       
    98     CHWRMHapticsPacketizer* iPacketizer;     
       
    99 };
       
   100 
       
   101 #endif // C_HAPTICSBRIDGECLIENT_H