📄 objectexchangeserver.h
字号:
/* Copyright (c) 2004, Nokia. All rights reserved */
#ifndef __BTOBJECTEXCHANGE_SERVER__
#define __BTOBJECTEXCHANGE_SERVER__
// INCLUDES
#include <e32base.h>
#include <obex.h>
#include <btsdp.h>
#include <btmanclient.h>
#include "ObjectExchangeProtocolConstants.h"
// CONSTANTS
_LIT(KPutRequestIndication,"PutRequestIndication");
_LIT(KCopyFileError,"CopyFile error");
_LIT(KCurrentWorkingDirectory,"CWD:");
// FORWARD DECLARATIONS
class CObjectExchangeServiceAdvertiser;
class MLog;
#ifdef __SERIES60_3X__
_LIT(KTempFile,"c:\\data\\temp.dat");
#else
_LIT(KTempFile,"c:\\system\\data\\temp.dat");
#endif
// CLASS DECLARATIONS
/**
* CObjectExchangeServer
* Handles the server interactions with the remote client, namely
* the connection, receiving of messages and disconnection.
*/
class CObjectExchangeServer : public CBase, public MObexServerNotify
{
public: // Constructors and destructor.
/**
* NewL()
* Construct a CObjectExchangeServer
* @param aLog the log to send output to
* @return a pointer to the created instance of CObjectExchangeServer
*/
static CObjectExchangeServer* NewL( MLog& aLog );
/**
* NewLC()
* Construct a CObjectExchangeServer
* @param aLog the log to send output to
* @return a pointer to the created instance of CObjectExchangeServer
*/
static CObjectExchangeServer* NewLC( MLog& aLog );
/**
* ~CObjectExchangeServer()
* Destroy the object and release all memory objects
*/
virtual ~CObjectExchangeServer();
/**
* StartL()
* Starts the server
*/
void StartL();
/**
* DisconnectL()
* Disconnects the server
*/
void DisconnectL();
/**
* IsConnected()
* @return ETrue if the server is connected.
*/
TBool IsConnected();
private: // Functions from base classes
/**
* CObjectExchangeServer
* Constructs this object
* @param aLog the log to send output to
*/
CObjectExchangeServer( MLog& aLog );
/**
* ConstructL
* 2nd phase construction of this object
*/
void ConstructL();
/**
* UpdateAvailabilityL
* Update the service availability field of the service record
* @param aIsAvailable ETrue is the service is not busy.
*/
void UpdateAvailabilityL( TBool aIsAvailable );
/**
* InitialiseServerL
* Initialises the server
*/
void InitialiseServerL();
/**
* SetSecurityWithChannelL
* Sets the security on the channel port
* And returns the channel available.
* @param aAuthentication is authentication used
* @param aEncryption is encryption used
* @param aAuthorisation is authorisation used
* @param aDenied is denied used
* @return an available channel
*/
TInt SetSecurityWithChannelL ( TBool aAuthentication,
TBool aEncryption,
TBool aAuthorisation,
TBool aDenied );
private: // from MObexServerNotify (these methods are defined
//as private in MObexServerNotify)
/**
* A non-leaving helper for logging
*/
void Log(const TDesC& aText, TInt KErrCode=KErrNone);
/**
* ErrorIndication
* Receive error indication
* @param aError the error code
*/
void ErrorIndication( TInt aError );
/**
* TransportUpIndication
* Called when the underlying socket transport connection is made from
* a remote client to the server
*/
void TransportUpIndication();
/**
* TransportDownIndication
* Transport connection is dropped
*/
void TransportDownIndication();
/**
* ObexConnectIndication
* Invoked when an OBEX connection is made from a remote client
* @param aRemoteInfo connection information supplied by
* the remote machine
* @param aInfo holds further information about the
* requested connection
* @return system wide error code
*/
TInt ObexConnectIndication( const TObexConnectInfo& aRemoteInfo,
const TDesC8& aInfo );
/**
* ObexDisconnectIndication
* OBEX server has been disconnected
* @param aInfo contains information about the disconnection
*/
void ObexDisconnectIndication( const TDesC8& aInfo );
/**
* PutRequestIndication
* @return the CObexBufObject in which to store
* the transferred object
*/
CObexBufObject* PutRequestIndication();
/**
* PutPacketIndication
* @return system wide error code
*/
TInt PutPacketIndication();
/**
* PutCompleteIndication
* @return system wide error code
*/
TInt PutCompleteIndication();
/**
* GetRequestIndication
* Called when a full get request has been received from the client
* @param aRequestedObject holds details about the requested object
* @return the CObexBufObject in which return to the client
*/
CObexBufObject* GetRequestIndication( CObexBaseObject*
aRequestedObject );
/**
* GetPacketIndication
* @return system wide error code
*/
TInt GetPacketIndication();
/**
* GetCompleteIndication
* @return system wide error code
*/
TInt GetCompleteIndication();
/**
* SetPathIndication
* @param aPathInfo the information received in a SETPATH command
* @return system wide error code
*/
TInt SetPathIndication( const CObex::TSetPathInfo& aPathInfo,
const TDesC8& aInfo );
/**
* AbortIndication
* Server has been aborted
*/
void AbortIndication();
private: // data
/** iLog the log to send output to */
MLog& iLog;
/**
* iObexServer manages the OBEX client connection
* Owned by CObjectExchangeServer
*/
CObexServer* iObexServer;
/**
* iObexBufData the raw data that has been transferred
* Owned by CObjectExchangeServer
*/
CBufFlat* iObexBufData;
// Destination where the received file will be stored
HBufC* iTempFile;
/**
* iCurrObject the OBEX object that has been transferred
* Owned by CObjectExchangeServer
*/
CObexBufObject* iObexBufObject;
/**
* iAdvertiser used to advertise this service
* Owned by CObjectExchangeServer
*/
CObjectExchangeServiceAdvertiser* iAdvertiser;
/**
* File Server session
*/
RFs iFs;
};
#endif // __BTOBJECTEXCHANGE_SERVER__
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -