2 * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
29 enum appcore_base_rm {
30 APPCORE_BASE_RM_UNKNOWN,
31 APPCORE_BASE_RM_PORTRAIT_NORMAL,
32 APPCORE_BASE_RM_PORTRAIT_REVERSE,
33 APPCORE_BASE_RM_LANDSCAPE_NORMAL,
34 APPCORE_BASE_RM_LANDSCAPE_REVERSE,
37 enum appcore_base_event {
38 APPCORE_BASE_EVENT_START,
39 APPCORE_BASE_EVENT_LOW_MEMORY,
40 APPCORE_BASE_EVENT_LOW_BATTERY,
41 APPCORE_BASE_EVENT_LANG_CHANGE,
42 APPCORE_BASE_EVENT_DEVICE_ORIENTATION_CHANGED,
43 APPCORE_BASE_EVENT_REGION_CHANGE,
44 APPCORE_BASE_EVENT_SUSPENDED_STATE_CHANGE,
45 APPCORE_BASE_EVENT_UPDATE_REQUESTED,
46 APPCORE_BASE_EVENT_MAX,
49 enum appcore_base_suspended_state {
50 APPCORE_BASE_SUSPENDED_STATE_WILL_ENTER_SUSPEND = 0,
51 APPCORE_BASE_SUSPENDED_STATE_DID_EXIT_FROM_SUSPEND
54 enum appcore_base_display_state {
55 APPCORE_BASE_DISPLAY_STATE_UNKNOWN,
56 APPCORE_BASE_DISPLAY_STATE_ON,
57 APPCORE_BASE_DISPLAY_STATE_OFF,
61 APPCORE_BASE_ERROR_NONE = 0,
62 APPCORE_BASE_ERROR_INVALID_PARAMETER = -EINVAL,
63 APPCORE_BASE_ERROR_OUT_OF_MEMORY = -ENOMEM,
64 APPCORE_BASE_ERROR_KEY_NOT_FOUND = -ENOKEY,
65 APPCORE_BASE_ERROR_IO_ERROR = -EIO,
66 } appcore_base_error_e;
68 typedef int (*appcore_base_event_cb)(void *event, void *data);
69 typedef void *appcore_base_event_h;
71 typedef struct _appcore_base_ops {
72 int (*create) (void *data);
73 int (*terminate) (void *data);
74 int (*control) (bundle *b, void *data);
75 int (*receive)(aul_type type, bundle *b, void *data);
76 int (*set_i18n)(void *data);
77 void (*init)(int argc, char **argv, void *data);
79 void (*run)(void *data);
80 void (*exit)(void *data);
81 void (*set_event)(enum appcore_base_event event, void *data);
82 void (*unset_event)(enum appcore_base_event event, void *data);
83 void (*trim_memory)(void *data);
86 int appcore_base_on_receive(aul_type type, bundle *b);
87 int appcore_base_on_create(void);
88 int appcore_base_on_control(bundle *b);
89 int appcore_base_on_terminate(void);
90 int appcore_base_on_set_i18n(void);
91 void appcore_base_on_set_event(enum appcore_base_event event);
92 void appcore_base_on_unset_event(enum appcore_base_event event);
93 int appcore_base_on_trim_memory(void);
94 int appcore_base_init(appcore_base_ops ops, int argc, char **argv, void *data);
95 void appcore_base_fini(void);
96 appcore_base_ops appcore_base_get_default_ops(void);
97 appcore_base_event_h appcore_base_add_event(enum appcore_base_event event,
98 appcore_base_event_cb cb, void *data);
99 int appcore_base_remove_event(appcore_base_event_h handle);
100 int appcore_base_raise_event(void *event, enum appcore_base_event type);
101 int appcore_base_flush_memory(void);
102 int appcore_base_get_rotation_state(enum appcore_base_rm *curr);
103 bool appcore_base_is_bg_allowed(void);
104 bool appcore_base_is_suspended(void);
105 void appcore_base_toggle_suspended_state(void);
106 int appcore_base_set_i18n(const char *domain_name, const char *dir_name);
107 void appcore_base_exit(void);
108 void appcore_base_add_suspend_timer(void);
109 void appcore_base_remove_suspend_timer(void);
110 void appcore_base_set_display_state(int display_state);
111 int appcore_base_get_display_state(void);