Revise ambient_viewer_notify_ambient_event
[platform/core/appfw/widget-viewer.git] / watch-holder-base / src / ambient_listener.hh
1 /*
2  * Copyright (c) 2020 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 #ifndef WATCH_HOLDER_BASE_SRC_AMBIENT_LISTENER_HH_
18 #define WATCH_HOLDER_BASE_SRC_AMBIENT_LISTENER_HH_
19
20 #include <bundle_cpp.h>
21 #include <aul_app_com.h>
22
23 #include <string>
24
25 #include "common.hh"
26
27 namespace watch_holder {
28
29 class AmbientListener {
30  public:
31   enum EventType {
32     EVENT_AOD_PREPARE,
33     EVENT_AOD_READY,
34     EVENT_AOD_NOTIFIED
35   };
36
37   enum AmbientState {
38     AMBIENT_LEAVE,
39     AMBIENT_ENTER,
40     AMBIENT_BLOCK_TICK,
41   };
42   AmbientListener();
43   virtual ~AmbientListener();
44   static int OnAmbientChangedSignal(const char *endpoint,
45       aul_app_com_result_e e, bundle *envelope, void *user_data);
46   static int OnReceiveSignal(const char* endpoint, aul_app_com_result_e e,
47       bundle* envelope, void* user_data);
48
49   virtual void OnAmbientChanged(bool enter,
50       const tizen_base::Bundle& extra) = 0;
51   virtual void OnAmbientEvent(EventType ev, std::string sender,
52       tizen_base::Bundle extra) = 0;
53
54  private:
55   aul_app_com_connection_h ambient_changed_signal_conn_ = nullptr;
56   aul_app_com_connection_h ambient_event_signal_conn_ = nullptr;
57 };
58
59 }  // namespace watch_holder
60
61 #endif  // WATCH_HOLDER_BASE_SRC_AMBIENT_LISTENER_HH_