Tizen 2.1 base
[platform/framework/native/app-service.git] / inc / FSys_AlarmService.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file         FSys_AlarmService.h
20  * @brief       This is the header file of the _AlarmService class.
21  *
22  * This header file contains the declarations of the _AlarmService class.
23  */
24
25 #include <FApp.h>
26 #include <FBase.h>
27 #include <FBaseColMultiHashMap.h>
28
29 #include "FApp_ICommunicationRequestListener.h"
30
31
32 #ifndef _FSYS_INTERNAL_ALARM_SERVICE_H_
33 #define _FSYS_INTERNAL_ALARM_SERVICE_H_
34
35 namespace Tizen { namespace System {
36
37 /**
38  * @class       _AlarmService
39  * @brief       This class contains implementaion of Alarm control.
40  * @since       3.0
41  */
42 class _AlarmService
43     : public Tizen::Base::Object
44         , public Tizen::App::_ICommunicationRequestListener
45 {
46 private:
47         _AlarmService(void);
48         virtual ~_AlarmService(void);
49 public:
50         virtual Tizen::Base::String GetId(void);
51         virtual void OnRequestOccured(Tizen::App::AppId appId, Tizen::Base::Collection::ArrayList* request, Tizen::Base::Collection::ArrayList* response);
52         virtual void OnApplicationTerminated(const Tizen::App::AppId& appId, Tizen::App::_AppType type);
53
54         void OnAlarmExpired(int alarmId);
55         static _AlarmService* GetInstance(void);
56 private:
57         int ReserveAlarm(Tizen::Base::DateTime startTime, int period);
58         result AddAlarmList(int alarmId, int period, Tizen::Base::String appId, Tizen::Base::DateTime* endTime);
59         result RemoveAlarmList(int alarmId);
60         result RemoveAlarmList(Tizen::Base::String appId);
61 private:
62         Tizen::App::_CommunicationDispatcher*   __pCommunicationDispatcher;
63         static _AlarmService*                   __pAlarmService;
64         Tizen::Base::Collection::MultiHashMap*  __pAlarmHashMap;
65         Tizen::Base::DateTime                   __endTime;
66
67         
68
69 };      //_AlarmService
70
71 }} //Osp::System
72 #endif /* _FSYS_INTERNAL_ALARM_SERVICE_H_ */