2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Data listener
19 #ifndef SENSRVDATALISTENER_H
20 #define SENSRVDATALISTENER_H
24 #include <sensrvchannel.h>
25 #include <sensrvtypes.h>
28 * Data listener callback interface to indicate when data is available for clients to read.
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().
34 * @see CSensrvChannel::StartDataListeningL()
35 * @see CSensrvChannel::GetData()
36 * @see CSensrvChannel::StopDataListening()
37 * @lib sensrvclient.lib
40 class MSensrvDataListener
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.
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.
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.
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()
63 virtual void DataReceived( CSensrvChannel& aChannel,
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.
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.
77 * @param aChannel Channel associated with the listener
78 * @param aError The error severity
80 virtual void DataError( CSensrvChannel& aChannel,
81 TSensrvErrorSeverity aError ) = 0;
84 * Callback to future proof this API so that additional callbacks can be added in the future
85 * without breaking binary compatibility.
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
94 virtual void GetDataListenerInterfaceL( TUid aInterfaceUid, TAny*& aInterface ) = 0;
98 #endif //SENSRVDATALISTENER_H