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