libraries/iosrv/server/console.h
changeset 100 706c7a69e448
parent 0 7f656887cf89
equal deleted inserted replaced
99:a6fec624de6c 100:706c7a69e448
    23 class RIoConsoleProxy : public RConsoleProxy
    23 class RIoConsoleProxy : public RConsoleProxy
    24 	{
    24 	{
    25 public:
    25 public:
    26 	enum TOpCode
    26 	enum TOpCode
    27 		{
    27 		{
    28 		ESetConsoleSizeDetect = RConsoleProxy::EOpCodeCustomBase,
    28 		EUnusedOpCode = RConsoleProxy::EOpCodeCustomBase,
    29 		ESetLazyConstruct,
    29 		ESetLazyConstruct,
    30 		ESetConsoleMode,
    30 		ESetConsoleMode,
    31 		ESetUnderlyingConsole,
    31 		ESetUnderlyingConsole,
    32 		EOpenExistingConsole,
    32 		EOpenExistingConsole,
    33 		EWriteStdErr,
    33 		EWriteStdErr,
    34 		};
    34 		ENotifySizeChange,
    35 public:
    35 		ECancelNotifySizeChange,
    36 	TInt SetConsoleSizeDetect();
    36 		};
       
    37 public:
    37 	TInt SetLazyConstruct();
    38 	TInt SetLazyConstruct();
    38 	void SetConsoleMode(RIoReadWriteHandle::TMode aMode, TRequestStatus& aStatus);
    39 	void SetConsoleMode(RIoReadWriteHandle::TMode aMode, TRequestStatus& aStatus);
    39 	void SetUnderlyingConsole(const RIoConsoleProxy& aUnderlyingSession, TRequestStatus& aStatus);
    40 	void SetUnderlyingConsole(const RIoConsoleProxy& aUnderlyingSession, TRequestStatus& aStatus);
    40 	TInt OpenExisting();
    41 	TInt OpenExisting();
    41 	void WriteStdErr(const TDesC& aDescriptor, TRequestStatus& aStatus);
    42 	void WriteStdErr(const TDesC& aDescriptor, TRequestStatus& aStatus);
       
    43 	void NotifySizeChanged(TRequestStatus& aStatus);
       
    44 	void CancelNotifySizeChanged();
    42 	};
    45 	};
    43 	
    46 	
    44 class CIoConsole : public CIoEndPoint
    47 class CIoConsole : public CIoEndPoint
    45 	{
    48 	{
    46 public:
    49 public:
   286 		virtual void DoCancel();
   289 		virtual void DoCancel();
   287 	private:
   290 	private:
   288 		CIoConsole& iConsole;
   291 		CIoConsole& iConsole;
   289 		TConsoleRequest* iCurrentRequest;
   292 		TConsoleRequest* iCurrentRequest;
   290 		};
   293 		};
       
   294 
       
   295 	class CConsoleSizeChangedNotifier : public CActive
       
   296 		{
       
   297 	public:
       
   298 		CConsoleSizeChangedNotifier(CIoConsole& aConsole);
       
   299 		~CConsoleSizeChangedNotifier();
       
   300 	private:
       
   301 		void RunL();
       
   302 		void DoCancel();
       
   303 
       
   304 	private:
       
   305 		CIoConsole& iConsole;
       
   306 		};
       
   307 	friend class CConsoleSizeChangedNotifier;
   291 		
   308 		
   292 	class CServerDeathWatcher : public CActive
   309 	class CServerDeathWatcher : public CActive
   293 		{
   310 		{
   294 	public:
   311 	public:
   295 		CServerDeathWatcher(RServer2& aServer, RThread& aThread);
   312 		CServerDeathWatcher(RServer2& aServer, RThread& aThread);
   318 	mutable RArray<TConsoleRequest*> iRequestQueue;
   335 	mutable RArray<TConsoleRequest*> iRequestQueue;
   319 	CConsoleRequest* iRequestAo;
   336 	CConsoleRequest* iRequestAo;
   320 	RServer2 iThreadServer;
   337 	RServer2 iThreadServer;
   321 	RThread iServerThread;
   338 	RThread iServerThread;
   322 	CServerDeathWatcher* iThreadWatcher;
   339 	CServerDeathWatcher* iThreadWatcher;
       
   340 	CConsoleSizeChangedNotifier* iConsoleSizeChangedNotifier;
   323 	};
   341 	};
   324 	
   342 	
   325 class CIoConsoleProxyServer : public CConsoleProxyServer
   343 class CIoConsoleProxyServer : public CConsoleProxyServer
   326 	{
   344 	{
   327 public:
   345 public:
   336 	RLibrary iConsoleLibrary;
   354 	RLibrary iConsoleLibrary;
   337 	MProxiedConsole* iTheConsole;
   355 	MProxiedConsole* iTheConsole;
   338 	};
   356 	};
   339 
   357 
   340 CConsoleProxyServer* CIoConsoleProxyServerNewL(TAny* aParams);
   358 CConsoleProxyServer* CIoConsoleProxyServerNewL(TAny* aParams);
       
   359 
       
   360 class CSizeChangeMessageCompleter : public CActive
       
   361 	{
       
   362 public:
       
   363 	CSizeChangeMessageCompleter();
       
   364 	~CSizeChangeMessageCompleter();
       
   365 	void SetConsole(CConsoleBase* aConsole);
       
   366 	void NotifySizeChange(RMessagePtr2& aMessage);
       
   367 	void CancelNotify();
       
   368 
       
   369 protected:
       
   370 	void RunL();
       
   371 	void DoCancel();
       
   372 
       
   373 private:
       
   374 	RMessagePtr2 iMessage;
       
   375 	CConsoleBase* iActualConsole;
       
   376 	};
   341 
   377 
   342 class CIoConsoleProxySession : public CConsoleProxySession
   378 class CIoConsoleProxySession : public CConsoleProxySession
   343 	{
   379 	{
   344 public:
   380 public:
   345 	CIoConsoleProxySession(TConsoleCreateFunction aConsoleCreate);
   381 	CIoConsoleProxySession(TConsoleCreateFunction aConsoleCreate);
   350 	virtual void ConsoleCreatedL(MProxiedConsole* aConsole);
   386 	virtual void ConsoleCreatedL(MProxiedConsole* aConsole);
   351 private:
   387 private:
   352 	enum TFlag
   388 	enum TFlag
   353 		{
   389 		{
   354 		ELazy				= 0x01,
   390 		ELazy				= 0x01,
   355 		EAutoDetectSize		= 0x02,
   391 		EHaveDetectedSize   = 0x02,
   356 		ESupportsStdErr		= 0x04,
   392 		ESupportsStdErr		= 0x04,
   357 		};
   393 		};
   358 private:
   394 private:
   359 	CIoConsoleProxyServer* Server() { return (CIoConsoleProxyServer*)CConsoleProxySession::Server();}
   395 	CIoConsoleProxyServer* Server() { return (CIoConsoleProxyServer*)CConsoleProxySession::Server();}
   360 	void DetectSizeL(const RMessage2& aMessage);
   396 	void DetectSizeL(const RMessage2& aMessage);
   366 	void SetFlag(TFlag aFlag, TBool aSet);
   402 	void SetFlag(TFlag aFlag, TBool aSet);
   367 private:
   403 private:
   368 	CConsoleProxy* iUnderlyingConsole;
   404 	CConsoleProxy* iUnderlyingConsole;
   369 	TUint iFlags;
   405 	TUint iFlags;
   370 	TSize iDetectedSize;
   406 	TSize iDetectedSize;
       
   407 	CSizeChangeMessageCompleter* iSizeChangedMessageCompleter;
   371 	};
   408 	};
   372 	
   409 	
   373 class CWriteOnlyConsoleProxy : public CConsoleProxy
   410 class CWriteOnlyConsoleProxy : public CConsoleProxy
   374 	{
   411 	{
   375 public:
   412 public:
   384 	};
   421 	};
   385 	
   422 	
   386 class CLazyConsole : public CConsoleBase
   423 class CLazyConsole : public CConsoleBase
   387 	{
   424 	{
   388 public:
   425 public:
   389 	CLazyConsole(TConsoleCreateFunction aConsoleCreate, TBool aAutoDetectSize);
   426 	CLazyConsole(TConsoleCreateFunction aConsoleCreate);
   390 	~CLazyConsole();
   427 	~CLazyConsole();
   391 public: // from CConsoleBase
   428 public: // from CConsoleBase
   392 	virtual TInt Create(const TDesC &aTitle,TSize aSize);
   429 	virtual TInt Create(const TDesC &aTitle,TSize aSize);
   393 	virtual void Read(TRequestStatus &aStatus);
   430 	virtual void Read(TRequestStatus &aStatus);
   394 	virtual void ReadCancel();
   431 	virtual void ReadCancel();
   406 	virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
   443 	virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
   407 private:
   444 private:
   408 	TInt CheckCreated() const;
   445 	TInt CheckCreated() const;
   409 private:
   446 private:
   410 	TConsoleCreateFunction iConsoleCreate;
   447 	TConsoleCreateFunction iConsoleCreate;
   411 	TBool iSizeAutoDetect;
       
   412 	RBuf iTitle;
   448 	RBuf iTitle;
   413 	TSize iSize;
   449 	TSize iSize;
       
   450 	mutable TBool iHaveDetectedSize;
   414 	mutable TSize iDetectedSize;
   451 	mutable TSize iDetectedSize;
   415 	mutable TInt iCreateError;
   452 	mutable TInt iCreateError;
   416 	mutable CConsoleBase* iConsole;
   453 	mutable CConsoleBase* iConsole;
       
   454 	mutable TRequestStatus* iStatusForNotifySizeRequest; // Only needed if a notify request comes in before we've instantiated
   417 	};
   455 	};
   418 
   456 
   419 #endif //__CONSOLE_H__
   457 #endif //__CONSOLE_H__