alert: Introduce manager abstraction layer

This abstraction layer makes the GATT Phone Alert Status and Alert
Notification implementation consistent with other GATT profiles.
This commit is contained in:
Anderson Lizardo 2012-10-02 16:24:25 -04:00 committed by Johan Hedberg
parent bbaccd71b0
commit 4d629a9656
4 changed files with 71 additions and 4 deletions

View File

@ -219,7 +219,8 @@ builtin_sources += profiles/thermometer/main.c \
profiles/thermometer/thermometer.h \
profiles/thermometer/thermometer.c \
profiles/alert/main.c profiles/alert/server.h \
profiles/alert/server.c \
profiles/alert/server.c profiles/alert/manager.h \
profiles/alert/manager.c \
profiles/time/main.c profiles/time/server.h \
profiles/time/server.c profiles/time/manager.c \
profiles/time/manager.h \

View File

@ -33,7 +33,7 @@
#include "plugin.h"
#include "hcid.h"
#include "log.h"
#include "server.h"
#include "manager.h"
static int alert_init(void)
{
@ -42,7 +42,7 @@ static int alert_init(void)
return -ENOTSUP;
}
return alert_server_init();
return alert_manager_init();
}
static void alert_exit(void)
@ -50,7 +50,7 @@ static void alert_exit(void)
if (!main_opts.gatt_enabled)
return;
alert_server_exit();
alert_manager_exit();
}
BLUETOOTH_PLUGIN_DEFINE(alert, VERSION,

40
profiles/alert/manager.c Normal file
View File

@ -0,0 +1,40 @@
/*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2012 Nokia Corporation
* Copyright (C) 2012 Marcel Holtmann <marcel@holtmann.org>
*
*
* 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 <config.h>
#endif
#include "manager.h"
#include "server.h"
int alert_manager_init(void)
{
return alert_server_init();
}
void alert_manager_exit(void)
{
alert_server_exit();
}

26
profiles/alert/manager.h Normal file
View File

@ -0,0 +1,26 @@
/*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2012 Nokia Corporation
* Copyright (C) 2012 Marcel Holtmann <marcel@holtmann.org>
*
*
* 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 alert_manager_init(void);
void alert_manager_exit(void);