fotaapplication/fotaserver/src/fotanotifiers.cpp
changeset 73 ae69c2e8bc34
parent 51 2e64dc50f295
equal deleted inserted replaced
71:d2517372cc44 73:ae69c2e8bc34
     9  * Initial Contributors:
     9  * Initial Contributors:
    10  * Nokia Corporation - initial contribution.
    10  * Nokia Corporation - initial contribution.
    11  *
    11  *
    12  * Contributors:
    12  * Contributors:
    13  *
    13  *
    14  * Description: 
    14  * Description: The class is responsible for showing the device dialog from fotaserver.
    15  *
    15  *
    16  */
    16  */
    17 #include "fotanotifiers.h"
    17 #include "fotanotifiers.h"
    18 #include "FotaDlMgrClient.h"
    18 #include "FotaDlMgrClient.h"
    19 _LIT(KHbNotifier,"com.nokia.hb.devicemanagementdialog/1.0");
    19 _LIT(KHbNotifier,"com.nokia.hb.devicemanagementdialog/1.0");
    27     {
    27     {
    28     FLOG(_L("CFotaDownloadNotifHandler::NewL >>"));
    28     FLOG(_L("CFotaDownloadNotifHandler::NewL >>"));
    29     __ASSERT_ALWAYS( aObserver, User::Panic(KFotaPanic, KErrArgument) );
    29     __ASSERT_ALWAYS( aObserver, User::Panic(KFotaPanic, KErrArgument) );
    30     CFotaDownloadNotifHandler* h = new (ELeave) CFotaDownloadNotifHandler;
    30     CFotaDownloadNotifHandler* h = new (ELeave) CFotaDownloadNotifHandler;
    31     h->iObserver = aObserver;
    31     h->iObserver = aObserver;
    32     
    32     h->ConstructL();
    33     FLOG(_L("CFotaDownloadNotifHandler::NewL <<"));
    33     FLOG(_L("CFotaDownloadNotifHandler::NewL <<"));
    34 
    34 
    35     return h;
    35     return h;
    36     }
    36     }
    37 
    37 
    38 // --------------------------------------------------------------------------
    38 // --------------------------------------------------------------------------
    39 CFotaDownloadNotifHandler::CFotaDownloadNotifHandler() :
    39 CFotaDownloadNotifHandler::CFotaDownloadNotifHandler() :
    40     iDevDialog(NULL), iDialogID(0)
    40     iDevDialog(NULL)
    41     {
    41     {
    42     FLOG(_L("CFotaDownloadNotifHandler::CFotaDownloadNotifHandler()"));
    42     FLOG(_L("CFotaDownloadNotifHandler::CFotaDownloadNotifHandler()"));
    43     }
    43     }
    44 
    44 
    45 // --------------------------------------------------------------------------
    45 // --------------------------------------------------------------------------
    50         delete iDevDialog;
    50         delete iDevDialog;
    51     FLOG(_L("CFotaDownloadNotifHandler::~CFotaDownloadNotifHandler <<"));
    51     FLOG(_L("CFotaDownloadNotifHandler::~CFotaDownloadNotifHandler <<"));
    52     }
    52     }
    53 
    53 
    54 // ---------------------------------------------------------------------------
    54 // ---------------------------------------------------------------------------
       
    55 // CFotaDownloadNotifHandler::ConstructL
       
    56 // ---------------------------------------------------------------------------
       
    57 //
       
    58 
       
    59 void CFotaDownloadNotifHandler::ConstructL()
       
    60     {
       
    61     FLOG(_L("CFotaDownloadNotifHandler::ConstructL() >>"));
       
    62     iDevDialog = CHbDeviceDialogSymbian::NewL();
       
    63     FLOG(_L("CFotaDownloadNotifHandler::ConstructL() <<"));
       
    64     }
       
    65 
       
    66 // ---------------------------------------------------------------------------
    55 // CFotaDownloadNotifHandler::LaunchNotifierL
    67 // CFotaDownloadNotifHandler::LaunchNotifierL
    56 // This function is used the observer which uses this notifer to lauch the notifier
    68 // This function is used the observer which uses this notifer to lauch the notifier
    57 // It puts the necessary parameters to lauch the notifier in CHbSymbianVariantMap
    69 // It puts the necessary parameters to lauch the notifier in CHbSymbianVariantMap
    58 // ---------------------------------------------------------------------------
    70 // ---------------------------------------------------------------------------
    59 //
    71 //
    60 void CFotaDownloadNotifHandler::LaunchNotifierL(
    72 void CFotaDownloadNotifHandler::LaunchNotifierL(
    61         CHbSymbianVariantMap *aNotifParams, TInt aDialogId)
    73         CHbSymbianVariantMap *aNotifParams, TInt aDialogId)
    62     {
    74     {
    63     FLOG(_L("CFotaDownloadNotifHandler::LaunchNotifierL() >>"));
    75     FLOG(_L("CFotaDownloadNotifHandler::LaunchNotifierL() >>"));
    64     if (!iDevDialog)
    76     
    65         iDevDialog = CHbDeviceDialogSymbian::NewL();
       
    66     FLOG(_L("CFotaDownloadNotifHandler::CHbDeviceDialogSymbian::NewL()"));
       
    67     if (iDevDialog == NULL)
    77     if (iDevDialog == NULL)
    68         FLOG(_L("Error in CHbDeviceDialogSymbian::NewL()"));
    78         FLOG(_L("Error in CHbDeviceDialogSymbian::NewL()"));
    69 
    79 
    70     iDialogID = aDialogId;
       
    71     //connect(mDeviceDialog, SIGNAL(dataReceived(QVariantMap)), this, SLOT(dataReceived(QVariantMap)));
       
    72 
       
    73     TInt Err = iDevDialog->Show(KHbNotifier, *aNotifParams, this);
    80     TInt Err = iDevDialog->Show(KHbNotifier, *aNotifParams, this);
    74     FLOG(
    81     FLOG(_L("CFotaDownloadNotifHandler::CHbDeviceDialogSymbian::Show() - %d"),
    75             _L("CFotaDownloadNotifHandler::CHbDeviceDialogSymbian::Show() - %d"),
       
    76             Err);
    82             Err);
    77 
    83 
    78     FLOG(_L("CFotaDownloadNotifHandler::LaunchNotifierL() <<"));
    84     FLOG(_L("CFotaDownloadNotifHandler::LaunchNotifierL() <<"));
    79     }
    85     }
    80 
    86 
       
    87 // ---------------------------------------------------------------------------
       
    88 // CFotaDownloadNotifHandler::Cancel
       
    89 // To Cancel the notifier manually.
       
    90 // ---------------------------------------------------------------------------
       
    91 //
       
    92 
    81 void CFotaDownloadNotifHandler::Cancel()
    93 void CFotaDownloadNotifHandler::Cancel()
    82     {
    94     {
    83     FLOG(_L("CFotaDownloadNotifHandler::Cancel >>"));
    95     FLOG(_L("CFotaDownloadNotifHandler::Cancel >>"));
    84     if (iDialogID)
    96     if(iDevDialog)
    85         iDevDialog->Cancel();
    97         iDevDialog->Cancel();
    86     FLOG(_L("CFotaDownloadNotifHandler::Cancel <<"));
    98     FLOG(_L("CFotaDownloadNotifHandler::Cancel <<"));
    87     }
    99     }
    88 
   100 
    89 // ---------------------------------------------------------------------------
   101 // ---------------------------------------------------------------------------
    95 //
   107 //
    96 void CFotaDownloadNotifHandler::DataReceived(CHbSymbianVariantMap& aData)
   108 void CFotaDownloadNotifHandler::DataReceived(CHbSymbianVariantMap& aData)
    97     {
   109     {
    98     FLOG(_L("CFotaDownloadNotifHandler::DataReceived() >>"));
   110     FLOG(_L("CFotaDownloadNotifHandler::DataReceived() >>"));
    99     iDevDialog->Cancel();
   111     iDevDialog->Cancel();
   100     TFwUpdNoteTypes ret;
   112     TInt ret;
   101     const CHbSymbianVariant* dialogId = aData.Get(KResult);
   113     TFwUpdNoteTypes DialogId;
   102     ret = *(TFwUpdNoteTypes *) dialogId->Value<TInt> ();
   114     
   103     TInt temp = iDialogID;
   115     const CHbSymbianVariant* dialogId = aData.Get(KKeyDialog);
   104     iDialogID = 0;
   116     DialogId = *(TFwUpdNoteTypes *) dialogId->Value<TInt> ();
   105     iObserver->HandleDialogResponse(ret, temp);
   117     
       
   118     const CHbSymbianVariant* retVal = aData.Get(KResult);
       
   119     ret = *(retVal->Value<TInt> ());
       
   120     
       
   121     iObserver->HandleDialogResponse(ret, DialogId);
   106 
   122 
   107     FLOG(_L("CFotaDownloadNotifHandler::DataReceived() <<"));
   123     FLOG(_L("CFotaDownloadNotifHandler::DataReceived() <<"));
   108     }
   124     }
   109 
   125 
   110 // ---------------------------------------------------------------------------
   126 // ---------------------------------------------------------------------------