⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 objectexchangeclient.h

📁 This C++ code example provides a method for transferring objects or chunks of data from one device
💻 H
字号:
/* Copyright (c) 2004, Nokia. All rights reserved */


#ifndef __OBJECTEXCHANGECLIENT_H__
#define __OBJECTEXCHANGECLIENT_H__

// INCLUDES
#include <e32base.h>
#include <obex.h>

// 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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -