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