telephonyprotocols/rawipnif/src/Receiver.cpp
branchRCL_3
changeset 7 fe8b59ab9fa0
parent 0 3553901f7fa8
child 8 3f227a47ad75
equal deleted inserted replaced
6:fc69e1e37771 7:fe8b59ab9fa0
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    79  *  packet in its buffer.
    79  *  packet in its buffer.
    80  */
    80  */
    81 	{
    81 	{
    82 	_LOG_L1C2(_L8("CReceiver::RunL [iStatus=%d]"), iStatus.Int());
    82 	_LOG_L1C2(_L8("CReceiver::RunL [iStatus=%d]"), iStatus.Int());
    83 
    83 
    84 	if (iStatus!=KErrNone)
    84 	if (iStatus != KErrNone)
    85 		{
    85 		{
    86 		if(iStatus == KErrNoMemory)
    86 		if (iStatus == KErrNoMemory)
    87 			{
    87 			{
    88 			_LOG_L2C1(
    88 			_LOG_L2C1(
    89 				_L8("WARNING! CReceiver: Read failed with KErrNoMemory"));
    89 				_L8("WARNING! CReceiver: Read failed with KErrNoMemory"));
    90 			// Read operation failed!! Nif will re-issue the read request.
    90 			// Read operation failed!! Nif will re-issue the read request.
    91 			StartListening();
    91 		    (iObserver.Bca())->Read(iStatus, iData);
       
    92 
       
    93 		    SetActive();
    92 			}
    94 			}
    93 		else 
    95 		else 
    94 			{
    96 			{
    95 			_LOG_L2C1(_L8("WARNING! CReceiver: Read failed"));
    97 			_LOG_L2C1(_L8("WARNING! CReceiver: Read failed"));
    96 			iObserver.Stop(iStatus.Int());
    98 			iObserver.Stop(iStatus.Int());
    97 			}
    99 			}
    98 		return;
   100 		return;
    99 		}
   101 		}
   100 
   102 	else
   101 	_LOG_L1C1(_L8("CReceiver: Data Packet Received"));
   103 	    {
   102 
   104         _LOG_L1C1(_L8("CReceiver: Data Packet Received"));
   103     iRMBufPacket.CreateL(iData);
   105     
   104     iRMBufPacket.Pack();
   106         iRMBufPacket.CreateL(iData);
   105 
   107         
   106     // Immediately execute new read request.
   108         // Immediately execute new read request.
   107     StartListening();
   109         (iObserver.Bca())->Read(iStatus, iData);
   108 
   110     
       
   111         SetActive();
       
   112         
       
   113         iRMBufPacket.Pack();
       
   114     
   109 #ifdef RAWIP_HEADER_APPENDED_TO_PACKETS
   115 #ifdef RAWIP_HEADER_APPENDED_TO_PACKETS
   110     TUint16 protocolCode = iObserver.RemoveHeader(iRMBufPacket);
   116         TUint16 protocolCode = iObserver.RemoveHeader(iRMBufPacket);
   111 #else
   117 #else
   112     TUint16 protocolCode = 0;
   118         TUint16 protocolCode = 0;
   113 #endif // RAWIP_HEADER_APPENDED_TO_PACKETS
   119 #endif // RAWIP_HEADER_APPENDED_TO_PACKETS
   114 
   120     
   115     // Process the packet
   121         // Process the packet
   116     iObserver.GetObserver().Process(iRMBufPacket, protocolCode);
   122         iObserver.GetObserver().Process(iRMBufPacket, protocolCode);
   117     iRMBufPacket.Free();
   123         iRMBufPacket.Free();
       
   124 	    }
   118 	}
   125 	}
   119 
   126 
   120 void CReceiver::DoCancel()
   127 void CReceiver::DoCancel()
   121 /**
   128 /**
   122  *	Cancel active request
   129  *	Cancel active request