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: Sensor Channel API
20 #ifndef SENSRVCHANNELFINDER_H
21 #define SENSRVCHANNELFINDER_H
25 #include <sensrvtypes.h>
26 #include <sensrvchannelinfo.h>
29 class MSensrvChannelListener;
32 * The CSensrvChannelFinder class provides an API that allows clients to discover the sensor
33 * channels supported by Sensor Services and receive notifications when channels are installed
36 * The channel specific header files e.g. for orientation, acceleration, proximity, will document
37 * whether a secure id, vendor id or a set of capabilities, if any, is required by the client to
38 * be able to view a channel or receive notifications for it. See the channel specific header
39 * files for these requirements.
41 * On instantiation of this class a session connection to the Sensor Server is made. The Sensor
42 * server is a transient server and is started, if not already running, when a session connection
43 * is made. The sensor server is shutdown when a device-configured timeout period expires after
44 * the last session connection has been dropped. The Sensor Server will not shutdown if there is
45 * a session connection to it.
47 * Each item in RSensrvChannelInfoList returned by FindChannelsL() contains a channel Id which is
48 * only valid for the lifetime of the sensor server. If a client requires that this id remains
49 * unchanged then the client must ensure that an instance of either CSensrvChannelFinder or
50 * CSensrvChannel remains instantiated. This keeps a session connection with the server open which
51 * prevents the sensor server from shutting down.
54 * @lib sensrvclient.lib
57 NONSHARABLE_CLASS( CSensrvChannelFinder ): public CBase
61 * Two-phased constructor.
64 * @return Pointer to created CSensrvChannelFinder object
66 * @leave One of the system-wide error codes
68 IMPORT_C static CSensrvChannelFinder* NewL();
71 * Two-phased constructor.
74 * @return Pointer to created CSensrvChannelFinder object that is placed on the cleanup stack.
76 * @leave One of the system-wide error codes
78 IMPORT_C static CSensrvChannelFinder* NewLC();
82 * Retrieves a list of channels that meet the supplied search parameters. Only
83 * channels for which the client has the required secure id, vendor id and
84 * capabilities will be returned. See class description for further information.
87 * @param aChannelList List of all channels matching the supplied search
88 * parameters. Each TSensrvChannelInfo instance in the list can be used
89 * to open a channel. Empty list is returned if no matching channels are
91 * @param aSearchParameters Parameters for which matching channels are to be
92 * found. To omit a field from the search use zero (if integer) or
93 * empty string (if descriptor). If all fields are zero or empty string
94 * all channels provided by the system will be returned. ChannelId,
95 * DataItemSize and Reserved data will be ignored if set.
96 * @leave One of the system-wide error codes
98 virtual void FindChannelsL( RSensrvChannelInfoList& aChannelList,
99 const TSensrvChannelInfo& aSearchParameters ) = 0;
102 * Listens for channels that meet the supplied search parameters. Only channels
103 * for which the client has the required secure id, vendor id and capabilities
104 * will be returned. See class description. Listening can be stopped by providing
105 * a NULL parameter for the aChannelListener argument.
108 * @param aChannelListener Pointer to channel listener callback instance. The
109 * channel listener must be valid until the CSensrvChannelFinder object
110 * is destroyed or listening has been stopped. Listening can be stopped
111 * using a NULL parameter.
112 * @param aSearchParameters Parameters for which matching channel notifications
113 * are to be provided. To omit a field from the search use zero (if integer)
114 * or empty string (if descriptor). If all fields are zero or empty string
115 * all channels provided by the system will be returned. ChannelId,
116 * DataItemSize and Reserved data will be ignored if set.
117 * @leave KErrAlreadyExists if channel listener has already been set
118 * @leave One of the system-wide error codes
120 virtual void SetChannelListenerL( MSensrvChannelListener* aChannelListener,
121 const TSensrvChannelInfo& aSearchParameters ) = 0;
125 * Default constructor.
127 CSensrvChannelFinder();
131 #endif //SENSRVCHANNELFINDER_H