libraries/iosrv/server/readwrite.cpp
changeset 83 706c7a69e448
parent 14 4ab8c027df23
equal deleted inserted replaced
82:a6fec624de6c 83:706c7a69e448
   600 void CIoReadObject::SetModeL(const RMsg& aMessage)
   600 void CIoReadObject::SetModeL(const RMsg& aMessage)
   601 	{
   601 	{
   602 	TInt mode(aMessage.Int0());
   602 	TInt mode(aMessage.Int0());
   603 	if ((mode >= RIoWriteHandle::EText) && (mode <= RIoWriteHandle::EBinary))
   603 	if ((mode >= RIoWriteHandle::EText) && (mode <= RIoWriteHandle::EBinary))
   604 		{
   604 		{
       
   605 		TInt err = KErrNone;
   605 		if (ReadEndPoint() && ReadEndPoint()->IorepIsForegroundL(*this))
   606 		if (ReadEndPoint() && ReadEndPoint()->IorepIsForegroundL(*this))
   606 			{
   607 			{
   607 			__ASSERT_RETURN(!MessagePending(iSetModeMessage), PanicClient(aMessage, EPanicSetModeAlreadyPending));
   608 			__ASSERT_RETURN(!MessagePending(iSetModeMessage), PanicClient(aMessage, EPanicSetModeAlreadyPending));
   608 			ReadEndPoint()->IorepSetConsoleModeL((RIoReadWriteHandle::TMode)mode, *this);
       
   609 			iSetModeMessage = aMessage;
   609 			iSetModeMessage = aMessage;
       
   610 			TRAP(err, ReadEndPoint()->IorepSetConsoleModeL((RIoReadWriteHandle::TMode)mode, *this));
       
   611 			if (err && MessagePending(iSetModeMessage))
       
   612 				{
       
   613 				if (err == KErrNotSupported)
       
   614 					{
       
   615 					// Ignore KErrNotSupported from the console to allow iMode to be set anyway, thereby getting at least the iosrv level behavior.
       
   616 					err = KErrNone;
       
   617 					}
       
   618 				Complete(iSetModeMessage, err);
       
   619 				}
   610 			}
   620 			}
   611 		else
   621 		else
   612 			{
   622 			{
   613 			Complete(aMessage, KErrNone);
   623 			Complete(aMessage, KErrNone);
   614 			}
   624 			}
   615 
   625 
   616 		iMode = static_cast<RIoWriteHandle::TMode>(mode);
   626 		if (err == KErrNone)
       
   627 			{
       
   628 			iMode = static_cast<RIoWriteHandle::TMode>(mode);
       
   629 			}
   617 		}
   630 		}
   618 	else
   631 	else
   619 		{
   632 		{
   620 		Complete(aMessage, KErrNotSupported);
   633 		Complete(aMessage, KErrNotSupported);
   621 		}
   634 		}
   652 TBool CIoReadObject::IorDataIsBuffered() const
   665 TBool CIoReadObject::IorDataIsBuffered() const
   653 	{
   666 	{
   654 	return (iBuf->Length() > 0);
   667 	return (iBuf->Length() > 0);
   655 	}
   668 	}
   656 
   669 
   657 TBool CIoReadObject::IorIsKeyCaptured(TUint aKeyCode, TUint aModifiers)
   670 TBool CIoReadObject::IorIsKeyCaptured(TUint aKeyCode, TUint aModifiers) const
   658 	{
   671 	{
   659 	if (iCaptureAllKeys)
   672 	if (iCaptureAllKeys)
   660 		{
   673 		{
   661 		return ETrue;
   674 		return ETrue;
   662 		}
   675 		}
   668 			{
   681 			{
   669 			return ETrue;
   682 			return ETrue;
   670 			}
   683 			}
   671 		}
   684 		}
   672 	return EFalse;
   685 	return EFalse;
       
   686 	}
       
   687 
       
   688 TBool CIoReadObject::IorAllKeysCaptured() const
       
   689 	{
       
   690 	return iCaptureAllKeys;
   673 	}
   691 	}
   674 
   692 
   675 void CIoReadObject::IorReadComplete(TInt aError)
   693 void CIoReadObject::IorReadComplete(TInt aError)
   676 	{
   694 	{
   677 	if ((aError == KErrNone) || (aError==KErrEof))
   695 	if ((aError == KErrNone) || (aError==KErrEof))