summaryrefslogtreecommitdiff
path: root/appcore_ui_app_ambient/include/ui_app_ambient.h
blob: 4193eb632b6f78b5c1e1b47427bdd8ffea344770 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __UI_APP_AMBIENT__
#define __UI_APP_AMBIENT__

#ifdef __cplusplus
extern "C" {
#endif

#include <stdbool.h>

#include <bundle.h>

/**
 * @brief Enumeration for period.
 * @remark This function only for internal applications
 */
typedef enum {
	UI_APP_AMBIENT_UPDATE_NONE,
	UI_APP_AMBIENT_UPDATE_MINUTE,
	UI_APP_AMBIENT_UPDATE_FIVE_MINUTES,
	UI_APP_AMBIENT_UPDATE_FIFTEEN_MINUTES,
	UI_APP_AMBIENT_UPDATE_THIRTY_MINUTES
} ui_app_ambient_update_period_e;

/**
 * @brief Enumeration for event.
 * @remark This function only for internal applications
 */
typedef enum {
	UI_APP_AMBIENT_EVENT_PREPARE,
	UI_APP_AMBIENT_EVENT_READY
} ui_app_ambient_event_e;

/**
 * @brief Called with the period set with ui_app_ambient_set_update_period() if the device is in the ambient mode.
 * @remark This function only for internal applications
 * @param[in] user_data The user data to be passed to the callback functions
 * @see ui_app_ambient_set_lifecycle()
 * @see ui_app_ambient_set_update_period()
 */
typedef void (*ui_app_ambient_update_frame_cb) (void *user_data);

/**
 * @brief Called when the device enters or exits the ambient mode.
 * @remark This function only for internal applications
 * @param[in] ambient_mode Whether ambient mode is true or not
 * @param[in] data The extra bundle data from ambient viewer
 * @param[in] user_data The user data to be passed to the callback functions
 * @see ui_app_ambient_set_lifecycle()
 */
typedef void (*ui_app_ambient_changed_cb) (bool ambient_mode, bundle *data, void *user_data);

/**
 * @brief The structure type containing the set of callback functions for application events handle.
 * @remark This function only for internal applications
 * @see ui_app_ambient_set_lifecycle()
 */
typedef struct {
	ui_app_ambient_update_frame_cb frame_updated;
	ui_app_ambient_changed_cb ambient_changed;
} ui_app_ambient_lifecycle_callback_s;

/**
 * @brief Sets lifecycle for UI ambient lifecycle.
 * @remark This function only for internal applications
 * @param[in] lifecycle The set of callback functions to handle application lifecycle events
 * @param[in] user_data The user data to be passed to the callback functions
 * @return @c 0 on success,
 *         otherwise a negative error value
 * @see ui_app_ambient_unset_lifecycle()
 */
int ui_app_ambient_set_lifecycle(ui_app_ambient_lifecycle_callback_s *lifecycle, void *user_data);

/**
 * @brief Unsets lifecycle for UI ambient lifecycle.
 * @remark This function only for internal applications
 * @see ui_app_ambient_set_lifecycle()
 */
void ui_app_ambient_unset_lifecycle(void);

/**
 * @brief Sets the period of ui_app_ambient_update_frame_cb() calls.
 * @remark This function only for internal applications
 * @param[in] period period type
 * @return @c 0 on success,
 *         otherwise a negative error value
 * @see ui_app_ambient_get_update_period()
 */
int ui_app_ambient_set_update_period(ui_app_ambient_update_period_e period);

/**
 * @brief Gets the period of ui_app_ambient_update_frame_cb() calls.
 * @remark This function only for internal applications
 * @param[out] period period type
 * @return @c 0 on success,
 *         otherwise a negative error value
 * @see ui_app_ambient_set_update_period()
 */
int ui_app_ambient_get_update_period(ui_app_ambient_update_period_e *period);

/**
 * @brief Notifies event with bundle data to the @a receiver.
 * @remark This function only for internal applications
 * @param[in] event ambient event type
 * @param[in] extra extra bundle data
 * @return @c 0 on success,
 *         otherwise a negative error value
 */
int ui_app_ambient_notify_event(ui_app_ambient_event_e event, bundle *extra);

#ifdef __cplusplus
}
#endif

#endif /* __UI_APP_AMBIENT__ */