sensorservices/sensorserver/inc/client/sensrvconditionhandler.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2006 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 "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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Data handler
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CSENSRVCONDITIONHANDLER_H
       
    20 #define CSENSRVCONDITIONHANDLER_H
       
    21 
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 #include "sensrvclient.h"
       
    26 
       
    27 
       
    28 class MSensrvConditionHandlerObserver;
       
    29 
       
    30 /**
       
    31  *  Condition handler class
       
    32  *
       
    33  *  @lib SensorClient.lib
       
    34  *  @since S60 5.0
       
    35  */
       
    36 NONSHARABLE_CLASS( CSensrvConditionHandler ) : public CActive
       
    37     {
       
    38     public:
       
    39 
       
    40 
       
    41         static CSensrvConditionHandler* NewL( RSensrvClient& aSensrvClient, 
       
    42                                               const TSensrvChannelInfo& aChannelInfo );
       
    43 
       
    44         static CSensrvConditionHandler* NewLC( RSensrvClient& aSensrvClient, 
       
    45                                                const TSensrvChannelInfo& aChannelInfo );
       
    46 
       
    47         virtual ~CSensrvConditionHandler();
       
    48 
       
    49 
       
    50     public:
       
    51         /*
       
    52         * Start condition listening. Send request to server.
       
    53         *
       
    54         * @since S60 5.0
       
    55         * @param aConditionObserver Condition listener for channel.
       
    56         * @param aListeningParameters Listening parameters
       
    57         */
       
    58         void StartListening( MSensrvConditionHandlerObserver* aConditionObserver,
       
    59                              TSensrvStartListeningParameters aListeningParameters );
       
    60 
       
    61 
       
    62         /**
       
    63         * Blocks sending async message.
       
    64         *
       
    65         * @since S60 5.0
       
    66         */
       
    67         inline void BlockAsyncMessage() { iListening = EFalse; };
       
    68 
       
    69 
       
    70     protected: // From CActive
       
    71 
       
    72           void DoCancel();
       
    73           void RunL();
       
    74           TInt RunError(TInt aError);
       
    75 
       
    76 
       
    77     private:
       
    78 
       
    79         CSensrvConditionHandler( RSensrvClient& aSensrvClient,  const TSensrvChannelInfo& aChannelInfo  );
       
    80 
       
    81         void ConstructL();
       
    82 
       
    83         /**
       
    84         * Create and send request to server
       
    85         */
       
    86         void CreateAndSendRequest();
       
    87 
       
    88 
       
    89     private: // data
       
    90 
       
    91         /**
       
    92         * Client
       
    93         */
       
    94         RSensrvClient& iSensrvClient;
       
    95 
       
    96         /**
       
    97         * Condition listener
       
    98         * Not own.
       
    99         */
       
   100         MSensrvConditionHandlerObserver* iConditionObserver;
       
   101 
       
   102         /**
       
   103         * Channel info
       
   104         */
       
   105         TSensrvChannelInfo iChannelInfo;
       
   106 
       
   107         /**
       
   108         * Error count
       
   109         */
       
   110         TInt iErrorCount;
       
   111         
       
   112         /**
       
   113         * Listening parameters
       
   114         */
       
   115         TSensrvStartListeningParameters iListeningParameters;
       
   116 
       
   117         /**
       
   118         * Condition set id that was met is returned in this buffer.
       
   119         */
       
   120         TSensrvTIntPckgBuf iMetSetIdBuf;
       
   121 
       
   122         /**
       
   123         * Server writes the data value that was met here
       
   124         * Own.
       
   125         */
       
   126         HBufC8* iWriteBuffer;
       
   127 
       
   128         /**
       
   129         * Pointer to iWriteBuffer data
       
   130         * Own
       
   131         */
       
   132         TPtr8* iWriteBufferPtr;
       
   133         
       
   134         /**
       
   135         * Indicates logical listening status
       
   136         */
       
   137         TBool iListening;
       
   138     };
       
   139 
       
   140 
       
   141 
       
   142 #endif // CSENSRVCONDITIONHANDLER_H