epoc32/include/sensrvchannel.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
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 class definition
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
#ifndef SENSRVCHANNEL_H
williamr@2
    20
#define SENSRVCHANNEL_H
williamr@2
    21
williamr@2
    22
#include <e32base.h>
williamr@2
    23
#include <sensrvtypes.h>
williamr@2
    24
#include <sensrvchannelconditionset.h>
williamr@2
    25
#include <sensrvchannelinfo.h>
williamr@2
    26
williamr@2
    27
williamr@2
    28
class MSensrvPropertyListener;
williamr@2
    29
class MSensrvDataListener;
williamr@2
    30
class MSensrvChannelConditionListener;
williamr@2
    31
class CSensrvChannelCondition;
williamr@2
    32
class CSensrvChannelListener;
williamr@2
    33
williamr@2
    34
williamr@2
    35
/**
williamr@2
    36
* The CSensrvChannel class provides an API that allows clients to open, control, configure, 
williamr@2
    37
* receive data and receive notifications from a sensor channel.
williamr@2
    38
* 
williamr@2
    39
* When instantiating CSensrvChannel an instance of TSensrvChannelInfo returned by
williamr@2
    40
* CSensrvChannelFinder::FindChannelsL() must be used. This ensures that internal data used
williamr@2
    41
* in identifying the chosen channel is passed back to Sensor Services in its entirety
williamr@2
    42
* therefore ensuring correct operation. Not using the instance returned by
williamr@2
    43
* CSensrvChannelFinder::FindChannelsL() will result in undefined behaviour.
williamr@2
    44
* 
williamr@2
    45
* On instantiation of this class a session connection to the Sensor Server is made. The Sensor
williamr@2
    46
* server is a transient server and is started, if not already running, when a session connection
williamr@2
    47
* is made. The sensor server is shutdown when a device-configured timeout period expires after
williamr@2
    48
* the last session connection has been dropped. The Sensor Server will not shutdown if there is
williamr@2
    49
* a session connection to it.
williamr@2
    50
* 
williamr@2
    51
* The instance of TSensrvChannelInfo returned by CSensrvChannelFinder::FindChannelsL()
williamr@2
    52
* contains a channel Id which is only valid for the lifetime of the sensor server. If a client
williamr@2
    53
* requires that this id remains unchanged then the client must ensure that an instance of either
williamr@2
    54
* CSensrvChannelFinder or CSensrvChannel remains instantiated. This keeps a session connection with
williamr@2
    55
* the server open which prevents the sensor server from shutting down.
williamr@2
    56
* 
williamr@2
    57
* After creating an instance of this class a client would typically:
williamr@2
    58
* 1. Check the configuration of the channel using GetPropertyL() or GetAllPropertuies().
williamr@2
    59
* 2. Change the configuration where necessary using SetPropertiesL()
williamr@2
    60
* 3. If SetPropertiesL() failed, because of higher priority clients of this same channel or higher
williamr@2
    61
* priority clients of impacted channels on the same sensor, listen for notifications indicating
williamr@2
    62
* when it is able to set properties using SetPropertyListenerl().
williamr@2
    63
* 4. Listen for property changes using SetPropertyListenerl(). This notifies the client of property
williamr@2
    64
* changes made by other clients of this same channel.
williamr@2
    65
* 5. Listen for data and retrieve data on the channel using StartDataListeningL() and GetData().
williamr@2
    66
* 6. Set trigger conditions for a 1 off notification when the condition is met using AddConditionL()
williamr@2
    67
* and SetConditionListeningL(). 
williamr@2
    68
* 
williamr@2
    69
* Its possible that there may be more than 1 client using the same sensor channel on the device. Each
williamr@2
    70
* of these clients will have created their own instance of CSensrvChannel and can attempt to configure
williamr@2
    71
* the sensor using the SetPropertyL() operation. To manage any contention between clients wishing to
williamr@2
    72
* change the configuration of the sensor a concept of Client Priorities is employed. This means that a
williamr@2
    73
* device creator assigns a pre-determined priority to a client. If a client has not been assigned a
williamr@2
    74
* priority then it is assumed it has the lowest priority.
williamr@2
    75
* 
williamr@2
    76
* When the SetPropertyL() operation is called the sensor server checks to see if the client has the
williamr@2
    77
* highest Client Priority of all clients using that channel or using an impacted channel on the same
williamr@2
    78
* sensor. If it has the property is set and all other clients of the channel are notified of the property
williamr@2
    79
* change. If it has not the SetPropertyL() operation fails with KErrAccessDenied. If clients have
williamr@2
    80
* the same priority then property setting is done on a first come first served basis.
williamr@2
    81
* 
williamr@2
    82
* If a client is unable to set a property because of higher priority clients then the client should
williamr@2
    83
* implement the MSensrvPropertyListener::SetPropertySuccessIndicationChanged() callback so that they can
williamr@2
    84
* be notified when they are able to set properties.
williamr@2
    85
* 
williamr@2
    86
* All client applications should be designed in such a way so that they are able to handle the situation
williamr@2
    87
* where they are unable to configure a channel using the SetPropertyL() operation.
williamr@2
    88
* 
williamr@2
    89
* For example:
williamr@2
    90
* Should application features be disabled or should the application shutdown in such conditions?
williamr@2
    91
* Should features be disabled under certain channel configurations?
williamr@2
    92
* 
williamr@2
    93
* This object is closed when deleted either by a call to operator delete or by the cleanup stack. No special
williamr@2
    94
* cleanup code is necessary to close the object before deletion.
williamr@2
    95
*
williamr@2
    96
* @see CSensrvChannelFinder
williamr@2
    97
* @lib sensrvclient.lib
williamr@2
    98
* @since S60 5.0
williamr@2
    99
*/
williamr@2
   100
