activityfw/storage/server/src/afstorageasynctask.cpp
changeset 107 b34d53f6acdf
parent 99 7aaf39b772ac
child 116 305818acdca4
equal deleted inserted replaced
106:e78d6e055a5b 107:b34d53f6acdf
    16 */
    16 */
    17 #include <s32mem.h>
    17 #include <s32mem.h>
    18 
    18 
    19 #include "afstorageasynctask.h"
    19 #include "afstorageasynctask.h"
    20 #include "afcmd.h"
    20 #include "afcmd.h"
    21 
       
    22 _LIT(KUnsupportedStorageAsyncTask, "Unsupported async storage task");
       
    23 
    21 
    24 // -----------------------------------------------------------------------------
    22 // -----------------------------------------------------------------------------
    25 /**
    23 /**
    26  * Constructor for performing 1st stage construction
    24  * Constructor for performing 1st stage construction
    27  */
    25  */
    54     CAfStorageAsyncTask* self = new (ELeave) CAfStorageAsyncTask();
    52     CAfStorageAsyncTask* self = new (ELeave) CAfStorageAsyncTask();
    55     CleanupStack::PushL(self);
    53     CleanupStack::PushL(self);
    56     self->ExecuteL(dataStorage, msg);
    54     self->ExecuteL(dataStorage, msg);
    57     taskStorage.PushL(self);
    55     taskStorage.PushL(self);
    58     CleanupStack::Pop(self);
    56     CleanupStack::Pop(self);
    59     if (EFalse == msg.IsNull()) {
    57     msg.Complete(KErrNone);
    60         msg.Complete(KErrNone);
       
    61     }
       
    62 }
    58 }
    63 
    59 
    64 // -----------------------------------------------------------------------------
    60 // -----------------------------------------------------------------------------
    65 /**
    61 /**
    66  * Interface implementation
    62  * Interface implementation
    98         ApplicationActivitiesL(dataStorage, msg);
    94         ApplicationActivitiesL(dataStorage, msg);
    99         break;
    95         break;
   100     case ApplicationActivity:
    96     case ApplicationActivity:
   101         ApplicationActivityL(dataStorage, msg);
    97         ApplicationActivityL(dataStorage, msg);
   102         break;
    98         break;
   103     default:
       
   104         //this code shouldn't be called. fatal error: means wrong session implementation 
       
   105         User::Panic(KUnsupportedStorageAsyncTask, KErrGeneral);
       
   106     };
    99     };
   107 }
   100 }
   108 
   101 
   109 // -----------------------------------------------------------------------------
   102 // -----------------------------------------------------------------------------
   110 /**
   103 /**
   164  * Write response data into request message
   157  * Write response data into request message
   165  * @param msg - destination message
   158  * @param msg - destination message
   166  */
   159  */
   167 void CAfStorageAsyncTask::WriteResponseL(const RMessage2& msg)
   160 void CAfStorageAsyncTask::WriteResponseL(const RMessage2& msg)
   168 {
   161 {
   169     if (EFalse == msg.IsNull()) {
   162     msg.WriteL(1, 
   170         msg.WriteL(1, 
   163                TPckgBuf<TInt>(mExternalizedData.Length()));//write data size
   171                    TPckgBuf<TInt>(mExternalizedData.Length()));//write data size
   164     msg.WriteL(2, 
   172         msg.WriteL(2, 
   165                TPckgBuf<CBase*>(this));//task identyfier
   173                    TPckgBuf<CBase*>(this));//task identyfier
       
   174     }
       
   175 }
   166 }
   176 
   167 
   177 // -----------------------------------------------------------------------------
   168 // -----------------------------------------------------------------------------
   178 /**
   169 /**
   179  * Returns ETrue if task is related with session argument
   170  * Returns ETrue if task is related with session argument