sensorsupport/testsensor/src/ssyreferencecontrol.h
branchRCL_3
changeset 63 c2c61fdca848
parent 62 924385140d98
child 64 75184094ace1
child 66 9af619316cbf
equal deleted inserted replaced
62:924385140d98 63:c2c61fdca848
     1 // ssyreferencecontrol.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 SSYREFERENCECONTROL_H
       
    29 #define SSYREFERENCECONTROL_H
       
    30 
       
    31 #include <sensors/spi/ssycontrol.h>
       
    32 #include "ssyreferenceconfig.h"
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class CSsyReferenceChannel;
       
    36 
       
    37 /**
       
    38  *  Main control class for SSY. Controls sensor basic functionality and provides mandatory 
       
    39  *  ECOM interface specific things.
       
    40  */
       
    41 class CSsyReferenceControl : public CSsyControl
       
    42     {
       
    43 
       
    44 public:
       
    45 
       
    46     /**
       
    47      * Two-phase constructor
       
    48      *
       
    49      * @param[in] aSsyCallback Reference to SSY callback instance.
       
    50      * @return Pointer to created CSsyReferenceControl object
       
    51      */
       
    52     static CSsyReferenceControl* NewL( MSsyCallback& aSsyCallback );
       
    53 
       
    54     /**
       
    55      * Virtual destructor
       
    56      */
       
    57     virtual ~CSsyReferenceControl();
       
    58 
       
    59 // from base class CSsyControl
       
    60 
       
    61     /**
       
    62      * From CSsyControl
       
    63      * Request for SSY to open a sensor channel asynchronously. 
       
    64      * Response to the request is delivered through MSsyCallback::ChannelOpened().
       
    65      * Initilizes SSY (and the sensor) to be ready for other control commands via
       
    66      * data and property providers. Multiple OpenChannel()-requests can be
       
    67      * active for different channels at the same time.
       
    68      *
       
    69      * @param[in] aChannelID Channel that is requested to be opened
       
    70      * @return Symbian error code
       
    71      */
       
    72     void OpenChannelL( TSensrvChannelId aChannelID );
       
    73 
       
    74     /**
       
    75      * From CSsyControl
       
    76      * Request to close a sensor channel asynchronously. 
       
    77      * Response to the request is delivered through MSsyCallback::ChannelClosed().
       
    78      * Multiple CloseChannel()-requests can be active for different channels 
       
    79      * at the same time.
       
    80      *
       
    81      * @param[in] aChannelID Channel that is reqeusted to be closed
       
    82      * @leave  Any One of the system wide error codes
       
    83      */  
       
    84     void CloseChannelL( TSensrvChannelId aChannelID );
       
    85 
       
    86     /**
       
    87      * Reference to SSY Callback instance
       
    88      */
       
    89     MSsyCallback& SsyCallback() const;
       
    90 
       
    91     /**
       
    92      * Reference to SSY Config file
       
    93      */
       
    94     CSsyReferenceConfig& SsyConfig() const;
       
    95     /**
       
    96      * Handles response to CSsyReferenceCmdHandler::ProcessCommand
       
    97      *
       
    98      * @param[in] aMessage Contains information of the response
       
    99      */
       
   100     void ProcessResponse( TSsyReferenceMsg* aMessage );
       
   101 
       
   102     /**
       
   103      * Search property of given property id from the channel properties and 
       
   104      * returns reference to that. Leaves with KErrNotFound if property is not found
       
   105      *
       
   106      * @param[in]  aPropertyId Property ID to locate
       
   107      * @param[in]  aArrayIndex Propertys array index
       
   108      * @param[out] aProperty Contains found property
       
   109      */
       
   110     void FindPropertyL( const TSensrvPropertyId aPropertyId, 
       
   111                         const TInt aArrayIndex,
       
   112                         TSensrvProperty& aProperty );
       
   113 
       
   114 private:
       
   115 
       
   116     /**
       
   117      * C++ constructor.
       
   118      *
       
   119      * @param[in] aSsyCallback Reference to SSY callback instance.
       
   120      */
       
   121     CSsyReferenceControl( MSsyCallback& aSsyCallback );
       
   122 
       
   123     /**
       
   124      * Symbian 2nd phase constructor.
       
   125      */
       
   126     void ConstructL();
       
   127 
       
   128     /**
       
   129      * Finds and returns pointer to channel
       
   130      */
       
   131     CSsyReferenceChannel* FindChannelL( TSensrvChannelId aChannelID );
       
   132 
       
   133 private: // data
       
   134 
       
   135     /**
       
   136      * Reference to SSY CallBack to send responses to Sensor Server
       
   137      */
       
   138     MSsyCallback& iSsyCallback;
       
   139 
       
   140     /**
       
   141      * Pointer array of all channels provided by this SSY
       
   142      */
       
   143     CArrayPtrFlat<CSsyReferenceChannel>* iChannelArray;
       
   144 
       
   145     /**
       
   146      * Pointer to config file parser
       
   147      */
       
   148     CSsyReferenceConfig* iConfigFile;
       
   149 
       
   150     /**
       
   151      * Property list of general properties of this SSY
       
   152      */
       
   153     RSensrvPropertyList iProperties;
       
   154     };
       
   155 
       
   156 #endif // SSYREFERENCECONTROL_H