Remove unused code
[apps/native/sample/sample-core-components.git] / rule / service / project / src / main.c.tccr
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd
3  *
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
7  *
8  *     http://floralicense.org/license/
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 |R| #include <service_app.h>
18 #include <system_settings.h>
19 #include <Elementary.h>
20 #include <dlog.h>
21 |R| #include "$(appName).h"
22 #include "data.h"
23
24 /**
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.
29  */
30 |R| static bool srv_create(void *user_data)
31 |R| {
32         return true;
33 |R| }
34
35 /**
36  * @brief This callback function is called when another application.
37  * sends the launch request to the service.
38  */
39 |R| static void srv_control(app_control_h app_control, void *user_data)
40 |R| {
41         /* Handle the launch request. */
42 |R| }
43
44 /**
45  * @brief This callback function is called once after the main loop.
46  * of the service exits.
47  */
48 |R| static void srv_terminate(void *user_data)
49 |R| {
50         /* Release all resources. */
51 |R| }
52
53 /**
54  * @brief Main function of the service.
55  */
56 |R| int main(int argc, char *argv[])
57 |R| {
58 |R| int ret;
59
60 |R| service_app_lifecycle_callback_s event_callback = {0, };
61         app_event_handler_h handlers[5] = {NULL, };
62
63 |R| event_callback.create = srv_create;
64 |R| event_callback.terminate = srv_terminate;
65 |R| event_callback.app_control = srv_control;
66
67 /*
68  * If you want to handling more events,
69  * please check the service's lifecycle guide.
70  */
71         service_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, srv_lang_changed, NULL);
72
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);
76
77 |R| return ret;
78 |R| }