mirror of git://git.sysmocom.de/ofono
hfp_hf_bluez5: Add initial skeleton implementation
This commit is contained in:
parent
9fb87705c2
commit
f95fbc72a1
|
@ -438,7 +438,7 @@ builtin_modules += bluez5
|
|||
builtin_sources += plugins/bluez5.c plugins/bluez5.h
|
||||
|
||||
builtin_modules += hfp_bluez5
|
||||
builtin_sources += plugins/hfp_hf_bluez5.c
|
||||
builtin_sources += plugins/hfp_hf_bluez5.c plugins/bluez5.h
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -23,19 +23,99 @@
|
|||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <glib.h>
|
||||
|
||||
#define OFONO_API_SUBJECT_TO_CHANGE
|
||||
#include <ofono/modem.h>
|
||||
#include <ofono/dbus.h>
|
||||
#include <ofono/plugin.h>
|
||||
#include <ofono/log.h>
|
||||
|
||||
#include "bluez5.h"
|
||||
|
||||
#ifndef DBUS_TYPE_UNIX_FD
|
||||
#define DBUS_TYPE_UNIX_FD -1
|
||||
#endif
|
||||
|
||||
#define HFP_EXT_PROFILE_PATH "/bluetooth/profile/hfp_hf"
|
||||
|
||||
static int hfp_probe(struct ofono_modem *modem)
|
||||
{
|
||||
DBG("modem: %p", modem);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void hfp_remove(struct ofono_modem *modem)
|
||||
{
|
||||
DBG("modem: %p", modem);
|
||||
}
|
||||
|
||||
/* power up hardware */
|
||||
static int hfp_enable(struct ofono_modem *modem)
|
||||
{
|
||||
DBG("%p", modem);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hfp_disable(struct ofono_modem *modem)
|
||||
{
|
||||
DBG("%p", modem);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void hfp_pre_sim(struct ofono_modem *modem)
|
||||
{
|
||||
DBG("%p", modem);
|
||||
}
|
||||
|
||||
static void hfp_post_sim(struct ofono_modem *modem)
|
||||
{
|
||||
DBG("%p", modem);
|
||||
}
|
||||
|
||||
static struct ofono_modem_driver hfp_driver = {
|
||||
.name = "hfp",
|
||||
.modem_type = OFONO_MODEM_TYPE_HFP,
|
||||
.probe = hfp_probe,
|
||||
.remove = hfp_remove,
|
||||
.enable = hfp_enable,
|
||||
.disable = hfp_disable,
|
||||
.pre_sim = hfp_pre_sim,
|
||||
.post_sim = hfp_post_sim,
|
||||
};
|
||||
|
||||
static int hfp_init(void)
|
||||
{
|
||||
DBusConnection *conn = ofono_dbus_get_connection();
|
||||
int err;
|
||||
|
||||
if (DBUS_TYPE_UNIX_FD < 0)
|
||||
return -EBADF;
|
||||
|
||||
err = ofono_modem_driver_register(&hfp_driver);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
err = bluetooth_register_profile(conn, HFP_HS_UUID, "hfp_hf",
|
||||
HFP_EXT_PROFILE_PATH);
|
||||
if (err < 0) {
|
||||
ofono_modem_driver_unregister(&hfp_driver);
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void hfp_exit(void)
|
||||
{
|
||||
DBusConnection *conn = ofono_dbus_get_connection();
|
||||
|
||||
bluetooth_unregister_profile(conn, HFP_EXT_PROFILE_PATH);
|
||||
ofono_modem_driver_unregister(&hfp_driver);
|
||||
}
|
||||
|
||||
OFONO_PLUGIN_DEFINE(hfp_bluez5, "External Hands-Free Profile Plugin", VERSION,
|
||||
|
|
Loading…
Reference in New Issue