sensorsupport/testsensor/src/ssyreferencecmdhandler.h
branchRCL_3
changeset 20 c2c61fdca848
parent 19 924385140d98
child 21 9af619316cbf
equal deleted inserted replaced
19:924385140d98 20:c2c61fdca848
     1 // ssyreferencecmdhandler.h
       
     2 
       
     3 /*
       
     4 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     5 * All rights reserved.
       
     6 * This component and the accompanying materials are made available
       
     7 * under the terms of "Eclipse Public License v1.0"
       
     8 * which accompanies this distribution, and is available
       
     9 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    10 *
       
    11 * Initial Contributors:
       
    12 * Nokia Corporation - initial contribution.
       
    13 *
       
    14 * Contributors:
       
    15 *
       
    16 * Description:
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 /**
       
    24  @file
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 #ifndef SSYREFERENCECMDHANDLER_H
       
    29 #define SSYREFERENCECMDHANDLER_H
       
    30 
       
    31 #include <e32base.h>
       
    32 #include "ssyreferenceconfig.h"
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class CSsyReferenceChannel;
       
    36 
       
    37 /**
       
    38  *  Command handler class for handling commands of one channel. Each opened 
       
    39  *  channel has its own instance of this class
       
    40  */
       
    41 class CSsyReferenceCmdHandler : public CActive
       
    42     {
       
    43 
       
    44 public:
       
    45 
       
    46     /**
       
    47      * Two-phase constructor
       
    48      *
       
    49      * @param[in] aSsyChannel Reference to SSY Channel instance.
       
    50      * @return Pointer to created CSsyReferenceCmdHandler object
       
    51      */
       
    52     static CSsyReferenceCmdHandler* NewL( CSsyReferenceChannel& aSsyChannel );
       
    53 
       
    54     /**
       
    55      * Virtual destructor
       
    56      */
       
    57     virtual ~CSsyReferenceCmdHandler();
       
    58 
       
    59 // from base class CSsyControl
       
    60 
       
    61     /**
       
    62      * Processes command specified in param aMessage. 
       
    63      *
       
    64      * @param[in] aMessage Contains command information to process
       
    65      * @return Symbian error code
       
    66      */
       
    67     TInt ProcessCommand( TSsyReferenceMsg aMessage );
       
    68 
       
    69     /**
       
    70      * From CActive
       
    71      */
       
    72     void RunL();
       
    73 
       
    74     /**
       
    75      * From CActive
       
    76      */
       
    77     void DoCancel();
       
    78 
       
    79     /**
       
    80      * From CActive
       
    81      */
       
    82     TInt RunError( TInt aError );
       
    83 
       
    84     /**
       
    85      * Callback function for DataItem generation
       
    86      */
       
    87     static TInt DataItemCallback( TAny* aThis );
       
    88     
       
    89     /**
       
    90      * Handles data item generation. Called from DataItemCallback
       
    91      */
       
    92     TInt GenerateChannelDataItem();
       
    93 
       
    94 private:
       
    95 
       
    96     /**
       
    97      * C++ constructor.
       
    98      *
       
    99      * @param[in] aSsyChannel Reference to SSY Channel instance.
       
   100      */
       
   101     CSsyReferenceCmdHandler( CSsyReferenceChannel& aSsyChannel );
       
   102 
       
   103     /**
       
   104      * Symbian 2nd phase constructor.
       
   105      */
       
   106     void ConstructL();
       
   107 
       
   108     /**
       
   109      * Makes synchronous calls asynchronous
       
   110      */
       
   111     void IssueRequest( TInt aError = KErrNone );
       
   112 
       
   113     /**
       
   114      * Sends response to channel
       
   115      */
       
   116     void SendResponse( TInt aError = KErrNone );
       
   117 
       
   118 private: // data
       
   119 
       
   120     /**
       
   121      * Reference to SSY Conrtol to send responses for commands
       
   122      */
       
   123     CSsyReferenceChannel& iSsyChannel;
       
   124 
       
   125     /**
       
   126      * Pointer to currently processing message
       
   127      */
       
   128     TSsyReferenceMsg* iMessage;
       
   129 
       
   130     /**
       
   131      * Data item array
       
   132      */
       
   133     TSsyRefDataItemArray iDataItemArray;
       
   134 
       
   135     /**
       
   136      * Pointer to next item to generate in iDataItemArray
       
   137      */
       
   138     TInt iDataItemPtr;
       
   139 
       
   140     /**
       
   141      * Periodic timer for generating channel data
       
   142      */
       
   143     CPeriodic* iTimer;
       
   144     };
       
   145 
       
   146 #endif // SSYREFERENCECMDHANDLER_H
       
   147