remotecontrol/remotecontrolfw/client/intermediate/inc/bulkreceiver.h
changeset 51 20ac952a623c
equal deleted inserted replaced
48:22de2e391156 51:20ac952a623c
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 #ifndef BULKRECEIVER_H
       
    24 #define BULKRECEIVER_H
       
    25 
       
    26 #include <e32base.h>
       
    27 #include <remconinterfaceselector.h>
       
    28 #include <remcon/messagetype.h>
       
    29 #include <e32msgqueue.h>
       
    30 #include "utils.h"
       
    31 
       
    32 class RRemConBulk;
       
    33 
       
    34 
       
    35 /**
       
    36 Active Object for receiving messages from an RRemConBulk 
       
    37 */
       
    38 NONSHARABLE_CLASS(CBulkReceiver)
       
    39 	: public CActive
       
    40 	{
       
    41 public:
       
    42 	/**
       
    43 	Factory method.
       
    44 	@param aObserver Our observer.
       
    45 	@return Ownership of a new CBulkReceiver.
       
    46 	*/
       
    47 	static CBulkReceiver* NewL(CRemConInterfaceSelector& aObserver);
       
    48 	
       
    49 	~CBulkReceiver();
       
    50 	
       
    51 	/**
       
    52 	Indicates that the receiver needs to be initialised.
       
    53 	*/
       
    54 	TBool InitialisationRequired() const;
       
    55 
       
    56 	/**
       
    57 	Initialisation method.
       
    58 	@param aRemConBulk The session to receive on.
       
    59 	@param aMaxDataLength The size of the buffer to read operation-associated 
       
    60 	data into.
       
    61 	*/
       
    62 	void InitialiseL(RRemConBulk& aRemConBulk, TUint aMaxDataLength);
       
    63 	
       
    64 	/**
       
    65 	Called when the client wants to receive a message. On completion, 
       
    66 	notifies the observer and re-issues itself until the client destroys it. 
       
    67 	*/
       
    68 	void Receive();
       
    69 
       
    70 public:
       
    71 	/**
       
    72 	Called by the interface selector to connect the client session to the server.
       
    73 	*/
       
    74 	void WaitUntilConnectedL();
       
    75 
       
    76 private: // from CActive
       
    77 	void RunL();
       
    78 	void DoCancel();
       
    79 
       
    80 private:
       
    81 	CBulkReceiver(CRemConInterfaceSelector& aObserver);
       
    82 	void ConstructL();
       
    83 	
       
    84 	/**
       
    85 	Places the active object on the current active scheduler.
       
    86 	*/
       
    87 	void BindToCurrentThreadL();
       
    88 	void DoBindToCurrentThreadL();
       
    89 	
       
    90 	static TInt StaticConnect(TAny* aSelf);
       
    91 	TInt Connect();
       
    92 	
       
    93 private: // owned
       
    94 	// These are the members we pass to the inner client API to get messages 
       
    95 	// out of RemCon.
       
    96 	TUid			iInterfaceUid;
       
    97 	TUint			iOperationId;
       
    98 	RBuf8			iData;
       
    99 	
       
   100 	// These are the members related to co-ordinating the receiver which can
       
   101 	// be in a different thread.
       
   102 	TThreadId				iThreadId;		//<! The thread ID that the receiver is running in.
       
   103 	RSpecificThreadCallBack	iCancelCall;
       
   104 	RSpecificThreadCallBack	iConnectCall;
       
   105 	
       
   106 
       
   107 private: // unowned
       
   108 	RRemConBulk*				iRemConBulk;
       
   109 	CRemConInterfaceSelector&	iObserver;
       
   110 	};
       
   111 
       
   112 
       
   113 #endif // RECEIVER_H