locationdataharvester/mylocationsengine/src/calendernotification.cpp
branchRCL_3
changeset 17 1fc85118c3ae
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
       
     1 /*
       
     2  * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: Mylocation engine source implementation for calender db path observation.
       
    15  *
       
    16  */
       
    17 
       
    18 #include <calendernotification.h>
       
    19 
       
    20 _LIT( KCalendarDbPath, ":\\private\\10003a5b\\" );
       
    21 
       
    22 const TInt KMaxFilePtahSize = 256;
       
    23 
       
    24 // -----------------------------------------------------------------------------
       
    25 // CMyLocationsEngine::NewL()
       
    26 // -----------------------------------------------------------------------------
       
    27 //
       
    28 CCalenderNotification* CCalenderNotification::NewL(MNotifyChange* aNotifyChange)
       
    29 {
       
    30     CCalenderNotification* self = CCalenderNotification::NewLC(aNotifyChange);
       
    31     CleanupStack::Pop(self);
       
    32     return self;
       
    33 }
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // CMyLocationsEngine::NewLC()
       
    37 // -----------------------------------------------------------------------------
       
    38 //
       
    39 CCalenderNotification* CCalenderNotification::NewLC(
       
    40         MNotifyChange* aNotifyChange)
       
    41 {
       
    42     CCalenderNotification* self = new (ELeave) CCalenderNotification(
       
    43             aNotifyChange);
       
    44     CleanupStack::PushL(self);
       
    45     self->ConstructL();
       
    46     return self;
       
    47 }
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // CMyLocationsEngine::ConstructL()
       
    51 // Symbian 2nd phase constructor can leave.
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 void CCalenderNotification::ConstructL()
       
    55 {
       
    56     CActiveScheduler::Add(this);
       
    57     User::LeaveIfError(iFsession.Connect());
       
    58 
       
    59 }
       
    60 
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // CMyLocationsEngine::CheckCalenderDbFileStructure()
       
    64 // Observes the calendar db file structure changes.
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 void CCalenderNotification::CheckCalenderDbFileStructure( TChar aDrive )
       
    68 {
       
    69     TBuf<KMaxFilePtahSize> filePath;
       
    70     filePath.Append( aDrive );
       
    71     filePath.Append( KCalendarDbPath );
       
    72     iFsession.NotifyChange(ENotifyEntry, iStatus, filePath );
       
    73     SetActive();
       
    74 }
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 // CMyLocationsEngine::CCalenderNotification()
       
    78 // Default constructor .
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 CCalenderNotification::CCalenderNotification(MNotifyChange* aNotifyChange) :
       
    82     CActive(EPriorityStandard), iNotifyChange(*aNotifyChange)
       
    83 {
       
    84 }
       
    85 // -----------------------------------------------------------------------------
       
    86 // CMyLocationsEngine::~CCalenderNotification()
       
    87 // default destuctor.
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 CCalenderNotification::~CCalenderNotification()
       
    91 {
       
    92     Cancel();
       
    93     iFsession.Close();
       
    94 }
       
    95 // -----------------------------------------------------------------------------
       
    96 // CMyLocationsEngine::RunL()
       
    97 // Assyncronous request handler , on completion of notification
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 void CCalenderNotification::RunL()
       
   101 {
       
   102     TInt status;
       
   103     iNotifyChange.NotifyChangeL( status );
       
   104 }
       
   105 // -----------------------------------------------------------------------------
       
   106 // CMyLocationsEngine::DoCancel()
       
   107 // Handels the error condition on assynchronous request
       
   108 // -----------------------------------------------------------------------------
       
   109 //
       
   110 void CCalenderNotification::DoCancel()
       
   111 {
       
   112     iFsession.NotifyChangeCancel();
       
   113 }
       
   114 
       
   115 //End of file
       
   116