📄 conn.h
字号:
/* Copyright (C) 2006 Lucas Gomez All Rights Reserved.
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#ifndef __CONN_H__
#define __CONN_H__
// INCLUDES
#include <e32base.h>
#include <e32std.h>
#include <es_sock.h>
#include <w32std.h>
#include <S32BUF.H>
#include <CStack.h>
#include "Connection.h"
#include "VncInStream.h"
#include "VncOutStream.h"
// ENUMERATIONS
enum TSockState
{
ESockIdle,
ESockConnecting,
ESockReading,
ESockWriting
};
// CONSTANTES
const TInt KServerNameLength=256;
// CLASS FORWARD
class CVncViewerAppUi;
class CDesktopWindowContainer;
// CLASS DECLARATION
/**
* CConn application class.
*/
class CConn : public CActive, public CConnection, public MStreamBuf
{
public: // Constructors and destructor
/**
* NewL.
* Two-phased constructor.
* Construct a CConn for the AVKON application aApp
* using two phase construction, and return a pointer
* to the created object.
* @return A pointer to the created instance of CConn.
*/
static CConn* NewL(CVncViewerAppUi* aCallback);
/**
* NewLC.
* Two-phased constructor.
* Construct a CConn for the AVKON application aApp
* using two phase construction, and return a pointer
* to the created object.
* @return A pointer to the created instance of CConn.
*/
static CConn* NewLC(CVncViewerAppUi* aCallback);
/**
* ~CConn
* Virtual Destructor.
*/
virtual ~CConn();
// The usual active object stuff - every Active Object _must_ implement RunL, DoCancel,
// and a request method of some description
public:
void RunL();
void DoCancel();
private: // Constructors
/**
* ConstructL
* 2nd phase constructor.
*/
void ConstructL();
/**
* CConn.
* C++ default constructor.
*/
CConn(CVncViewerAppUi* aCallback);
public: // class methods
void Init(TInetAddr aHostName,TInt aPort);
TBool GetUserPasswd(TDes& aUser,TDes& aPasswd);
MSecurity* GetSecurity(TSecType aSecType);
void ServerInit();
void SetDesktopSize(TInt aW,TInt aH);
void FramebufferUpdateStart();
void FramebufferUpdateEnd();
void SetColourMapEntries(TInt aFirstColour,TInt aNColours,RArray<TInt>& aRgbs);
void Bell();
void ServerCutText(TDes& aString);
void BeginRect(TInt aX,TInt aY,TInt aW,TInt aH,TEncodings aEncoding);
void EndRect(TInt aX,TInt aY,TInt aW,TInt aH,TEncodings aEncoding);
void FillRect(TInt aX,TInt aY,TInt aW,TInt aH,TInt aP);
void ImageRect(TInt aX,TInt aY,TInt aW,TInt aH,TDes8& aP,TInt aOffset);
void CopyRect(TInt aX,TInt aY,TInt aW,TInt aH,TInt aSx,TInt aSy);
void SetCursor(TInt aHotspotX,TInt aHotspotY,TInt aW,TInt aH,RBuf8& aData,RBuf8& aMask);
void RecreateViewport();
void ReconfigureViewport();
void AutoSelectFormatAndEncoding();
void RequestNewUpdate();
void Close();
void Refresh();
void WriteClientCutText(TDesC& aStr);
void WriteKeyEvent(TInt aKeysym,TBool aDown);
void WritePointerEvent(TPointerEvent aEv);
void WriteModifiers(TInt aM);
void CheckEncodings();
void ConnError(const TDesC8& aError);
// FROM MStreamBuf
void DoRelease();
void DoSynchL();
TInt DoReadL(TAny* aPtr,TInt aMaxLength);
TInt DoReadL(TDes8& aDes,TInt aMaxLength,TRequestStatus& aStatus);
TStreamTransfer DoReadL(MStreamInput& anInput,TStreamTransfer aTransfer);
void DoWriteL(const TAny* aPtr,TInt aLength);
TInt DoWriteL(const TDesC8& aDes,TInt aMaxLength,TRequestStatus& aStatus);
TStreamTransfer DoWriteL(MStreamOutput& anOutput,TStreamTransfer aTransfer);
TStreamPos DoSeekL(TMark aMark,TStreamLocation aLocation,TInt anOffset);
HBufC* SetConnectionInfo(TDesC& aInfoFormat);
TInt GetModifiers();
inline CArrayFix<TInt>* GetModifiersArray() {return iModifiersArray;}
inline TBool GetAutoSelect() {return iAutoSelect;}
inline TEncodings GetEncoding() {return iCurrentEncoding;}
inline TInt GetColourLevel() {return iColourLevel;}
inline TBool GetViewOnly() {return iViewOnly;}
inline TBool GetAcceptClipboard() {return iAcceptClipboard;}
inline TBool GetSendClipboard() {return iSendClipboard;}
inline TBool GetShared() {return iShared;}
inline TBool GetUseLocalCursor() {return iCP->GetSupportsLocalCursor();}
inline TBool GetFastCopyRect() {return iFastCopyRect;}
inline void SetAutoSelect(TBool aAutoSelect) {iAutoSelect=aAutoSelect;}
inline void SetEncoding(TEncodings aEncoding) {iCurrentEncoding=aEncoding;}
inline void SetColourLevel(TInt aColourLevel) {iColourLevel=aColourLevel;}
inline void SetViewOnly(TBool aViewOnly) {iViewOnly=aViewOnly;}
inline void SetAcceptClipboard(TBool aAcceptClipboard) {iAcceptClipboard=aAcceptClipboard;}
inline void SetSendClipboard(TBool aSendClipboard) {iSendClipboard=aSendClipboard;}
inline void SetShared(TBool aShared) {iShared=aShared;}
inline void SetUseLocalCursor(TBool aUseLocalCursor) {iCP->SetSupportsLocalCursor(aUseLocalCursor);}
inline void SetFastCopyRect(TBool aFastCopyRect) {iFastCopyRect=aFastCopyRect;}
public: // member variables
CVncViewerAppUi* iCallback;
private:
RSocket iSock;
RSocketServ iSockServ;
TSockState iSockState;
TInetAddr iInetAddr;
VncInStream* iVIS;
VncOutStream* iVOS;
CPixelFormat* iServerPF;
CPixelFormat* iFullColourPF;
TBool iShuttingDown;
TEncodings iCurrentEncoding, iLastUsedEncoding;
TBool iFullColour;
TBool iAutoSelect;
TBool iShared;
TBool iFormatChange;
TBool iEncodingChange;
TBool iSameMachine;
TInt iColourLevel;
TBool iViewOnly;
TBool iAcceptClipboard;
TBool iSendClipboard;
TBool iFastCopyRect;
TInt iButtonMask;
TInt iPressedModifiers;
CArrayFixFlat<TInt>* iModifiersArray;
HBufC8* iSendBuf;
TPtr8 iSendBufPtr;
TSockXfrLength iSendLength;
HBufC8* iRecvBuf;
TPtr8 iRecvBufPtr;
TSockXfrLength iRecvLength;
CStack<CActiveSchedulerWait,EFalse> *iMutex;
};
#endif // __CONN_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -