projects
/
platform
/
core
/
connectivity
/
bluetooth-frwk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Adjust the event generation timing for BT enabled / disabled
[platform/core/connectivity/bluetooth-frwk.git]
/
bt-core
/
bt-core-dbus-handler.c
diff --git
a/bt-core/bt-core-dbus-handler.c
b/bt-core/bt-core-dbus-handler.c
index
50c5822
..
5eb2894
100755
(executable)
--- a/
bt-core/bt-core-dbus-handler.c
+++ b/
bt-core/bt-core-dbus-handler.c
@@
-29,7
+29,7
@@
#define BT_SERVICE_NAME "org.projectx.bt"
#define BT_SERVICE_PATH "/org/projectx/bt_service"
#define BT_SERVICE_NAME "org.projectx.bt"
#define BT_SERVICE_PATH "/org/projectx/bt_service"
-#ifdef
HPS_FEATURE
+#ifdef
TIZEN_FEATURE_BT_HPS
#define BT_HPS_SERVICE_NAME "org.projectx.httpproxy"
#define BT_HPS_OBJECT_PATH "/org/projectx/httpproxy"
#define BT_HPS_INTERFACE_NAME "org.projectx.httpproxy_service"
#define BT_HPS_SERVICE_NAME "org.projectx.httpproxy"
#define BT_HPS_OBJECT_PATH "/org/projectx/httpproxy"
#define BT_HPS_INTERFACE_NAME "org.projectx.httpproxy_service"
@@
-37,7
+37,7
@@
static GDBusConnection *service_gconn;
static GDBusProxy *service_gproxy;
static GDBusConnection *service_gconn;
static GDBusProxy *service_gproxy;
-#ifdef
HPS_FEATURE
+#ifdef
TIZEN_FEATURE_BT_HPS
static GDBusProxy *hps_gproxy;
#endif
static GDBusProxy *hps_gproxy;
#endif
@@
-79,8
+79,6
@@
static GDBusProxy *__bt_core_gdbus_init_service_proxy(void)
GError *err = NULL;
GDBusConnection *conn;
GError *err = NULL;
GDBusConnection *conn;
- g_type_init();
-
conn = _bt_core_get_gdbus_connection();
if (!conn)
return NULL;
conn = _bt_core_get_gdbus_connection();
if (!conn)
return NULL;
@@
-110,12
+108,12
@@
GDBusProxy *_bt_core_gdbus_get_service_proxy(void)
return (service_gproxy) ? service_gproxy : __bt_core_gdbus_init_service_proxy();
}
return (service_gproxy) ? service_gproxy : __bt_core_gdbus_init_service_proxy();
}
-#ifdef
HPS_FEATURE
+#ifdef
TIZEN_FEATURE_BT_HPS
int _bt_core_start_httpproxy(void)
{
GVariant *variant = NULL;
unsigned char enabled;
int _bt_core_start_httpproxy(void)
{
GVariant *variant = NULL;
unsigned char enabled;
-
+ GError *err = NULL;
BT_DBG(" ");
hps_gproxy = _bt_core_gdbus_get_hps_proxy();
BT_DBG(" ");
hps_gproxy = _bt_core_gdbus_get_hps_proxy();
@@
-125,7
+123,11
@@
int _bt_core_start_httpproxy(void)
}
variant = g_dbus_proxy_call_sync(hps_gproxy, "enable",
}
variant = g_dbus_proxy_call_sync(hps_gproxy, "enable",
- NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &err);
+ if (err) {
+ BT_ERR("Error : %s" , err->message);
+ g_clear_error(&err);
+ }
if (variant) {
g_variant_get(variant, "(y)", &enabled);
BT_ERR("HPS enabled status 0x%x", enabled);
if (variant) {
g_variant_get(variant, "(y)", &enabled);
BT_ERR("HPS enabled status 0x%x", enabled);
@@
-137,7
+139,7
@@
int _bt_core_stop_httpproxy(void)
{
GVariant *variant = NULL;
unsigned char enabled;
{
GVariant *variant = NULL;
unsigned char enabled;
-
+ GError *err = NULL;
BT_DBG(" ");
hps_gproxy = _bt_core_gdbus_get_hps_proxy();
BT_DBG(" ");
hps_gproxy = _bt_core_gdbus_get_hps_proxy();
@@
-147,7
+149,11
@@
int _bt_core_stop_httpproxy(void)
}
variant = g_dbus_proxy_call_sync(hps_gproxy, "disable",
}
variant = g_dbus_proxy_call_sync(hps_gproxy, "disable",
- NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &err);
+ if (err) {
+ BT_ERR("Error : %s" , err->message);
+ g_clear_error(&err);
+ }
if (variant) {
g_variant_get(variant, "(y)", &enabled);
BT_ERR("HPS disabled status 0x%x", enabled);
if (variant) {
g_variant_get(variant, "(y)", &enabled);
BT_ERR("HPS disabled status 0x%x", enabled);
@@
-161,8
+167,6
@@
static GDBusProxy *_bt_core_gdbus_init_hps_proxy(void)
GError *err = NULL;
GDBusConnection *conn;
GError *err = NULL;
GDBusConnection *conn;
- g_type_init();
-
BT_DBG(" ");
conn = _bt_core_get_gdbus_connection();
BT_DBG(" ");
conn = _bt_core_get_gdbus_connection();
@@
-203,7
+207,7
@@
void _bt_core_gdbus_deinit_proxys(void)
service_gproxy = NULL;
}
service_gproxy = NULL;
}
-#ifdef
HPS_FEATURE
+#ifdef
TIZEN_FEATURE_BT_HPS
if (hps_gproxy) {
g_object_unref(hps_gproxy);
hps_gproxy = NULL;
if (hps_gproxy) {
g_object_unref(hps_gproxy);
hps_gproxy = NULL;
@@
-222,7
+226,7
@@
int _bt_core_service_request(int service_type, int service_function,
GArray **out_param1)
{
GDBusProxy *proxy;
GArray **out_param1)
{
GDBusProxy *proxy;
- GVariant *ret;
+ GVariant *ret
= NULL
;
GVariant *param1;
GVariant *param2;
GVariant *param3;
GVariant *param1;
GVariant *param2;
GVariant *param3;
@@
-328,6
+332,9
@@
static const gchar bt_core_introspection_xml[] =
" </method>"
" <method name='EnableCore'>"
" </method>"
" </method>"
" <method name='EnableCore'>"
" </method>"
+" <method name='SetTransferValue'>"
+" <arg type='b' name='value' direction='in'/>"
+" </method>"
" <method name='FactoryTestMode'>"
" <arg type='s' name='type' direction='in'/>"
" <arg type='s' name='arg' direction='in'/>"
" <method name='FactoryTestMode'>"
" <arg type='s' name='type' direction='in'/>"
" <arg type='s' name='arg' direction='in'/>"
@@
-365,6
+372,13
@@
static void __bt_core_dbus_method(GDBusConnection *connection,
ret = _bt_core_disable_adapter_le();
} else if (g_strcmp0(method_name, "EnableCore") == 0) {
ret = _bt_core_enable_core();
ret = _bt_core_disable_adapter_le();
} else if (g_strcmp0(method_name, "EnableCore") == 0) {
ret = _bt_core_enable_core();
+ } else if (g_strcmp0(method_name, "SetTransferValue") == 0) {
+ gboolean value = FALSE;
+
+ g_variant_get(parameters, "(b)", &value);
+ BT_DBG("Transfer value: %d", value);
+
+ ret = _bt_core_set_transfer_value(value);
} else if (g_strcmp0(method_name, "FactoryTestMode") == 0) {
const char *type = NULL;
const char *arg = NULL;
} else if (g_strcmp0(method_name, "FactoryTestMode") == 0) {
const char *type = NULL;
const char *arg = NULL;
@@
-373,6
+387,7
@@
static void __bt_core_dbus_method(GDBusConnection *connection,
ret = _bt_core_factory_test_mode(type, arg);
g_dbus_method_invocation_return_value(invocation,
g_variant_new("(i)", ret));
ret = _bt_core_factory_test_mode(type, arg);
g_dbus_method_invocation_return_value(invocation,
g_variant_new("(i)", ret));
+ _bt_core_terminate();
return;
} else {
ret = FALSE;
return;
} else {
ret = FALSE;
@@
-471,9
+486,9
@@
static void __bt_core_event_filter(GDBusConnection *connection,
g_variant_get(parameters, "(&o@a{sa{sv}})",
&obj_path, &optional_param);
g_variant_get(parameters, "(&o@a{sa{sv}})",
&obj_path, &optional_param);
- if (g_strcmp0(obj_path, "/org/bluez/hci0") == 0)
{
+ if (g_strcmp0(obj_path, "/org/bluez/hci0") == 0)
_bt_core_adapter_added_cb();
_bt_core_adapter_added_cb();
- }
+
} else if (!g_strcmp0(signal_name, "InterfacesRemoved")) {
char *obj_path = NULL;
GVariant *optional_param;
} else if (!g_strcmp0(signal_name, "InterfacesRemoved")) {
char *obj_path = NULL;
GVariant *optional_param;
@@
-481,9
+496,9
@@
static void __bt_core_event_filter(GDBusConnection *connection,
g_variant_get(parameters, "(&o@as)", &obj_path,
&optional_param);
g_variant_get(parameters, "(&o@as)", &obj_path,
&optional_param);
- if (g_strcmp0(obj_path, "/org/bluez/hci0") == 0)
{
+ if (g_strcmp0(obj_path, "/org/bluez/hci0") == 0)
_bt_core_adapter_removed_cb();
_bt_core_adapter_removed_cb();
- }
+
} else { /* NameOwnerChanged */
const char *name = NULL;
const char *old_owner = NULL;
} else { /* NameOwnerChanged */
const char *name = NULL;
const char *old_owner = NULL;
@@
-528,6
+543,7
@@
gboolean _bt_core_register_dbus(void)
node_info->interfaces[0],
&method_table,
NULL, NULL, &error);
node_info->interfaces[0],
&method_table,
NULL, NULL, &error);
+ g_dbus_node_info_unref(node_info);
if (obj_id == 0) {
BT_ERR("Failed to register: %s", error->message);
g_error_free(error);
if (obj_id == 0) {
BT_ERR("Failed to register: %s", error->message);
g_error_free(error);