serviceproviders/sapi_sensor/inc/sensorcallback.h
changeset 5 989d2f495d90
child 23 50974a8b132e
equal deleted inserted replaced
1:a36b1e19a461 5:989d2f495d90
       
     1 /*
       
     2 * Copyright (c) 2006-2007 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 the License "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:  Callback class declaration for sensor service API
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CSENSORCALLBACK_H
       
    20 #define CSENSORCALLBACK_H
       
    21 
       
    22 
       
    23 #include <Liwserviceifbase.h>
       
    24 #include <LiwCommon.h>
       
    25 #include <sensrvtypes.h>
       
    26 #include <sensrvdatalistener.h>
       
    27 #include <sensrvchannelinfo.h>
       
    28 #include "sensorinterface.hrh"
       
    29 #include "sensorinterface.h"
       
    30 
       
    31 /**
       
    32  *  This class implements sensor  callback.
       
    33  *  An object of this class gets instantiated by sensor
       
    34  *  interface class when a request for getting sensor data
       
    35  *  arrives from consumer.
       
    36  *  @since S60 v5.0
       
    37  */
       
    38 
       
    39 class CSensorCallback : public CBase,
       
    40                         public MSensrvDataListener
       
    41     {
       
    42     public:
       
    43 
       
    44          static CSensorCallback*  NewL( MLiwNotifyCallback* aCallBack,
       
    45                                         TInt32 aTransactionid );
       
    46          virtual ~CSensorCallback();
       
    47 
       
    48          /**
       
    49          * Indicates data is available in the receiving buffer. A client can read the
       
    50          * data through ReadData()-function in a related channel object. Data is valid until
       
    51          * the data received notification will occurs again.
       
    52          *
       
    53          * @since S60 5.0
       
    54          * @param[in] aChannel Reference to the related channel object
       
    55          * @param[in] aCount Data object count in receiving buffer.
       
    56          * @param[in] aDataLost Data object lost count.
       
    57          */
       
    58          void DataReceived( CSensrvChannel& aChannel,
       
    59                             TInt aCount,
       
    60                             TInt aDataLost );
       
    61 
       
    62          /**
       
    63          * Data listening failed.
       
    64          * If error was fatal, channel has also been closed and sensor server session terminated.
       
    65          * If error was minor, some data has potentially been lost.
       
    66          *
       
    67          * @param[in] aChannel Reference to the related channel object
       
    68          * @param[in] aError Error code.
       
    69          * @since S60 5.0
       
    70          */
       
    71          void DataError( CSensrvChannel& aChannel,
       
    72                          TSensrvErrorSeverity aError);
       
    73 
       
    74          /**
       
    75          * Send Received sensor data back to the consumer
       
    76          * @param[in] aChannel Reference to the related channel object
       
    77          * @since S60 5.0
       
    78          */
       
    79          void DataNotificationL( CSensrvChannel& aChannel );
       
    80 
       
    81 		 
       
    82 		/** 
       
    83         * Returns a pointer to a specified interface - to allow future extension
       
    84         * of this class without breaking binary compatibility
       
    85         *
       
    86         * @since S60 5.0
       
    87         * @param aInterfaceUid Identifier of the interface to be retrieved
       
    88         * @param aInterface A reference to a pointer that retrieves the specified interface.
       
    89         */
       
    90         void GetDataListenerInterfaceL( TUid aInterfaceUid, 
       
    91                                         TAny*& aInterface );
       
    92 
       
    93     private:
       
    94          void ConstructL();
       
    95          CSensorCallback( MLiwNotifyCallback* aCallBack,
       
    96                           TInt32 aTransactionid );
       
    97     private:
       
    98          
       
    99          MLiwNotifyCallback* iCallBack;
       
   100          TInt32 iTransactionId;
       
   101 
       
   102     };
       
   103 
       
   104 
       
   105 
       
   106 
       
   107 #endif // CSENSORCALLBACK_H