alarmui/AppServerStuff/Inc/AlarmWrapper.h
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2006-2006 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:  This is the MAlarmObserver I/F implementation instantiated and used directly by EIkAlert. 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __AKNALARMWRAPPER_H__
       
    21 #define __AKNALARMWRAPPER_H__
       
    22 
       
    23 // INCLUDES
       
    24 #include "pim_trace.h"
       
    25 #include <AknCapServerClient.h>
       
    26 #include <AlarmObserver.h>
       
    27 #include "AlarmServiceDefs.h"
       
    28 
       
    29 
       
    30 // DLL entry point
       
    31 IMPORT_C MAlarmObserver* NewAlarm();
       
    32 
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class CAknDataFetcher;
       
    36 
       
    37 /**
       
    38 * This class connects only on demand, this is because eiksrv is started 
       
    39 * before akncapserver and connecting would fail if done during construction 
       
    40 **/
       
    41 class RAknAlarmClient : public RAknUiServer
       
    42     {
       
    43 public:
       
    44     RAknAlarmClient(CAknDataFetcher** aFetcher);
       
    45     TInt SendSynch(TInt aOpcode);
       
    46     TInt SendSynch(TInt aOpcode, TInt& aParam);
       
    47     void SendAsync(TInt aOpcode, TRequestStatus& aStatus, TIpcArgs& aArgs );
       
    48     TInt SetAlarm(const TASShdAlarm& aAlarm, const TFullName& aOwner, const TDesC8& aAlarmData);
       
    49 
       
    50 private: // from  RAknCapServerClient
       
    51     TInt Connect(); // just to phohibit too early connection attemps
       
    52 
       
    53     TUid ServiceUid() const
       
    54         {
       
    55         TRACE_ENTRY_POINT;
       
    56         TRACE_EXIT_POINT;
       
    57         return KAknAlarmServiceUid;
       
    58         };
       
    59 
       
    60     TInt CheckConnection();
       
    61 
       
    62 private:
       
    63     CAknDataFetcher** iFetcher; // not owned
       
    64 
       
    65     };
       
    66 
       
    67 
       
    68 /**
       
    69 * AO for fetching messages (snooze & stop)
       
    70 **/
       
    71 NONSHARABLE_CLASS( CAknDataFetcher ) : public CActive
       
    72     {
       
    73 public:
       
    74     CAknDataFetcher( TInt aPriority, 
       
    75                      CEikAlmControlSupervisor* aSupervisor, 
       
    76                      RAknAlarmClient& aClient );
       
    77     void Start();
       
    78     void RunL();
       
    79     void DoCancel();
       
    80     CEikAlmControlSupervisor* iSupervisor; // not owned
       
    81 
       
    82 private:
       
    83     RAknAlarmClient& iClient;
       
    84     TPckgBuf<TInt> iPckg;
       
    85     TIpcArgs iArgs;
       
    86 
       
    87     };
       
    88 
       
    89 
       
    90 /**
       
    91 * Main class
       
    92 **/
       
    93 NONSHARABLE_CLASS( CAknAlarmWrapper ) : public CBase, 
       
    94                                         public MAlarmObserver
       
    95     {
       
    96 public: // from MAlarmObserver
       
    97     void ConstructL( CEikAlmControlSupervisor* aSupervisor,
       
    98                      CEikServAppUiBase* aAppUi );
       
    99 
       
   100 public: // from MEikServAlarm
       
   101     void Release();
       
   102     void ShowAlarm();
       
   103     void HideAlarm();
       
   104     TInt CurrentServerState() const;
       
   105     void UpdateSoundPauseTimeInterval(TInt aMinutes);
       
   106     void UpdateForAlarmServerState(TInt aNewAlarmServerState);
       
   107     void UpdateAlarmInfo(const TASShdAlarm& aAlarm, const TFullName& aOwner);
       
   108     void StartPlayAlarmL(const TDesC& aAlarmName);
       
   109     void StopPlayAlarm();
       
   110 
       
   111 public:
       
   112     CAknAlarmWrapper();
       
   113 
       
   114 private:
       
   115     ~CAknAlarmWrapper();
       
   116     CEikServAppUiBase* iAppUi; // not owned
       
   117     __MUTABLE RAknAlarmClient iClient;
       
   118     CAknDataFetcher* iActive;
       
   119 
       
   120     };
       
   121 
       
   122 #endif // __AKNALARMWRAPPER_H__
       
   123 
       
   124 
       
   125 // End of File