2 * Copyright (c) 2016 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (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://floralicense.org/license/
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.
17 |R| #include <service_app.h>
18 #include <system_settings.h>
19 #include <Elementary.h>
21 |R| #include "$(appName).h"
25 * @brief Hook to take necessary actions before main event loop starts.
26 * Initialize the service's data.
27 * If this function returns true, the main loop of the sertvice starts.
28 * If this function returns false, the service is terminated.
30 |R| static bool srv_create(void *user_data)
36 * @brief This callback function is called when another application.
37 * sends the launch request to the service.
39 |R| static void srv_control(app_control_h app_control, void *user_data)
41 /* Handle the launch request. */
45 * @brief This callback function is called once after the main loop.
46 * of the service exits.
48 |R| static void srv_terminate(void *user_data)
50 /* Release all resources. */
54 * @brief Main function of the service.
56 |R| int main(int argc, char *argv[])
60 |R| service_app_lifecycle_callback_s event_callback = {0, };
61 app_event_handler_h handlers[5] = {NULL, };
63 |R| event_callback.create = srv_create;
64 |R| event_callback.terminate = srv_terminate;
65 |R| event_callback.app_control = srv_control;
68 * If you want to handling more events,
69 * please check the service's lifecycle guide.
71 service_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, srv_lang_changed, NULL);
73 |R| ret = service_app_main(argc, argv, &event_callback, NULL);
74 |R| if (ret != APP_ERROR_NONE)
75 |R| dlog_print(DLOG_ERROR, LOG_TAG, "service_app_main() is failed. err = %d", ret);