📄 engine.h
字号:
//
// engine.h
//
// Copyright (C) 2001, Forum Nokia - The Developer Community
//
////////////////////////////////////////////////////////////////
#ifndef __ENGINE_H
#define __ENGINE_H
#include <es_sock.h>
#include <in_sock.h>
class CTcpUdpView;
class CMyTimer;
//Contains engine's saved preferences
class TPreferences
{
public:
TUint iProtocol;
TUint iRemotePort;
TUint iLocalPort;
TUint iCount;
TBool iTrace;
TUint iPacketSize;
TBuf<60> iRemoteAddr;
TBuf<60> iLocalAddr;
};
class CRunEngine : public CActive
{
public:
//constructor
CRunEngine();
//destructor
~CRunEngine();
//second phase constructor
void ConstructL(CTcpUdpView *aAppView);
TInt Start();
void Stop();
inline CTcpUdpView *AppView()
{return iAppView;};
inline TBool Running()
{return (iState != EIdle);};
static void DefaultPreferences(TPreferences &aPref);
void GetPreferences(TPreferences &aPref);
void SetPreferences(TPreferences &aPref);
protected:
// Active Object functions
void RunL();
void DoCancel();
private:
void ReceivePacket();
void SendPacket();
void CloseSockets();
public:
// Variables accessed from the options dialog
TUint iProtocol;
TUint iRemotePort;
TUint iLocalPort;
TBuf<60> iRemoteAddr;
TBuf<60> iLocalAddr;
TUint iCount;
TBool iTrace;
TUint iPacketSize;
TInetAddr iRecAddr;
private:
CTcpUdpView *iAppView;
RSocketServ iSocketServer;
RSocket iSocket;
TInetAddr iSendAddr;
enum TState {EIdle,EConnected,EReceiving,ESending,EClosing};
TState iState;
TInt iTotalBytesRcvd;
HBufC8 *iRecBuffer;
TPtr8 iRecData;
HBufC8 *iSendBuffer;
TPtr8 iSendData;
TSockXfrLength iNumRcvd;
CMyTimer *iMyTimer;
TUint iRecvPackets;
TUint iSentPackets;
};
class CMyTimer : public CTimer
{
public:
CMyTimer();
void ConstructL(CRunEngine *aEngine);
void RunL();
private:
CRunEngine *iEngine;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -