Merge "Revert "Fix duplicated alarms."" into tizen_2.2
[platform/framework/native/appfw.git] / src / system / inc / FSys_AlarmImpl.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file                FSys_AlarmImpl.h
19  * @brief               This is the header file for _AlarmImpl class.
20  */
21
22 #ifndef _FSYSTEM_INTERNAL_ALARM_IMPL_H_
23 #define _FSYSTEM_INTERNAL_ALARM_IMPL_H_
24
25 #include <FBaseColHashMap.h>
26 #include <FBaseDateTime.h>
27 #include <FBaseInteger.h>
28 #include <FBaseRtEvent.h>
29 #include <FBaseResult.h>
30
31 #include <FBaseRt_Event.h>
32
33 #include <FSysAlarm.h>
34
35 namespace Tizen { namespace System
36 {
37
38 class _OSP_EXPORT_ _AlarmImpl
39         : public Tizen::Base::Object
40 {
41 public:
42         _AlarmImpl(Alarm* pAlarm);
43
44         virtual ~_AlarmImpl();
45
46 public:
47         result Construct(void);
48
49         result Set(const Tizen::Base::DateTime& startTime, int period, const Tizen::Base::DateTime* pEndTime);
50
51         result Cancel(void);
52
53         const Tizen::Base::DateTime GetStartTime(void) const;
54
55         int GetPeriod(void) const;
56
57         const Tizen::Base::DateTime* GetEndTime(void) const;
58
59         result SetAlarmEventListener(IAlarmEventListener* pListener);
60
61         void OnAlarmExpired(int alarmId);
62
63         static _AlarmImpl* GetInstance(Alarm* pAlarm);
64
65         static const _AlarmImpl* GetInstance(const Alarm* pAlarm);
66
67
68 public:
69         Tizen::Base::Integer    __alarmId;
70
71 private:
72         _AlarmImpl(const _AlarmImpl& alarmImpl);
73
74         _AlarmImpl& operator =(const _AlarmImpl& alarmImpl);
75
76 private:
77         Tizen::Base::Integer    __period;
78
79         Tizen::Base::DateTime   __startTime;
80
81         Tizen::Base::DateTime*  __pEndTime;
82
83         bool                    __isSetEndTime;
84
85         Tizen::Base::Runtime::_Event* __pEvent;
86
87         Alarm*                  __pAlarm;
88 };
89
90 } } // Tizen::System
91
92 #endif //_FSYSTEM_INTERNAL_ALARM_IMPL_H_