bluetoothengine/btnotif/btnotifsrv/src/btnotifgeninfonotifier.cpp
changeset 70 f5508c13dfe0
parent 57 5ebadcda06cb
--- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifgeninfonotifier.cpp	Wed Oct 13 13:15:31 2010 +0300
+++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifgeninfonotifier.cpp	Tue Oct 19 15:09:34 2010 +0300
@@ -34,7 +34,7 @@
 // ---------------------------------------------------------------------------
 //
 CBTNotifGenInfoNotifier::CBTNotifGenInfoNotifier( CBTNotifServer* aServer )
-:   iServer( aServer )
+:   iServer( aServer ),iNotification(NULL),iEnterSAPNotification(NULL)
     {
     }
 
@@ -148,6 +148,17 @@
 void CBTNotifGenInfoNotifier::ShowNotificationL(const RMessage2& aMessage )
     {
     BOstraceFunctionEntry0( DUMMY_DEVLIST );
+    // read the message parameters
+    RBuf8 params;
+    params.CreateL( aMessage.GetDesLengthL( EBTNotifSrvParamSlot ) );
+    aMessage.ReadL( EBTNotifSrvParamSlot, params );
+    TBTGenericInfoNotifierParams notifparams;
+    TPckgC<TBTGenericInfoNotifierParams> paramsPckg( notifparams );
+    paramsPckg.Set( params );
+    TInt notifType = paramsPckg().iMessageType;
+
+    TInt err = KErrNone;
+
     if(iNotification)
         {
         iNotification->RemoveObserver();
@@ -156,16 +167,6 @@
     iNotification = iServer->NotificationManager()->GetNotification();
     User::LeaveIfNull( iNotification ); // For OOM exception, leaves with KErrNoMemory
     iNotification->SetObserver( this );
-    iNotification->SetNotificationType( TBluetoothDialogParams::ENote, EGenericInfo );
-    
-    // read the message parameters
-    RBuf8 params;
-    params.CreateL( aMessage.GetDesLengthL( EBTNotifSrvParamSlot ) );
-    aMessage.ReadL( EBTNotifSrvParamSlot, params );
-    TBTGenericInfoNotifierParams notifparams;
-    TPckgC<TBTGenericInfoNotifierParams> paramsPckg( notifparams );
-    paramsPckg.Set( params );
-    TInt notifType = paramsPckg().iMessageType;
     
     switch(notifType)
         {
@@ -173,15 +174,32 @@
         case EBTSwitchedOff:
             {
             User::LeaveIfError(iNotification->SetData( TBluetoothDeviceDialog::EAdditionalInt, notifType));
+            iNotification->SetNotificationType( TBluetoothDialogParams::ENote, EGenericInfo );
             }break;
-            
+        case EBTEnterSap:
+            // save the pointer in order to dismiss the dialog later on
+            iEnterSAPNotification = iNotification;
+            iNotification->SetNotificationType( TBluetoothDialogParams::bt_052_d_entering, EUnusedResource );
+            break;
+        case EBTSapNoSim:
+            iNotification->SetNotificationType( TBluetoothDialogParams::bt_053_d_unable_to_use_no_sim, EUnusedResource );
+            break;
+        case EBTSapFailed:
+            iNotification->SetNotificationType( TBluetoothDialogParams::bt_053_d_unable_to_use, EUnusedResource );
+            break;
+        case EBTSapOk:
+            if(iEnterSAPNotification)
+                iEnterSAPNotification->Close();
+            iNotification->SetNotificationType( TBluetoothDialogParams::bt_054_d_entered_popup, EGenericInfo );
+            // Todo: handler err in a proper way
+            err = iNotification->SetData( TBluetoothDeviceDialog::EAdditionalInt, notifType);
+            break;
         default:
             {
+            iNotification->SetNotificationType( TBluetoothDialogParams::ENote, EGenericInfo );
             TBTDevAddr addr(paramsPckg().iRemoteAddr);
 
             // Get the device name
-            TInt err = KErrNone;
-
             const CBtDevExtension* dev = iServer->DevRepository().Device(addr);
             if(dev)
                 {