williamr@2
   101
NONSHARABLE_CLASS( CSensrvChannel ): public CBase
williamr@2
   102
    {
williamr@2
   103
    public:
williamr@2
   104
    /**
williamr@2
   105
    * Two-phased constructor.
williamr@2
   106
    *
williamr@2
   107
    * The Sensor Server uses aChannelInfo to identify the channel in the server that the returned object
williamr@2
   108
    * represents.
williamr@2
   109
    *
williamr@2
   110
    * @since S60 5.0
williamr@2
   111
    * @param  aChannelInfo The information that determines which channel object is created. This must
williamr@2
   112
    *         be an object returned by CSensrvChannelFinder::FindChannelsL().
williamr@2
   113
    * @return Pointer to created CSensorChannel object
williamr@2
   114
    * @leave  KErrNoMemory
williamr@2
   115
    * @leave  One of the system-wide error codes
williamr@2
   116
    */  
williamr@2
   117
    IMPORT_C static CSensrvChannel* NewL
williamr@2
   118
            ( const TSensrvChannelInfo& aChannelInfo );
williamr@2
   119
williamr@2
   120
    /**
williamr@2
   121
    * Two-phased constructor.      
williamr@2
   122
    * 
williamr@2
   123
    * The Sensor Server uses aChannelInfo to identify the channel in the server that the returned object
williamr@2
   124
    * represents.
williamr@2
   125
    * 
williamr@2
   126
    * @since S60 5.0
williamr@2
   127
    * @param  aChannelInfo The information that determines which channel object is created. This must
williamr@2
   128
    *         be an object returned by CSensrvChannelFinder::FindChannelsL().
williamr@2
   129
    * @return Pointer to created CSensorChannel object that is placed on the cleanup stack.      
williamr@2
   130
    * @leave  KErrNoMemory
williamr@2
   131
    * @leave  One of the system-wide error codes
williamr@2
   132
    */  
williamr@2
   133
    IMPORT_C static CSensrvChannel* NewLC
williamr@2
   134
            ( const TSensrvChannelInfo& aChannelInfo );
williamr@2
   135
  
williamr@2
   136
    public:
williamr@2
   137
    /**
williamr@2
   138
    * Initializes and opens the channel. After the channel is opened, the client can set and get channel
williamr@2
   139
    * properties, add channel conditions and listen for sensor data.
williamr@2
   140
    * 
williamr@2
   141
    * @since S60 5.0
williamr@2
   142
    * @leave  KErrAlreadyExists if channel is already open
williamr@2
   143
    * @leave  One of the system-wide error codes
williamr@2
   144
    */
williamr@2
   145
    virtual void OpenChannelL() = 0;
williamr@2
   146
williamr@2
   147
    /**
williamr@2
   148
    * Closes the channel. 
williamr@2
   149
    * 
williamr@2
   150
    * This object is closed when deleted either by a call to operator delete or by the cleanup stack. No special
williamr@2
   151
    * cleanup code is necessary to close the object before deletion.
williamr@2
   152
    * 
williamr@2
   153
    * @since S60 5.0
williamr@2
   154
    * @return KErrNone if channel closing is successful, or one of the system-wide error codes
williamr@2
   155
    */  
williamr@2
   156
    virtual TInt CloseChannel() = 0;
williamr@2
   157
    
williamr@2
   158
    /**
williamr@2
   159
    * Retrieves a channel information object related to this channel.
williamr@2
   160
    *     
williamr@2
   161
    * @since S60 5.0
williamr@2
   162
    * @return Reference to the channel information object
williamr@2
   163
    */  
williamr@2
   164
    virtual const TSensrvChannelInfo& GetChannelInfo() const = 0;
williamr@2
   165
williamr@2
   166
    /**
williamr@2
   167
    * Starts channel data listening on the channel.
williamr@2
   168
    * 
williamr@2
   169
    * To use this operation clients must provide an object that inherits from MSensrvDataListener.  
williamr@2
   170
    * 
williamr@2
   171
    * When new data is available to be read, the client is notified by the
williamr@2
   172
    * MSensrvDataListener::DataReceived() callback. On receiving this notificaton the client should
williamr@2
   173
    * retrieve the data using the GetData() operation.
williamr@2
   174
    * 
williamr@2
   175
    * Note that if a client is listening for both data and conditions on the channel then the lower
williamr@2
   176
    * desired count and buffering period provided in either start listening operation arguments will be
williamr@2
   177
    * used for both listeners. When either listener is stopped neither the desired count nor the
williamr@2
   178
    * buffering period shall be changed.
williamr@2
   179
    * 
williamr@2
   180
    * For the best performance, always use the highest desired count and maximum count as the use case
williamr@2
   181
    * allows. This will reduce the overhead caused by a high volume of IPC context switches. However,
williamr@2
   182
    * be aware that higher counts need to reserve more memory.
williamr@2
   183
    * 
williamr@2
   184
    * @since S60 5.0
williamr@2
   185
    * @param  aDataListener Data listener for the channel. Must be valid until data listening is stopped. 
williamr@2
   186
    * @param  aDesiredCount Desired receiving buffer size defined as a count of the channel data objects.
williamr@2
   187
    *         The maximum value is determined by sensor server internal channel buffer size, and minimum
williamr@2
   188
    *         value is one. Any value outside these limits is interpreted as maximum possible value.
williamr@2
   189
    *         The actual count of channel data objects received may be smaller than aDesiredCount, if a
williamr@2
   190
    *         non-zero buffering period has been specified.
williamr@2
   191
    *         The actual count of channel data objects received may larger, if aMaximumCount is bigger
williamr@2
   192
    *         than aDesiredCount.
williamr@2
   193
    *         If the sensor supplies data sporadically, and the clients requires every data object then
williamr@2
   194
    *         aDesiredCount should be set to one to ensure that no data objects are missed. 
williamr@2
   195
    * @param  aMaximumCount Maximum receiving buffer size defined as a count of the channel data object.
williamr@2
   196
    *         The Maximum value is determined by sensor server internal channel buffer size, and minimum
williamr@2
   197
    *         value is aDesiredCount. Any value outside these limits is interpreted as maximum possible
williamr@2
   198
    *         value.
williamr@2
   199
    *         It is recommended that whenever aDesiredCount needs to be low and sensor has relatively high
williamr@2
   200
    *         data rate, aMaximumCount is set to significantly higher than aDesiredCount to reduce IPC
williamr@2
   201
    *         context switches and data loss.
williamr@2
   202
    * @param  aBufferingPeriod Specifies the maximum time in milliseconds that sensor server waits before
williamr@2
   203
    *         notifying the client that new data is available. It is possible that no new data is will be
williamr@2
   204
    *         available when the client is notified.
williamr@2
   205
    *         Zero timeout means that only desired and maximum counts are used in getting data.
williamr@2
   206
    *         Using a buffering period results in lot of unnecessary IPC context switches if a sensor
williamr@2
   207
    *         channel supplies data sporadically. It is therefore recommended that a buffering period is
williamr@2
   208
    *         used only when it is absolutely vital to have data at specific intervals and using a low
williamr@2
   209
    *         desired count is otherwise too expensive performance-wise.
williamr@2
   210
    * @leave  KErrArgument if aDataListener is NULL, or if a negative argument is supplied
williamr@2
   211
    * @leave  KErrNotFound if the channel is not open
williamr@2
   212
    * @leave  KErrAlreadyExists if data listening has already started on the channel
williamr@2
   213
    * @leave  One of the system-wide error codes
williamr@2
   214
    */  
williamr@2
   215
    virtual void StartDataListeningL( MSensrvDataListener* aDataListener, 
williamr@2
   216
                                      const TInt aDesiredCount, 
williamr@2
   217
                                      const TInt aMaximumCount,
williamr@2
   218
                                      const TInt aBufferingPeriod ) = 0;
williamr@2
   219
williamr@2
   220
    /**
williamr@2
   221
    * Stop channel data listening. 
williamr@2
   222
    * 
williamr@2
   223
    * @since S60 5.0
williamr@2
   224
    * @return KErrNone if stopping successful or one of the system-wide error codes
williamr@2
   225
    */  
williamr@2
   226
    virtual TInt StopDataListening() = 0;
williamr@2
   227
williamr@2
   228
    /**
williamr@2
   229
    * Get data items when the client is notified by the MSensrvDataListener::DataReceived() callback
williamr@2
   230
    * that new data is ready to be retrieved. The callback also indicates the number of data items
williamr@2
   231
    * contained in aData. 
williamr@2
   232
    * 
williamr@2
   233
    * Example:
williamr@2
   234
    *     
williamr@2
   235
    * How to retrieve data using TPckg
williamr@2
   236
    * 
williamr@2
   237
    * @code
williamr@2
   238
	  * void DataReceived(CSensrvChannel& aChannel, TInt aCount, TInt aDataLost )
williamr@2
   239
		* {
williamr@2
   240
    * if(aChannel.GetChannelInfo().iChannelType == KSensrvChannelTypeIdAccelerometerXYZAxisData)
williamr@2
   241
		* 	{
williamr@2
   242
		* 	TSensrvAccelerometerAxisData XYZData;
williamr@2
   243
	  *       TPckg<TSensrvAccelerometerAxisData> XYZPackage( XYZData );
williamr@2
   244
	  *       aChannel.GetData( XYZPackage );
williamr@2
   245
		* 	}
williamr@2
   246
		* }
williamr@2
   247
    * @endcode
williamr@2
   248
    *  
williamr@2
   249
    * @since S60 5.0
williamr@2
   250
    * @param  aData Reference to descriptor that contains the data. Typically this is a package buffer
williamr@2
   251
    *         defined for data type of this channel. See channel specific data headers for details of
williamr@2
   252
    *         the package types and data supported by a channel.
williamr@2
   253
    * @return KErrNotFound if data buffer is empty, KErrOverflow if aData is wrong size for data
williamr@2
   254
    *         item, or one of the system-wide error codes
williamr@2
   255
    */  
williamr@2
   256
    virtual TInt GetData( TDes8& aData ) = 0;
williamr@2
   257
 
williamr@2
   258
    /**
williamr@2
   259
    * Sets a property value for this channel. To manage any contention between multiple clients wishing
williamr@2
   260
    * to change the configuration of the sensor a concept of Client Priorities is employed. See class
williamr@2
   261
    * description for further information.
williamr@2
   262
    * 
williamr@2
   263
    * The sensor plugin may police setting of properties by verifying that the client making the request
williamr@2
   264
    * has the necessary capabilities. If the client does not then it will return with KErrAccessDenied.
williamr@2
   265
    * @since S60 5.0
williamr@2
   266
    * @param  aProperty Identifies the property that is to be set and its new value. Only the Property Id,
williamr@2
   267
    *         Item Index and Property Value should be filled in. All other fields in TSensrvProperty are
williamr@2
   268
    *         ignored.
williamr@2
   269
    * @return KErrNotFound if channel is not open or if the property does not exist, KErrAccessDenied
williamr@2
   270
    *         if there are other clients for this channel or impacted channel on the same sensor with a
williamr@2
   271
    *         higher Client Priority, KErrAccessDenied if the client does not have the required
williamr@2
   272
    *         capabilities or one of the system-wide error codes
williamr@2
   273
    */  
williamr@2
   274
    virtual TInt SetProperty(  const TSensrvProperty& aProperty ) = 0;
williamr@2
   275
      
williamr@2
   276
    /**
williamr@2
   277
    * Gets a channel property value for this channel.
williamr@2
   278
    * 
williamr@2
   279
    * @since S60 5.0
williamr@2
   280
    * @param  aPropertyId Id of the property that is to be retrieved
williamr@2
   281
    * @param  aItemIndex The Item Index of the property to be retrieved. This is mapped to a specific item
williamr@2
   282
    *         in channel data structure. See channel specific data headers.
williamr@2
   283
    * @param  aProperty Reference for a property object where property data is to be copied
williamr@2
   284
    * @leave  KErrNotFound if channel is not open
williamr@2
   285
    * @leave  KErrNotFound if property does not exist
williamr@2
   286
    * @leave  KErrArgument if a negative argument is supplied
williamr@2
   287
    * @leave  One of the system-wide error codes
williamr@2
   288
    * */
williamr@2
   289
    virtual void GetPropertyL( const TSensrvPropertyId aPropertyId, 
williamr@2
   290
                               const TInt aItemIndex,
williamr@2
   291
                               TSensrvProperty& aProperty ) = 0;
williamr@2
   292
                               
williamr@2
   293
    /**
williamr@2
   294
    * Get a channel property value for this channel
williamr@2
   295
    * 
williamr@2
   296
    * @since S60 5.0
williamr@2
   297
    * @param  aPropertyId Id of the property that is to be retrieved
williamr@2
   298
    * @param  aItemIndex Item Index of the property to be retrieved. This is mapped to a specific item
williamr@2
   299
    *         in channel data structure. See channel specific data headers.
williamr@2
   300
    * @param  aArrayIndex Array index of the property to be retrieved when the property is part of a
williamr@2
   301
    *         property array.
williamr@2
   302
    * @param  aProperty Reference for a property object where property data is to be copied
williamr@2
   303
    * @leave  KErrNotFound if channel is not open
williamr@2
   304
    * @leave  KErrNotFound if property does not exist
williamr@2
   305
    * @leave  KErrArgument if a negative argument is supplied
williamr@2
   306
    * @leave  One of the system-wide error codes
williamr@2
   307
    */  
williamr@2
   308
    virtual void GetPropertyL( const TSensrvPropertyId aPropertyId, 
williamr@2
   309
                               const TInt aItemIndex,
williamr@2
   310
                               const TInt aArrayIndex,
williamr@2
   311
                               TSensrvProperty& aProperty ) = 0;
williamr@2
   312
williamr@2
   313
    /**
williamr@2
   314
    * Get all properties for this channel
williamr@2
   315
    * 
williamr@2
   316
    * @since S60 5.0
williamr@2
   317
    * @param  aChannelPropertyList Reference for a property list where all property data is to be
williamr@2
   318
    *         copied. Any existing data in the list will be lost.
williamr@2
   319
    * @leave  KErrNotFound if channel is not open
williamr@2
   320
    * @leave  One of the system-wide error codes
williamr@2
   321
    */  
williamr@2
   322
    virtual void GetAllPropertiesL
williamr@2
   323
            ( RSensrvPropertyList& aChannelPropertyList ) = 0;
williamr@2
   324
            
williamr@2
   325
    /**
williamr@2
   326
    * Get all channel properties having the supplied Property Id. This is used when the property
williamr@2
   327
    * is an array property.    
williamr@2
   328
    * 
williamr@2
   329
    * @since S60 5.0
williamr@2
   330
    * @param  aPropertyId Id of the property to be retrieved
williamr@2
   331
    * @param  aChannelPropertyList Reference for a property list where all property data is to be
williamr@2
   332
    *         copied. Any existing data in the list will be lost.
williamr@2
   333
    * @leave  KErrNotFound if channel is not open
williamr@2
   334
    * @leave  KErrNotFound if property does not exist
williamr@2
   335
    * @leave  One of the system-wide error codes
williamr@2
   336
    */  
williamr@2
   337
    virtual void GetAllPropertiesL
williamr@2
   338
            ( const TSensrvPropertyId aPropertyId, 
williamr@2
   339
              RSensrvPropertyList& aChannelPropertyList ) = 0;
williamr@2
   340
williamr@2
   341
    /**
williamr@2
   342
    * Start property listening on this channel.
williamr@2
   343
    * 
williamr@2
   344
    * To use this operation clients must provide an object that inherits from MSensrvPropertyListener.
williamr@2
   345
    *     
williamr@2
   346
    * The client can use the property listener to get notifications when properties are changed and
williamr@2
   347
    * to get a notification when the client is able/unable to set properties because of higher priority
williamr@2
   348
    * clients have opened/closed the same sensor channel.
williamr@2
   349
    * 
williamr@2
   350
    * If the client itself changes a property value, no notification is received for that property by
williamr@2
   351
    * the client. If another client changes a property on this channel or another channel that impacts
williamr@2
   352
    * this channel a notification will be received by the client.
williamr@2
   353
    * 
williamr@2
   354
    * Some sensors support a number of channels with each channel having some common properties.
williamr@2
   355
    * Therefore changing a common property may result in notifications on a number of other channels
williamr@2
   356
    * supported by the sensor.
williamr@2
   357
    * 
williamr@2
   358
    * @since S60 5.0
williamr@2
   359
    * @param  aChannelPropertyListener Pointer to channel property listener callback instance. The
williamr@2
   360
    *         channel property listener must be valid until the CSensrvChannel object is destroyed or
williamr@2
   361
    *         listening has been stopped. Listening can be stopped using a NULL parameter.
williamr@2
   362
    * @leave  KErrAlreadyExists if channel property listener has already been set
williamr@2
   363
    * @leave  KErrNotFound if channel is not open
williamr@2
   364
    * @leave  One of the system-wide error codes
williamr@2
   365
    */  
williamr@2
   366
    virtual void SetPropertyListenerL
williamr@2
   367
                  ( MSensrvPropertyListener* aChannelPropertyListener ) = 0;
williamr@2
   368
 
williamr@2
   369
    /**
williamr@2
   370
    * Add a channel ConditionSet to the channel.
williamr@2
   371
    * 
williamr@2
   372
    * Channel ConditionSet's are used for channel condition listening and at least 1 ConditionSet must
williamr@2
   373
    * be added before listening can begin.
williamr@2
   374
    * 
williamr@2
   375
    * When the conditions defined by the ConditionSet is met the client will be notified by the 
williamr@2
   376
    * MSensrvChannelConditionListener::ConditionMet() callback and listening for this ConditionSet will
williamr@2
   377
    * cease. If a client wishes to listen for this ConditionSet again it must be added again.
williamr@2
   378
    * 
williamr@2
   379
    * The client continues to own the ConditionSet object after a call to this function and must ensure
williamr@2
   380
    * that it is destroyed when no longer required.
williamr@2
   381
    * 
williamr@2
   382
    * The client must ensure that the ConditionSet object is valid until it is no longer needed by the
williamr@2
   383
    * Sensor Server. This is either after the condition set has been removed by the client using
williamr@2
   384
    * RemoveConditionL() or the client has been notified that the condition has been met.
williamr@2
   385
    * 
williamr@2
   386
    * @since S60 5.0
williamr@2
   387
    * @param  aChannelConditionSet The channel condition set to be added.
williamr@2
   388
    * @leave  KErrNotFound if channel is not open
williamr@2
   389
    * @leave  KErrNotSupported if a channel does not support conditions.
williamr@2
   390
    * @leave  One of the system-wide error codes
williamr@2
   391
    * @see CSensrvChannel::StartConditionListeningL()    
williamr@2
   392
    */  
williamr@2
   393
    virtual void AddConditionL( CSensrvChannelConditionSet& aChannelConditionSet ) = 0;
williamr@2
   394
williamr@2
   395
    /**
williamr@2
   396
    * Remove a channel ConditionSet from the channel.
williamr@2
   397
    * 
williamr@2
   398
    * The same reference used to to add the Condition Set in AddConditionL(), must also be used to
williamr@2
   399
    * remove it. 
williamr@2
   400
    * 
williamr@2
   401
    * The removed channel ConditionSet is no longer used for channel condition listening. 
williamr@2
   402
    * 
williamr@2
   403
    * The client continues to own the ConditionSet object after a call to this function and must ensure
williamr@2
   404
    * that it is destroyed when no longer required.
williamr@2
   405
    * 
williamr@2
   406
    * @since S60 5.0
williamr@2
   407
    * @param  aChannelConditionSet The channel condition set to be removed.
williamr@2
   408
    * @leave  KErrNotFound if channel is not open
williamr@2
   409
    * @leave  One of the system-wide error codes
williamr@2
   410
    */  
williamr@2
   411
    virtual void RemoveConditionL
williamr@2
   412
                    ( CSensrvChannelConditionSet& aChannelConditionSet ) = 0;
williamr@2
   413
williamr@2
   414
    /**
williamr@2
   415
    * Start channel condition listening.
williamr@2
   416
    * 
williamr@2
   417
    * To use this operation clients must provide an object that inherits from MSensrvChannelConditionListener.
williamr@2
   418
    * 
williamr@2
   419
    * If the conditions of an added ConditionSet is met the MSensrvChannelConditionListener::ConditionMet()
williamr@2
   420
    * callback function will be called and listening for this ConditionSet will cease. If a client wishes
williamr@2
   421
    * to listen for the same ConditionSet again it must be added again.
williamr@2
   422
    * 
williamr@2
   423
    * Note that if a client is listening for both data and conditions on the channel then the lower
williamr@2
   424
    * desired count and buffering period provided in either start listening operation arguments will be
williamr@2
   425
    * used for both listeners. When either listener is stopped neither the desired count nor the
williamr@2
   426
    * buffering period shall be changed.
williamr@2
   427
    * 
williamr@2
   428
    * @since S60 5.0
williamr@2
   429
    * @param  aChannelConditionListener Condition listener for the channel. Must be valid until data
williamr@2
   430
    *         listening is stopped.
williamr@2
   431
    * @param  aObjectCount Listening buffer size defined as a count of the channel data objects. When the
williamr@2
   432
    *         desired object count is reached each ConditionSet is evaluated in turn. The maximum value is
williamr@2
   433
    *         determined by sensor server internal channel buffer size, and minimum value is one. Any value
williamr@2
   434
    *         outside these limits is interpreted as maximum possible value.
williamr@2
   435
    * @param  aBufferingPeriod Specifies the maximum time in milliseconds that sensor server waits before
williamr@2
   436
    *         evaluating new data.
williamr@2
   437
    *         Zero timeout means that the sensor server only evaluates new data when the object count has been
williamr@2
   438
    *         reached.
williamr@2
   439
    * @leave  KErrArgument if aChannelConditionListener is NULL, or if a negative argument is supplied
williamr@2
   440
    * @leave  KErrNotFound if the channel is not open
williamr@2
   441
    * @leave  KErrAlreadyExists if condition listening has already started on the channel
williamr@2
   442
    * @leave  One of the system-wide error codes  
williamr@2
   443
    */  
williamr@2
   444
    virtual void StartConditionListeningL
williamr@2
   445
                    ( MSensrvChannelConditionListener* aChannelConditionListener,
williamr@2
   446
                      const TInt aObjectCount,
williamr@2
   447
                      const TInt aBufferingPeriod ) = 0;
williamr@2
   448
williamr@2
   449
    /**
williamr@2
   450
    * Stop channel condition listening.
williamr@2
   451
    * 
williamr@2
   452
    * All remaining unmet ConditionSet's are removed and channel condition listening is stopped.
williamr@2
   453
    * 
williamr@2
   454
    * If the same ConditionSet's need to be used when condition listening has been restarted then they must be
williamr@2
   455
    * re-added.
williamr@2
   456
    * 
williamr@2
   457
    * @since S60 5.0
williamr@2
   458
    * @return KErrNone if condition listening is successfully stopped or one of the system-wide error codes
williamr@2
   459
    */  
williamr@2
   460
    virtual TInt StopConditionListening() = 0;
williamr@2
   461
    
williamr@2
   462
    public:
williamr@2
   463
    /**
williamr@2
   464
    * Default constructor. 
williamr@2
   465
    */
williamr@2
   466
    CSensrvChannel();
williamr@2
   467
    };
williamr@2
   468
williamr@2
   469
williamr@2
   470
#endif //SENSRVCHANNEL_H
williamr@2
   471
williamr@2
   472
// End of File