hwrmhaptics/hapticspacketizer/plugins/hapticsvibepacketizerplugin/inc/hwrmhapticsvibepacketizer.h
branchRCL_3
changeset 7 1fc153c72b60
parent 6 6bb05bdcbe09
child 8 8d1d8440b626
equal deleted inserted replaced
6:6bb05bdcbe09 7:1fc153c72b60
     1 /*
       
     2 * Copyright (c) 2008 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:  Plugin for handling vibe command packages.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_HWRMHAPTICSVIBEPACKETIZER_H
       
    19 #define C_HWRMHAPTICSVIBEPACKETIZER_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <hwrmhapticspacketizer.h>
       
    23 
       
    24 class CDesC8ArraySeg;
       
    25 
       
    26 /**
       
    27  *  ECom plugin for handling vibe command packages.
       
    28  *
       
    29  *  @lib hwrmhapticsvibepacketizerplugin.lib
       
    30  *  @since S60 v5.1
       
    31  */
       
    32 NONSHARABLE_CLASS( CHWRMHapticsVibePacketizer ): public CHWRMHapticsPacketizer
       
    33     {
       
    34 public:
       
    35 
       
    36     /**
       
    37      * Two phased constructor.
       
    38      * 
       
    39      * @return An instance of haptics vibe packetizer.
       
    40      */
       
    41     static CHWRMHapticsVibePacketizer* NewL();
       
    42 
       
    43     /**
       
    44      * Destructor.
       
    45      */
       
    46     virtual ~CHWRMHapticsVibePacketizer();
       
    47 
       
    48 public: // From CHWRMHapticsPacketizer
       
    49 
       
    50     /**
       
    51      * @see MHWRMHapticsPacketizer
       
    52      */ 
       
    53     virtual TInt EncOpenDeviceReq( THWRMLogicalActuators aLogicalActuator,
       
    54                                    RBuf8& aBuffer );
       
    55 
       
    56     /**
       
    57      * @see MHWRMHapticsPacketizer
       
    58      */ 
       
    59     virtual TInt EncCloseDeviceReq( TInt aDeviceHandle, RBuf8& aBuffer );
       
    60 
       
    61     /**
       
    62      * @see MHWRMHapticsPacketizer
       
    63      */ 
       
    64     virtual TInt EncPlayMagSweepEffectReq( 
       
    65                         TInt aDeviceHandle, 
       
    66                         CHWRMHaptics::THWRMHapticsMagSweepEffect aEffect,
       
    67                         RBuf8& aBuffer );
       
    68 
       
    69     /**
       
    70      * @see MHWRMHapticsPacketizer
       
    71      */ 
       
    72     virtual TInt EncPlayPeriodicEffectReq( 
       
    73                         TInt aDeviceHandle, 
       
    74                         CHWRMHaptics::THWRMHapticsPeriodicEffect aEffect,
       
    75                         RBuf8& aBuffer );
       
    76 
       
    77     /**
       
    78      * @see MHWRMHapticsPacketizer
       
    79      */ 
       
    80     virtual TInt EncModifyPlayingMagSweepEffectReq( 
       
    81                         TInt aDeviceHandle, 
       
    82                         TInt aEffectHandle, 
       
    83                         CHWRMHaptics::THWRMHapticsMagSweepEffect aEffect,
       
    84                         RBuf8& aBuffer );
       
    85 
       
    86     /**
       
    87      * @see MHWRMHapticsPacketizer
       
    88      */ 
       
    89     virtual TInt EncModifyPlayingPeriodicEffectReq( 
       
    90                         TInt aDeviceHandle, 
       
    91                         TInt aEffectHandle, 
       
    92                         CHWRMHaptics::THWRMHapticsPeriodicEffect aEffect,
       
    93                         RBuf8& aBuffer );
       
    94 
       
    95     /**
       
    96      * @see MHWRMHapticsPacketizer
       
    97      */ 
       
    98     virtual TInt EncPausePlayingEffectReq( TInt aDeviceHandle,
       
    99                                            TInt aEffectHandle,
       
   100                                            RBuf8& aBuffer );
       
   101 
       
   102     /**
       
   103      * @see MHWRMHapticsPacketizer
       
   104      */ 
       
   105     virtual TInt EncResumePausedEffectReq( TInt aDeviceHandle, 
       
   106                                            TInt aEffectHandle,
       
   107                                            RBuf8& aBuffer );
       
   108 
       
   109     /**
       
   110      * @see MHWRMHapticsPacketizer
       
   111      */ 
       
   112     virtual TInt EncStopPlayingEffectReq( TInt aDeviceHandle, 
       
   113                                           TInt aEffectHandle,
       
   114                                           RBuf8& aBuffer );
       
   115 
       
   116     /**
       
   117      * @see MHWRMHapticsPacketizer
       
   118      */ 
       
   119     virtual TInt EncStopAllPlayingEffectsReq( TInt aDeviceHandle,
       
   120                                               RBuf8& aBuffer );
       
   121 
       
   122     /**
       
   123      * @see MHWRMHapticsPacketizer
       
   124      */ 
       
   125     virtual TInt EncPlayEffectIncludeEffectDataReq( TInt aDeviceHandle,
       
   126                                                     const TDesC8& aData, 
       
   127                                                     TInt aEffectIndex,
       
   128                                                     RBuf8& aBuffer );
       
   129 
       
   130     /**
       
   131      * @see MHWRMHapticsPacketizer
       
   132      */ 
       
   133     virtual TInt EncPlayEffectRepeatIncludeEffectDataReq( TInt aDeviceHandle,
       
   134                                                           const TDesC8& aData,
       
   135                                                           TInt aEffectIndex, 
       
   136                                                           TUint8 aRepeat,
       
   137                                                           RBuf8& aBuffer );
       
   138 
       
   139     /**
       
   140      * @see MHWRMHapticsPacketizer
       
   141      */ 
       
   142     virtual TInt EncPlayEffectRepeatNoDataReq( TInt aDeviceHandle,
       
   143                                                TInt aEffectIndex, 
       
   144                                                TUint8 aRepeat,
       
   145                                                RBuf8& aBuffer );
       
   146 
       
   147     /**
       
   148      * @see MHWRMHapticsPacketizer
       
   149      */ 
       
   150     virtual TInt EncPlayEffectNoDataReq( TInt aDeviceHandle,
       
   151                                          TInt aEffectIndex,
       
   152                                          RBuf8& aBuffer );
       
   153 
       
   154     /**
       
   155      * @see MHWRMHapticsPacketizer
       
   156      */ 
       
   157     virtual TInt EncCreateStreamingEffectReq( TInt aDeviceHandle, 
       
   158                                               RBuf8& aBuffer );
       
   159 
       
   160     /**
       
   161      * @see MHWRMHapticsPacketizer
       
   162      */ 
       
   163     virtual TInt EncDestroyStreamingEffectReq( TInt aDeviceHandle,
       
   164                                                TInt aEffectHandle,
       
   165                                                RBuf8& aBuffer );
       
   166 
       
   167     /**
       
   168      * @see MHWRMHapticsPacketizer
       
   169      */ 
       
   170     virtual TInt EncPlayStreamingSampleReq( TInt aDeviceHandle,
       
   171                                             const TDesC8& aStreamingSample, 
       
   172                                             TInt aEffectHandle,
       
   173                                             RBuf8& aBuffer );
       
   174 
       
   175     /**
       
   176      * @see MHWRMHapticsPacketizer
       
   177      */ 
       
   178     virtual TInt EncPlayStreamingSampleWithOffsetReq( 
       
   179                                             TInt aDeviceHandle,
       
   180                                             const TDesC8& aStreamingSample,
       
   181                                             TInt aOffsetTime,
       
   182                                             TInt aEffectHandle,
       
   183                                             RBuf8& aBuffer );
       
   184     
       
   185     /**
       
   186      * @see MHWRMHapticsPacketizer
       
   187      */ 
       
   188     virtual TInt EncGetEffectStateReq( TInt aDeviceHandle, 
       
   189                                        TInt aEffectHandle,
       
   190                                        RBuf8& aBuffer );
       
   191 
       
   192     /**
       
   193      * @see MHWRMHapticsPacketizer
       
   194      */ 
       
   195     virtual TInt EncSetDevicePropertyBoolReq( TInt aDeviceHandle, 
       
   196                                               TBool aDevPropValue,
       
   197                                               TInt aDevPropType,
       
   198                                               RBuf8& aBuffer );
       
   199 
       
   200     /**
       
   201      * @see MHWRMHapticsPacketizer
       
   202      */ 
       
   203     virtual TInt EncSetDevicePropertyIntReq( TInt aDeviceHandle, 
       
   204                                              TInt aDevPropValue, 
       
   205                                              TInt aDevPropType,
       
   206                                              RBuf8& aBuffer );
       
   207 
       
   208     /**
       
   209      * @see MHWRMHapticsPacketizer
       
   210      */ 
       
   211     virtual TInt EncSetDevicePropertyStringReq( TInt aDeviceHandle, 
       
   212                                                 const TDesC8& aDevPropValue,
       
   213                                                 TInt aDevPropType,
       
   214                                                 RBuf8& aBuffer );
       
   215 
       
   216     /**
       
   217      * @see MHWRMHapticsPacketizer
       
   218      */ 
       
   219     virtual TInt EncSetPlatformLicenseKeyReq( TInt aDeviceHandle,
       
   220                                               RBuf8& aBuffer );
       
   221 
       
   222     /**
       
   223      * @see MHWRMHapticsPacketizer
       
   224      */ 
       
   225     virtual TInt EncGetDevicePropertyBoolReq( TInt aDeviceHandle,
       
   226                                               TInt aDevPropType,
       
   227                                               RBuf8& aBuffer );
       
   228 
       
   229     /**
       
   230      * @see MHWRMHapticsPacketizer
       
   231      */ 
       
   232     virtual TInt EncGetDevicePropertyIntReq( TInt aDeviceHandle,
       
   233                                              TInt aDevPropType,
       
   234                                              RBuf8& aBuffer );
       
   235 
       
   236     /**
       
   237      * @see MHWRMHapticsPacketizer
       
   238      */ 
       
   239     virtual TInt EncGetDevicePropertyStringReq( TInt aDeviceHandle,
       
   240                                                 TInt aDevPropType,
       
   241                                                 RBuf8& aBuffer );
       
   242 
       
   243     /**
       
   244      * @see MHWRMHapticsPacketizer
       
   245      */ 
       
   246     virtual TInt EncGetDeviceCapabilityIntReq( TInt aDeviceHandle, 
       
   247                                                TInt aDevCapType,
       
   248                                                RBuf8& aBuffer );
       
   249 
       
   250     /**
       
   251      * @see MHWRMHapticsPacketizer
       
   252      */ 
       
   253     virtual TInt EncGetDeviceCapabilityStringReq( TInt aDeviceHandle,
       
   254                                                   TInt aDevCapType,
       
   255                                                   RBuf8& aBuffer );
       
   256 
       
   257     /**
       
   258      * @see MHWRMHapticsPacketizer
       
   259      */ 
       
   260     virtual CDesC8ArraySeg* DecodeMessageL( const TDesC8& aData, 
       
   261                                             TInt& aStatus );
       
   262     
       
   263     /**
       
   264      * @see MHWRMHapticsPacketizer
       
   265      */ 
       
   266     virtual TInt DeviceHandle();
       
   267 
       
   268     /**
       
   269      * @see MHWRMHapticsPacketizer
       
   270      */ 
       
   271     virtual TInt InfiniteRepeat();
       
   272 
       
   273     /**
       
   274      * @see MHWRMHapticsPacketizer
       
   275      */ 
       
   276     virtual TInt InfiniteDuration();
       
   277 
       
   278     /**
       
   279      * @see MHWRMHapticsPacketizer
       
   280      */ 
       
   281     virtual TInt MaxEffectNameLength();
       
   282 
       
   283     /**
       
   284      * @see MHWRMHapticsPacketizer
       
   285      */ 
       
   286     virtual TInt MaxDeviceNameLength();
       
   287 
       
   288     /**
       
   289      * @see MHWRMHapticsPacketizer
       
   290      */ 
       
   291     virtual TInt MaxCapabilityStringLength();
       
   292 
       
   293     /**
       
   294      * @see MHWRMHapticsPacketizer
       
   295      */ 
       
   296     virtual TInt MaxPropertyStringLength();
       
   297 
       
   298     /**
       
   299      * @see MHWRMHapticsPacketizer
       
   300      */ 
       
   301     virtual TInt MaxStreamingSampleSize();
       
   302 
       
   303     /**
       
   304      * @see MHWRMHapticsPacketizer
       
   305      */ 
       
   306     virtual TInt DefaultDevicePriority();
       
   307 
       
   308 private:
       
   309 
       
   310     /**
       
   311      * Constructor.
       
   312      */
       
   313     CHWRMHapticsVibePacketizer();
       
   314 
       
   315     /**
       
   316      * 2nd phase constructor.
       
   317      */
       
   318     void ConstructL();
       
   319 
       
   320     /**
       
   321      * Internal helper method. Fills Get Device Capability request data.
       
   322      */
       
   323     TInt EncGetDeviceCapabilityReqInternal( TInt aValueType,
       
   324                                             TInt aDeviceHandle,
       
   325                                             TInt aDevCapType,
       
   326                                             RBuf8& aBuffer );
       
   327                                                      
       
   328     /**
       
   329      * Internal helper method. Fills Get Device Property request data.
       
   330      */                                                 
       
   331     TInt EncGetDevicePropertyReqInternal( TInt aValueType,
       
   332                                           TInt aDeviceHandle,
       
   333                                           TInt aDevPropType,
       
   334                                           RBuf8& aBuffer );
       
   335     
       
   336     /**
       
   337      * Internal helper method. Fills Play Streaming Sample request data. 
       
   338      */
       
   339     TInt EncPlayStreamingSampleInternal( TInt aDeviceHandle,
       
   340                                          TInt aEffectHandle,
       
   341                                          const TDesC8& aStreamingSample,
       
   342                                          TInt aOffsetTime,
       
   343                                          RBuf8& aBuffer );
       
   344 
       
   345     /**
       
   346      * Maps Vibe error code to Symbian error code.
       
   347      * 
       
   348      * @param  aVibeError Vibe error code.
       
   349      * @return Symbian system wide error code.
       
   350      */
       
   351     TInt MapError( TInt aVibeError );
       
   352 
       
   353 private: // data
       
   354 
       
   355     /**
       
   356      * Buffer for request data.
       
   357      */ 
       
   358     RBuf8 iReqBuf;
       
   359     
       
   360     /**
       
   361      * Buffer for streaming or IVT data.
       
   362      */ 
       
   363     RBuf8 iDataBuf;
       
   364 
       
   365     /**
       
   366      * Array used for decoded values in DecodeMessageL. Owned.
       
   367      */
       
   368     CDesC8ArraySeg* iReturnArray;
       
   369     
       
   370     /**
       
   371      * Stores the latest value of opened device handle. Initiated
       
   372      * to KErrNotFound.
       
   373      */
       
   374     TInt iDeviceHandle;
       
   375     };
       
   376 
       
   377 #endif // C_HWRMHAPTICSVIBEPACKETIZER_H