www.pudn.com > S60_Platform_Bluetooth_OBEX_Example.rar > objectexchangeclient.h
/* Copyright (c) 2004, Nokia. All rights reserved */ #ifndef __OBJECTEXCHANGECLIENT_H__ #define __OBJECTEXCHANGECLIENT_H__ // INCLUDES #include#include // CONSTANTS #include "ObjectExchangeProtocolConstants.h" // FORWARD DECLARATIONS class CObjectExchangeServiceSearcher; class MLog; // CLASS DECLARATIONS /** * CObjectExchangeClient * Handles the client interactions with the remote server, namely * the connection, sending of messages and disconnection. */ class CObjectExchangeClient : public CActive { public: // Constructors and destructor. /** * NewL * Construct a CObjectExchangeClient * @param aLog the log to send output to * @return a pointer to the created instance of * CObjectExchangeClient */ static CObjectExchangeClient* NewL( MLog& aLog ); /** * NewLC * Construct a CObjectExchangeClient * @param aLog the log to send output to * @return a pointer to the created instance * of CObjectExchangeClient */ static CObjectExchangeClient* NewLC( MLog& aLog ); /** * ~CObjectExchangeClient * Destroy the object and release all memory objects. * Close any open sockets */ virtual ~CObjectExchangeClient(); /** * ConnectL * Connect to an OBEX service on a remote machine */ void ConnectL(); /** * DisconnectL * Disconnect from the remote machine, by sending an * OBEX disconnect, and closing the transport on (and * regardless of) response from the server. */ void DisconnectL(); /** * SendObjectL * Send a file to a service on a remote machine */ void SendObjectL(TFileName& aName); /** * StopL * Send the OBEX aborts command to the remote machine */ void StopL(); /** * IsConnected * @return ETrue if the client is connected */ TBool IsConnected(); /** * IsBusy * @return ETrue if the client is performing some operation. */ TBool IsBusy(); protected: // from CActive /** * DoCancel * Cancel any outstanding requests */ void DoCancel(); /** * RunL * Respond to an event */ void RunL(); private: // Constructors /** * CMessageClient * @param aLog the log to send output to */ CObjectExchangeClient( MLog& aLog ); /** * ConstructL * Perform second phase construction of this object */ void ConstructL(); /** * ConnectToServerL * Connect to the server */ void ConnectToServerL(); private: // data /** * TState * The state of the active object, determines behaviour * within the RunL method. * EWaitingToGetDevice waiting for the user to select a device * EGettingDevice searching for a device * EGettingService searching for a service * EGettingConnection connecting to a service on a remote machine * EWaitingToSend sending a message to the remote machine * EDisconnecting disconnecting the server */ enum TState { EWaitingToGetDevice, EGettingDevice, EGettingService, EGettingConnection, EWaitingToSend, EDisconnecting }; /** * iState the state of the active object, * determines behaviour within the RunL method. */ TState iState; /** * iServiceSearcher searches for service this * client can connect to. * Owned by CObjectExchangeClient */ CObjectExchangeServiceSearcher* iServiceSearcher; /** * iClient manages the OBEX client connection * Owned by CObjectExchangeClient */ CObexClient* iClient; /** * iCurrObject the OBEX object to transfer * Owned by CObjectExchangeClient */ CObexBaseObject* iCurrObject; /** iLog the log to send output to */ MLog& iLog; }; #endif // __OBJECTEXCHANGECLIENT_H__ // End of File