sensorsupport/testsensor/src/ssyreferencechanneldataprovider.h
branchRCL_3
changeset 62 924385140d98
equal deleted inserted replaced
58:0818dd463d41 62:924385140d98
       
     1 // ssyreferencechanneldataprovider.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 SSYREFERENCECHANNELDATAPROVIDER_H
       
    29 #define SSYREFERENCECHANNELDATAPROVIDER_H
       
    30 
       
    31 #include <sensors/spi/ssychanneldataprovider.h>
       
    32 
       
    33 class CSsyReferenceChannel;
       
    34 class TSsyReferenceMsg;
       
    35 
       
    36 /**
       
    37  *  Channel data provider implementation.
       
    38  */
       
    39 class CSsyReferenceChannelDataProvider : public CBase, public MSsyChannelDataProvider
       
    40     {
       
    41 
       
    42 public:
       
    43 
       
    44     /**
       
    45      * Two-phase constructor
       
    46      *
       
    47      * @param[in] aChannel Reference to channel this provider belongs to
       
    48      * @return Pointer to created CSsyReferenceControl object
       
    49      */
       
    50     static CSsyReferenceChannelDataProvider* NewL( CSsyReferenceChannel& aChannel );
       
    51 
       
    52     /**
       
    53      * Virtual destructor
       
    54      */
       
    55     virtual ~CSsyReferenceChannelDataProvider();
       
    56 
       
    57 // from base class MSsyChannelDataProvider
       
    58 
       
    59     /**
       
    60      * From MSsyChannelDataProvider
       
    61      * Starts asynchronous data listening. Multiple OpenChannel()-requests
       
    62      * can be active for different channels at the same time.
       
    63      *
       
    64      * @param[in] aBuffer Pointer to a data buffer 
       
    65      * @param[in] aCount Indicates data buffer size as a count of the data objects.
       
    66      */
       
    67     void StartChannelDataL( const TSensrvChannelId aChannelId, TUint8* aBuffer, TInt aCount );
       
    68 
       
    69     /**
       
    70      * From MSsyChannelDataProvider
       
    71      * Stops asynchronous data listening. The data buffer is not valid after call of 
       
    72      * this function.
       
    73      */
       
    74     void StopChannelDataL( const TSensrvChannelId aChannelId );
       
    75 
       
    76     /**
       
    77      * From MSsyChannelDataProvider
       
    78      * Forces SSY to call BufferFilled() regardless of how many data items have been
       
    79      * written to buffer. Even if no data items have yet been written, BufferFilled()
       
    80      * must be called.
       
    81      */
       
    82     void ForceBufferFilledL( const TSensrvChannelId aChannelId );
       
    83 
       
    84     /** 
       
    85     * Returns a pointer to a specified interface - to allow future extension
       
    86     * of this class without breaking binary compatibility
       
    87     *
       
    88     * @param aInterfaceUid Identifier of the interface to be retrieved
       
    89     * @param aInterface A reference to a pointer that retrieves the specified interface.
       
    90     */
       
    91     void GetChannelDataProviderInterfaceL( TUid aInterfaceUid, TAny*& aInterface );
       
    92 
       
    93     /**
       
    94      * Channel data item received
       
    95      *
       
    96      * @param[in] aMessage Contains channel item
       
    97      */
       
    98     void ChannelDataReceivedL( TSsyReferenceMsg* aMessage );
       
    99 
       
   100 private:
       
   101 
       
   102     /**
       
   103      * C++ constructor.
       
   104      * @param[in] aChannel Reference to channel this provider belongs to
       
   105      */
       
   106     CSsyReferenceChannelDataProvider( CSsyReferenceChannel& aChannel );
       
   107 
       
   108     /**
       
   109      * Symbian 2nd phase constructor.
       
   110      */
       
   111     void ConstructL();
       
   112 
       
   113     /**
       
   114      * Adds data into buffer. 
       
   115      *
       
   116      *@param[in] aData Data to add to buffer
       
   117      *@param[in] aSize Size of data
       
   118      */
       
   119     void AddDataToBuffer( TUint8* aData, const TInt aSize );
       
   120 
       
   121     /**
       
   122      * Sends BufferFilled notification to MSsyCallback
       
   123      */
       
   124     void SendBufferFilled();
       
   125 
       
   126 private: // data
       
   127 
       
   128     /**
       
   129      * Reference to channel for which this provider belongs to
       
   130      */
       
   131     CSsyReferenceChannel& iChannel;
       
   132 
       
   133     /**
       
   134      * Pointer to data buffer in Sensor Server side
       
   135      */
       
   136     TUint8* iDataBuffer;
       
   137 
       
   138     /**
       
   139      * Maximum requested data items
       
   140      */
       
   141     TInt iMaxCount;
       
   142 
       
   143     /**
       
   144      * Number of items in buffer
       
   145      */
       
   146     TInt iDataCount;
       
   147     };
       
   148 
       
   149 #endif // SSYREFERENCECHANNELDATAPROVIDER_H