mpx/commonframework/common/src/mpxmessagequeue.cpp
changeset 20 b1fb57be53fe
parent 0 a2952bb97e68
equal deleted inserted replaced
4:d45095c2f4f3 20:b1fb57be53fe
   300     iMsgRequest.Complete(ret);
   300     iMsgRequest.Complete(ret);
   301     MPX_DEBUG5("<--CMPXMessageQueue::Send() 0x%08x, sentMsgHandle 0x%08x, sentError %d,  sentRet %d",
   301     MPX_DEBUG5("<--CMPXMessageQueue::Send() 0x%08x, sentMsgHandle 0x%08x, sentError %d,  sentRet %d",
   302                this, data, err, ret);
   302                this, data, err, ret);
   303     }
   303     }
   304 
   304 
       
   305 // ----------------------------------------------------------------------------
       
   306 // Adds a message into the top of the queue and sends the message if slot is available
       
   307 // ----------------------------------------------------------------------------
       
   308 //
       
   309 EXPORT_C TInt CMPXMessageQueue::AddFirst(const CMPXMessage* aMessage, TInt aError)
       
   310     {
       
   311     // aMessage should not be NULL and aError is KErrNone
       
   312     MPX_ASSERT(aMessage || aError);
       
   313     MPX_FUNC_EX("CMPXMessageQueue::AddFirst()");
       
   314     CMPXMessageItem* item(NULL);
       
   315     TRAPD(err, item = CMPXMessageItem::NewL(aMessage, aError));
       
   316     if (KErrNone==err)
       
   317         {
       
   318         iMsgs.AddFirst(*item);
       
   319 #ifdef _DEBUG
       
   320         MPX_DEBUG3("CMPXMessageQueue::AddFirst 0x%08x, items %d", this, ++iCount);
       
   321 #endif
       
   322         }//else failed to create message item.
       
   323     else
       
   324         {
       
   325         MPX_DEBUG2("CMPXMessageQueue::AddFirst Failed to create message item %d", err);
       
   326         }
       
   327     if (KErrNone!=err && KErrNone==iFailure)
       
   328         { // Set the failure code
       
   329         iFailure = err;
       
   330         }
       
   331     if (!iMsgRequest.IsNull())
       
   332         { // outstanding request
       
   333         Send();
       
   334         } // else client has not finished current message yet
       
   335     return err;
       
   336     }
   305 // End of file
   337 // End of file