williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description: Data listener
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#ifndef SENSRVDATALISTENER_H
|
williamr@2
|
20 |
#define SENSRVDATALISTENER_H
|
williamr@2
|
21 |
|
williamr@2
|
22 |
|
williamr@2
|
23 |
#include <e32base.h>
|
williamr@2
|
24 |
#include <sensrvchannel.h>
|
williamr@2
|
25 |
#include <sensrvtypes.h>
|
williamr@2
|
26 |
|
williamr@2
|
27 |
/**
|
williamr@2
|
28 |
* Data listener callback interface to indicate when data is available for clients to read.
|
williamr@2
|
29 |
*
|
williamr@2
|
30 |
* This class is for use with the CSensrvChannel::StartDataListeningL() method. Clients wishing to
|
williamr@2
|
31 |
* use data listening must inherit from this class and provide a reference to an instance of it in
|
williamr@2
|
32 |
* CSensrvChannel::StartDataListeningL().
|
williamr@2
|
33 |
*
|
williamr@2
|
34 |
* @see CSensrvChannel::StartDataListeningL()
|
williamr@2
|
35 |
* @see CSensrvChannel::GetData()
|
williamr@2
|
36 |
* @see CSensrvChannel::StopDataListening()
|
williamr@2
|
37 |
* @lib sensrvclient.lib
|
williamr@2
|
38 |
* @since S60 5.0
|
williamr@2
|
39 |
*/
|
williamr@2
|
40 |
class MSensrvDataListener
|
williamr@2
|
41 |
{
|
williamr@2
|
42 |
public:
|
williamr@2
|
43 |
/**
|
williamr@2
|
44 |
* Callback implemented by a client so that they can be notified that data is available to read.
|
williamr@2
|
45 |
* A client can read the data using CSensrvChannel::GetData(). Data is valid until this
|
williamr@2
|
46 |
* DataReceived() notification occurs again.
|
williamr@2
|
47 |
|
williamr@2
|
48 |
* Data loss can occur if the client does not retrieve data, using SensrvChannel::GetData(), from
|
williamr@2
|
49 |
* server fast enough after the client has been told it is availble. This can happen when system
|
williamr@2
|
50 |
* is under heavy load and the client process has lower priority than sensor server process.
|
williamr@2
|
51 |
* If data loss is a problem consider using a higher object count in data listening, which will
|
williamr@2
|
52 |
* reduce the number of IPC context switches.
|
williamr@2
|
53 |
*
|
williamr@2
|
54 |
* Clients providing an implementation for this callback must ensure that the operation does not
|
williamr@2
|
55 |
* leave. If a leave does occur then the behaviour is undefined.
|
williamr@2
|
56 |
*
|
williamr@2
|
57 |
* @since S60 5.0
|
williamr@2
|
58 |
* @param aChannel Channel associated with the listener
|
williamr@2
|
59 |
* @param aCount Data object count contained in data to be read
|
williamr@2
|
60 |
* @param aDataLost Number of lost data items.
|
williamr@2
|
61 |
* @see CSensrvChannel::GetData()
|
williamr@2
|
62 |
*/
|
williamr@2
|
63 |
virtual void DataReceived( CSensrvChannel& aChannel,
|
williamr@2
|
64 |
TInt aCount,
|
williamr@2
|
65 |
TInt aDataLost ) = 0;
|
williamr@2
|
66 |
|
williamr@2
|
67 |
/**
|
williamr@2
|
68 |
* Callback implemented by a client so that they can be notified when data listening has failed.
|
williamr@2
|
69 |
* If the error is fatal the channel will be closed, the sensor server session has been terminated
|
williamr@2
|
70 |
* and the channel object is no longer useable. If the error is minor, some data has potentially
|
williamr@2
|
71 |
* been lost, however listening is still active.
|
williamr@2
|
72 |
*
|
williamr@2
|
73 |
* Clients providing an implementation for this callback must ensure that the operation does not
|
williamr@2
|
74 |
* leave. If a leave does occur then the behaviour is undefined.
|
williamr@2
|
75 |
*
|
williamr@2
|
76 |
* @since S60 5.0
|
williamr@2
|
77 |
* @param aChannel Channel associated with the listener
|
williamr@2
|
78 |
* @param aError The error severity
|
williamr@2
|
79 |
*/
|
williamr@2
|
80 |
virtual void DataError( CSensrvChannel& aChannel,
|
williamr@2
|
81 |
TSensrvErrorSeverity aError ) = 0;
|
williamr@2
|
82 |
|
williamr@2
|
83 |
/**
|
williamr@2
|
84 |
* Callback to future proof this API so that additional callbacks can be added in the future
|
williamr@2
|
85 |
* without breaking binary compatibility.
|
williamr@2
|
86 |
*
|
williamr@2
|
87 |
* @since S60 5.0
|
williamr@2
|
88 |
* @param aInterfaceUid Identifier for the interface to be retrieved
|
williamr@2
|
89 |
* @param aInterface A reference to a pointer for the specified interface. Implementation sets
|
williamr@2
|
90 |
* aInterface to a valid pointer if the M-class identified by aInterfaceUid is supported, otherwise
|
williamr@2
|
91 |
* it is set to NULL on exit.
|
williamr@2
|
92 |
* @leave One of the system-wide error codes
|
williamr@2
|
93 |
*/
|
williamr@2
|
94 |
virtual void GetDataListenerInterfaceL( TUid aInterfaceUid, TAny*& aInterface ) = 0;
|
williamr@2
|
95 |
|
williamr@2
|
96 |
};
|
williamr@2
|
97 |
|
williamr@2
|
98 |
#endif //SENSRVDATALISTENER_H
|
williamr@2
|
99 |
|
williamr@2
|
100 |
// End of File
|