epoc32/include/sensrvdatalistener.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100 (2010-03-31)
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2 * Copyright (c) 2008 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:  Data listener
    15 *
    16 */
    17 
    18 
    19 #ifndef SENSRVDATALISTENER_H
    20 #define SENSRVDATALISTENER_H
    21 
    22 
    23 #include <e32base.h>
    24 #include <sensrvchannel.h>
    25 #include <sensrvtypes.h>
    26 
    27 /**
    28 * Data listener callback interface to indicate when data is available for clients to read.
    29 * 
    30 * This class is for use with the CSensrvChannel::StartDataListeningL() method. Clients wishing to
    31 * use data listening must inherit from this class and provide a reference to an instance of it in
    32 * CSensrvChannel::StartDataListeningL().
    33 * 
    34 * @see CSensrvChannel::StartDataListeningL()
    35 * @see CSensrvChannel::GetData()
    36 * @see CSensrvChannel::StopDataListening()
    37 * @lib sensrvclient.lib
    38 * @since S60 5.0 
    39 */
    40 class MSensrvDataListener
    41     {
    42     public:
    43     /**
    44     * Callback implemented by a client so that they can be notified that data is available to read.
    45     * A client can read the data using CSensrvChannel::GetData(). Data is valid until this
    46     * DataReceived() notification occurs again.
    47     
    48     * Data loss can occur if the client does not retrieve data, using SensrvChannel::GetData(), from
    49     * server fast enough after the client has been told it is availble. This can happen when system
    50     * is under heavy load and the client process has lower priority than sensor server process.
    51     * If data loss is a problem consider using a higher object count in data listening, which will
    52     * reduce the number of IPC context switches.
    53     * 
    54     * Clients providing an implementation for this callback must ensure that the operation does not
    55     * leave. If a leave does occur then the behaviour is undefined.
    56     * 
    57     * @since S60 5.0
    58     * @param  aChannel Channel associated with the listener
    59     * @param  aCount Data object count contained in data to be read
    60     * @param  aDataLost Number of lost data items.
    61     * @see CSensrvChannel::GetData()
    62     */  
    63     virtual void DataReceived( CSensrvChannel& aChannel, 
    64                                TInt aCount, 
    65                                TInt aDataLost ) = 0;
    66     
    67     /**
    68     * Callback implemented by a client so that they can be notified when data listening has failed.
    69     * If the error is fatal the channel will be closed, the sensor server session has been terminated
    70     * and the channel object is no longer useable. If the error is minor, some data has potentially
    71     * been lost, however listening is still active.
    72     * 
    73     * Clients providing an implementation for this callback must ensure that the operation does not
    74     * leave. If a leave does occur then the behaviour is undefined.
    75     * 
    76     * @since S60 5.0
    77     * @param  aChannel Channel associated with the listener
    78     * @param  aError The error severity
    79     */
    80     virtual void DataError( CSensrvChannel& aChannel, 
    81                             TSensrvErrorSeverity aError ) = 0;
    82     
    83     /** 
    84     * Callback to future proof this API so that additional callbacks can be added in the future 
    85     * without breaking binary compatibility.
    86     * 
    87     * @since S60 5.0
    88     * @param  aInterfaceUid Identifier for the interface to be retrieved
    89     * @param  aInterface A reference to a pointer for the specified interface. Implementation sets
    90     * aInterface to a valid pointer if the M-class identified by aInterfaceUid is supported, otherwise
    91     * it is set to NULL on exit.
    92     * @leave  One of the system-wide error codes
    93     */
    94 	virtual void GetDataListenerInterfaceL( TUid aInterfaceUid, TAny*& aInterface ) = 0;
    95 
    96     };
    97  
    98 #endif //SENSRVDATALISTENER_H
    99 
   100 // End of File