From 8877f4c4f4d256883b25e2ee3176ab79436887d7 Mon Sep 17 00:00:00 2001 From: Anderson Lizardo Date: Wed, 20 Jun 2012 14:14:19 -0400 Subject: [PATCH] time: Introduce manager abstraction layer This abstraction layer makes the GATT Time profile implementation consistent with other profiles. It is the first step before implementing the adapter driver for the Time server implementation. --- Makefile.am | 1 + time/main.c | 6 +++--- time/manager.c | 40 ++++++++++++++++++++++++++++++++++++++++ time/manager.h | 26 ++++++++++++++++++++++++++ 4 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 time/manager.c create mode 100644 time/manager.h diff --git a/Makefile.am b/Makefile.am index 5009ca841..05da00cc3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -224,6 +224,7 @@ builtin_sources += thermometer/main.c \ thermometer/thermometer.h thermometer/thermometer.c \ alert/main.c alert/server.h alert/server.c \ time/main.c time/server.h time/server.c \ + time/manager.h time/manager.c \ plugins/gatt-example.c \ proximity/main.c proximity/manager.h proximity/manager.c \ proximity/monitor.h proximity/monitor.c \ diff --git a/time/main.c b/time/main.c index d87672567..9ef5bf1be 100644 --- a/time/main.c +++ b/time/main.c @@ -33,7 +33,7 @@ #include "plugin.h" #include "hcid.h" #include "log.h" -#include "server.h" +#include "manager.h" static int time_init(void) { @@ -42,7 +42,7 @@ static int time_init(void) return -ENOTSUP; } - return time_server_init(); + return time_manager_init(); } static void time_exit(void) @@ -50,7 +50,7 @@ static void time_exit(void) if (!main_opts.gatt_enabled) return; - time_server_exit(); + time_manager_exit(); } BLUETOOTH_PLUGIN_DEFINE(time, VERSION, diff --git a/time/manager.c b/time/manager.c new file mode 100644 index 000000000..5bda1a3e5 --- /dev/null +++ b/time/manager.c @@ -0,0 +1,40 @@ +/* + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2012 Nokia Corporation + * Copyright (C) 2012 Marcel Holtmann + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "manager.h" +#include "server.h" + +int time_manager_init(void) +{ + return time_server_init(); +} + +void time_manager_exit(void) +{ + time_server_exit(); +} diff --git a/time/manager.h b/time/manager.h new file mode 100644 index 000000000..74641d63f --- /dev/null +++ b/time/manager.h @@ -0,0 +1,26 @@ +/* + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2012 Nokia Corporation + * Copyright (C) 2012 Marcel Holtmann + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +int time_manager_init(void); +void time_manager_exit(void); -- 2.47.3