1 sensrvchannelfinder.h |
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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Sensor Channel API |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef SENSRVCHANNELFINDER_H |
|
21 #define SENSRVCHANNELFINDER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <sensrvtypes.h> |
|
26 #include <sensrvchannelinfo.h> |
|
27 |
|
28 // CLASS DECLARATION |
|
29 class MSensrvChannelListener; |
|
30 |
|
31 /** |
|
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 |
|
34 * and uninstalled. |
|
35 * |
|
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. |
|
40 * |
|
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. |
|
46 * |
|
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. |
|
52 * |
|
53 * @see CSensrvChannel |
|
54 * @lib sensrvclient.lib |
|
55 * @since S60 5.0 |
|
56 */ |
|
57 NONSHARABLE_CLASS( CSensrvChannelFinder ): public CBase |
|
58 { |
|
59 public: |
|
60 /** |
|
61 * Two-phased constructor. |
|
62 * |
|
63 * @since S60 5.0 |
|
64 * @return Pointer to created CSensrvChannelFinder object |
|
65 * @leave KErrNoMemory |
|
66 * @leave One of the system-wide error codes |
|
67 */ |
|
68 IMPORT_C static CSensrvChannelFinder* NewL(); |
|
69 |
|
70 /** |
|
71 * Two-phased constructor. |
|
72 * |
|
73 * @since S60 5.0 |
|
74 * @return Pointer to created CSensrvChannelFinder object that is placed on the cleanup stack. |
|
75 * @leave KErrNoMemory |
|
76 * @leave One of the system-wide error codes |
|
77 */ |
|
78 IMPORT_C static CSensrvChannelFinder* NewLC(); |
|
79 |
|
80 public: |
|
81 /** |
|
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. |
|
85 * |
|
86 * @since S60 5.0 |
|
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 |
|
90 * found. |
|
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 |
|
97 */ |
|
98 virtual void FindChannelsL( RSensrvChannelInfoList& aChannelList, |
|
99 const TSensrvChannelInfo& aSearchParameters ) = 0; |
|
100 |
|
101 /** |
|
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. |
|
106 * |
|
107 * @since S60 5.0 |
|
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 |
|
119 */ |
|
120 virtual void SetChannelListenerL( MSensrvChannelListener* aChannelListener, |
|
121 const TSensrvChannelInfo& aSearchParameters ) = 0; |
|
122 |
|
123 public: |
|
124 /** |
|
125 * Default constructor. |
|
126 */ |
|
127 CSensrvChannelFinder(); |
|
128 }; |
|
129 |
|
130 |
|
131 #endif //SENSRVCHANNELFINDER_H |
|
132 |
|
133 // End of File |