From ecedf91d68b97b5876ac75e5bfa3365dd8e70e1e Mon Sep 17 00:00:00 2001 From: Jin Yoon Date: Mon, 24 Jul 2017 11:43:09 +0900 Subject: Encapsulate pre-defined functions into controller_internal.c Change-Id: I5801569003f9331fd8e7a7bd4fb9c96e237ae9f0 --- src/controller.c | 20 ++------------------ src/controller_internal.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 18 deletions(-) create mode 100644 src/controller_internal.c (limited to 'src') diff --git a/src/controller.c b/src/controller.c index cee20d9..06cb7b7 100644 --- a/src/controller.c +++ b/src/controller.c @@ -42,9 +42,6 @@ #define USE_MULTIPLE_SENSOR 0 #define MULTIPLE_SENSOR_NUMBER 5 -static void _start_internal_function(void); -static void _stop_internal_function(void); - typedef struct app_data_s { Ecore_Timer *getter_timer[PIN_MAX]; connectivity_resource_s *resource_info; @@ -111,7 +108,7 @@ static bool service_app_create(void *data) app_data *ad = data; int ret = -1; - _start_internal_function(); + controller_init_internal_functions(); ret = connectivity_set_resource("/door/1", "org.tizen.door", &ad->resource_info); if (ret == -1) _E("Cannot broadcast resource"); @@ -159,7 +156,7 @@ static void service_app_terminate(void *data) } connectivity_unset_resource(ad->resource_info); - _stop_internal_function(); + controller_fini_internal_functions(); free(ad); } @@ -211,16 +208,3 @@ int main(int argc, char* argv[]) return ret; } - -/* Do not modify codes under this comment */ -static void _start_internal_function(void) -{ - connectivity_init(); -} - -static void _stop_internal_function(void) -{ - _I("Terminating..."); - resource_close_all(); - connectivity_fini(); -} diff --git a/src/controller_internal.c b/src/controller_internal.c new file mode 100644 index 0000000..9deb732 --- /dev/null +++ b/src/controller_internal.c @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Contact: Jin Yoon + * Geunsun Lee + * Eunyoung Lee + * Junkyu Han + * + * 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. + */ + +#include + +#include "log.h" +#include "connectivity.h" +#include "resource.h" + +void controller_init_internal_functions(void) +{ + connectivity_init(); +} + +void controller_fini_internal_functions(void) +{ + _I("Terminating..."); + resource_close_all(); + connectivity_fini(); +} -- cgit v1.2.3