bluetoothengine/btnotif/btnotifsrv/src/btnotificationmanager.cpp
changeset 42 b72428996822
parent 31 a0ea99b6fa53
--- a/bluetoothengine/btnotif/btnotifsrv/src/btnotificationmanager.cpp	Fri May 28 17:03:06 2010 +0300
+++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotificationmanager.cpp	Mon Jul 12 18:51:05 2010 +0300
@@ -63,8 +63,10 @@
 //
 CBTNotificationManager::~CBTNotificationManager()
     {
+    BOstraceFunctionEntry0( DUMMY_DEVLIST );
     iNotificationQ.ResetAndDestroy();
     iNotificationQ.Close();
+    BOstraceFunctionExit0( DUMMY_DEVLIST );
     }
 
 
@@ -74,6 +76,7 @@
 //
 CBluetoothNotification* CBTNotificationManager::GetNotification()
     {
+    BOstraceFunctionEntry0( DUMMY_DEVLIST );
     CBluetoothNotification* notification = NULL;
     TRAP_IGNORE( notification = CBluetoothNotification::NewL( this ) );
     if( notification )
@@ -86,6 +89,7 @@
             notification = NULL;
             }
         }
+    BOstraceFunctionExit0( DUMMY_DEVLIST );
     return notification;
     }
 
@@ -96,17 +100,14 @@
 //
 void CBTNotificationManager::ReleaseNotification( CBluetoothNotification* aNotification )
     {
+    BOstraceFunctionEntry0( DUMMY_DEVLIST );
     __ASSERT_ALWAYS( aNotification, PanicServer( EBTNotifPanicBadArgument ) );
     TInt pos = iNotificationQ.Find( aNotification );
     __ASSERT_ALWAYS( pos > KErrNotFound, PanicServer( EBTNotifPanicMissing ) );
+    delete iNotificationQ[pos];
     iNotificationQ.Remove( pos );
-    // Just delete the notification.
-    delete aNotification;    
-    if(!iNotificationQ.Count() )
-        {
-        // the queue is empty, reset it.
-        iNotificationQ.Compress();
-        }
+    iNotificationQ.Compress();
+    BOstraceFunctionExit0( DUMMY_DEVLIST );
     }
 
 
@@ -118,10 +119,12 @@
         CBluetoothNotification* aNotification,
         TNotificationPriority aPriority )
     {
+    BOstraceFunctionEntry0( DUMMY_DEVLIST );
     (void) aPriority;
     TInt pos = iNotificationQ.Find( aNotification );
     __ASSERT_ALWAYS( pos > KErrNotFound, PanicServer( EBTNotifPanicMissing ) );
-    if( /*aPriority == EPriorityHigh &&*/ pos != 0 )
+    // Always move the newly added notification on top
+    if(pos != 0 )
         {
         CBluetoothNotification* notification = NULL;
         notification = iNotificationQ[pos];
@@ -129,6 +132,7 @@
         iNotificationQ.InsertL(notification,0);
         }
     ProcessNotificationQueueL();
+    BOstraceFunctionExit0( DUMMY_DEVLIST );
     }
 
 // ---------------------------------------------------------------------------
@@ -137,6 +141,7 @@
 //
 void CBTNotificationManager::ProcessNotificationQueueL()
     {
+    BOstraceFunctionEntry0( DUMMY_DEVLIST );
     if( iNotificationQ.Count() )
         {
         iNotificationQ[0]->ShowL();
@@ -146,5 +151,6 @@
         // No outstanding notifications
         iNotificationQ.Compress(); // the queue is empty, reset it.
         }
+    BOstraceFunctionExit0( DUMMY_DEVLIST );
     }