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

📄 objectexchangeclient.h

📁 蓝牙传输文件, symbian3.0 系统下. 2FP没有试过
💻 H
字号:
/* Copyright (c) 2004, Nokia. All rights reserved */


#ifndef __OBJECTEXCHANGECLIENT_H__
#define __OBJECTEXCHANGECLIENT_H__

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

// CONSTANTS
_LIT(KCanceled,"Canceled");

// FORWARD DECLARATIONS
class CObjectExchangeServiceSearcher;
class CBlueShareAppView;
// 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
         * @return a pointer to the created instance of
         * CObjectExchangeClient
         */
        static CObjectExchangeClient* NewL();

        /**
         * NewLC
         * Construct a CObjectExchangeClient
         * @return a pointer to the created instance
         * of CObjectExchangeClient
         */
        static CObjectExchangeClient* NewLC();

        /**
         * ~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 aView the log to send output to
         */
        //CObjectExchangeClient(CBlueShareAppView& aView);
        CObjectExchangeClient();

        /**
         * ConstructL
         * Perform second phase construction of this object
         */
        void ConstructL();

        /**
         * ConnectToServerL
         * Connect to the server
         */
        void ConnectToServerL();

        /**
         * AskFileL()
         * Asks for a file name
         * @param aFileName the given file name
         * @return true if user gave a file name, false if canceled
         */
        //TBool AskFileL(TFileName& aFileName);

        /**
         * ShowMessageL()
         * Shows a message in a dialog
         * @param aMsg the message to show
         */
        void ShowMessageL( const TDesC& aMsg );


    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;

};

#endif // __OBJECTEXCHANGECLIENT_H__

// End of File

⌨️ 快捷键说明

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