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.
28 enum appcore_base_rm {
29 APPCORE_BASE_RM_UNKNOWN,
30 APPCORE_BASE_RM_PORTRAIT_NORMAL,
31 APPCORE_BASE_RM_PORTRAIT_REVERSE,
32 APPCORE_BASE_RM_LANDSCAPE_NORMAL,
33 APPCORE_BASE_RM_LANDSCAPE_REVERSE,
36 enum appcore_base_event {
37 APPCORE_BASE_EVENT_START,
38 APPCORE_BASE_EVENT_LOW_MEMORY,
39 APPCORE_BASE_EVENT_LOW_BATTERY,
40 APPCORE_BASE_EVENT_LANG_CHANGE,
41 APPCORE_BASE_EVENT_DEVICE_ORIENTATION_CHANGED,
42 APPCORE_BASE_EVENT_REGION_CHANGE,
43 APPCORE_BASE_EVENT_SUSPENDED_STATE_CHANGE,
44 APPCORE_BASE_EVENT_UPDATE_REQUESTED,
45 APPCORE_BASE_EVENT_MAX,
48 enum appcore_base_suspended_state {
49 APPCORE_BASE_SUSPENDED_STATE_WILL_ENTER_SUSPEND = 0,
50 APPCORE_BASE_SUSPENDED_STATE_DID_EXIT_FROM_SUSPEND
54 typedef int (*appcore_base_event_cb)(void *event, void *data);
55 typedef void *appcore_base_event_h;
57 typedef struct _appcore_base_ops {
58 int (*create) (void *data);
59 int (*terminate) (void *data);
60 int (*control) (bundle *b, void *data);
61 int (*receive)(aul_type type, bundle *b, void *data);
62 int (*set_i18n)(void *data);
63 void (*run)(void *data);
64 void (*exit)(void *data);
65 void (*set_event)(enum appcore_base_event event, void *data);
66 void (*unset_event)(enum appcore_base_event event, void *data);
69 int appcore_base_on_receive(aul_type type, bundle *b);
70 int appcore_base_on_create(void);
71 int appcore_base_on_control(bundle *b);
72 int appcore_base_on_terminate(void);
73 int appcore_base_on_set_i18n(void);
74 void appcore_base_on_set_event(enum appcore_base_event event);
75 void appcore_base_on_unset_event(enum appcore_base_event event);
76 int appcore_base_init(appcore_base_ops ops, int argc, char **argv, void *data);
77 void appcore_base_fini(void);
78 appcore_base_ops appcore_base_get_default_ops(void);
79 appcore_base_event_h appcore_base_add_event(enum appcore_base_event event,
80 appcore_base_event_cb cb, void *data);
81 int appcore_base_remove_event(appcore_base_event_h handle);
82 int appcore_base_raise_event(void *event, enum appcore_base_event type);
83 int appcore_base_flush_memory(void);
84 int appcore_base_get_rotation_state(enum appcore_base_rm *curr);
85 bool appcore_base_is_bg_allowed(void);
86 bool appcore_base_is_suspended(void);
87 void appcore_base_toggle_suspended_state(void);
88 int appcore_base_set_i18n(const char *domain_name, const char *dir_name);