+#ifdef TIZEN_FEATURE_BT_HPS
+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();
+ if (!hps_gproxy) {
+ BT_DBG("Couldn't get service proxy");
+ return -1;
+ }
+
+ variant = g_dbus_proxy_call_sync(hps_gproxy, "enable",
+ 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);
+ }
+ return 0;
+}
+
+int _bt_core_stop_httpproxy(void)
+{
+ GVariant *variant = NULL;
+ unsigned char enabled;
+ GError *err = NULL;
+ BT_DBG(" ");
+
+ hps_gproxy = _bt_core_gdbus_get_hps_proxy();
+ if (!hps_gproxy) {
+ BT_DBG("Couldn't get service proxy");
+ return -1;
+ }
+
+ variant = g_dbus_proxy_call_sync(hps_gproxy, "disable",
+ 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);
+ }
+ return 0;
+}
+
+static GDBusProxy *_bt_core_gdbus_init_hps_proxy(void)
+{
+ GDBusProxy *proxy;
+ GError *err = NULL;
+ GDBusConnection *conn;
+
+ BT_DBG(" ");
+
+ conn = _bt_core_get_gdbus_connection();
+ if (!conn)
+ return NULL;
+
+ proxy = g_dbus_proxy_new_sync(conn,
+ G_DBUS_PROXY_FLAGS_NONE, NULL,
+ BT_HPS_SERVICE_NAME,
+ BT_HPS_OBJECT_PATH,
+ BT_HPS_INTERFACE_NAME,
+ NULL, &err);
+ if (proxy == NULL) {
+ if (err) {
+ BT_ERR("Unable to create proxy: %s", err->message);
+ g_clear_error(&err);
+ }
+ return NULL;
+ }
+
+ hps_gproxy = proxy;
+
+ return proxy;
+}
+
+GDBusProxy *_bt_core_gdbus_get_hps_proxy(void)
+{
+ return (hps_gproxy) ? hps_gproxy : _bt_core_gdbus_init_hps_proxy();
+}
+#endif
+
+#ifdef TIZEN_FEATURE_BT_OTP
+static GDBusProxy *_bt_core_gdbus_init_otp_proxy(void)
+{
+ GDBusProxy *proxy;
+ GError *err = NULL;
+ GDBusConnection *conn;
+
+ BT_DBG(" ");
+
+ conn = _bt_core_get_gdbus_connection();
+ if (!conn)
+ return NULL;
+
+ proxy = g_dbus_proxy_new_sync(conn,
+ G_DBUS_PROXY_FLAGS_NONE, NULL,
+ BT_OTP_SERVICE_NAME,
+ BT_OTP_OBJECT_PATH,
+ BT_OTP_INTERFACE_NAME,
+ NULL, &err);
+ if (proxy == NULL) {
+ if (err) {
+ BT_ERR("Unable to create proxy: %s", err->message);
+ g_clear_error(&err);
+ }
+ return NULL;
+ }
+
+ otp_gproxy = proxy;
+
+ return proxy;
+}
+
+GDBusProxy *_bt_core_gdbus_get_otp_proxy(void)
+{
+ return (otp_gproxy) ? otp_gproxy : _bt_core_gdbus_init_otp_proxy();
+}
+
+int _bt_core_stop_otp(void)
+{
+ GVariant *variant = NULL;
+ unsigned char enabled;
+ GError *err = NULL;
+ BT_DBG(" ");
+
+ otp_gproxy = _bt_core_gdbus_get_otp_proxy();
+ if (!otp_gproxy) {
+ BT_DBG("Couldn't get service proxy");
+ return -1;
+ }
+
+ variant = g_dbus_proxy_call_sync(otp_gproxy, "disable",
+ 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("OTP disabled status 0x%x", enabled);
+ }
+ return 0;
+}
+#endif