summaryrefslogtreecommitdiffstats
path: root/binding-bluetooth
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2018-10-30 19:41:53 -0700
committerMatt Ranostay <matt.ranostay@konsulko.com>2018-11-23 08:49:14 -0800
commitfb433aa5407795e864c2ff638d9e3d85fb6c297b (patch)
tree1224fed6864778137b12f51e9af9a7f7660695bd /binding-bluetooth
parentbc1fe8673e46f073e31bed137e532e380fcfd85f (diff)
binding: bluetooth: initial commit of binding rewrite
Bug-AGL: SPEC-1630 Change-Id: I33cfec70283fa29f47b76f9e6be3e8e6cd6a2f54 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'binding-bluetooth')
-rw-r--r--binding-bluetooth/CMakeLists.txt46
-rw-r--r--binding-bluetooth/bluetooth-agent.c755
-rw-r--r--binding-bluetooth/bluetooth-agent.h67
-rw-r--r--binding-bluetooth/bluetooth-api.c908
-rw-r--r--binding-bluetooth/bluetooth-api.h61
-rw-r--r--binding-bluetooth/bluetooth-manager.c2017
-rw-r--r--binding-bluetooth/bluetooth-manager.h200
-rw-r--r--binding-bluetooth/bluez-client.c966
-rw-r--r--binding-bluetooth/bluez-client.h76
-rw-r--r--binding-bluetooth/lib_agent.c2504
-rw-r--r--binding-bluetooth/lib_agent.h409
-rw-r--r--binding-bluetooth/lib_bluez.c630
-rw-r--r--binding-bluetooth/lib_bluez.h170
13 files changed, 0 insertions, 8809 deletions
diff --git a/binding-bluetooth/CMakeLists.txt b/binding-bluetooth/CMakeLists.txt
deleted file mode 100644
index a9abca9..0000000
--- a/binding-bluetooth/CMakeLists.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-###########################################################################
-# Copyright 2015, 2016, 2017 IoT.bzh
-#
-# author: Fulup Ar Foll <fulup@iot.bzh>
-# contrib: Romain Forlot <romain.forlot@iot.bzh>
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-###########################################################################
-
-# Add target to project dependency list
-PROJECT_TARGET_ADD(bluetooth-binding)
-
- # Define project Targets
- add_library(${TARGET_NAME} MODULE
- bluetooth-api.c
- bluetooth-manager.c
- bluetooth-agent.c
- lib_agent.c
- bluez-client.c
- lib_bluez.c)
-
- # Binder exposes a unique public entry point
- SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
- PREFIX "libafm-"
- LABELS "BINDING"
- LINK_FLAGS ${BINDINGS_LINK_FLAG}
- OUTPUT_NAME ${TARGET_NAME}
- )
-
- # Library dependencies (include updates automatically)
- TARGET_LINK_LIBRARIES(${TARGET_NAME} ${link_libraries})
-
- # installation directory
- INSTALL(TARGETS ${TARGET_NAME}
- LIBRARY DESTINATION ${BINDINGS_INSTALL_DIR})
-
diff --git a/binding-bluetooth/bluetooth-agent.c b/binding-bluetooth/bluetooth-agent.c
deleted file mode 100644
index 3420167..0000000
--- a/binding-bluetooth/bluetooth-agent.c
+++ /dev/null
@@ -1,755 +0,0 @@
-/* Copyright 2016 ALPS ELECTRIC CO., LTD.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <gio/gio.h>
-
-#include "bluetooth-agent.h"
-
-#ifdef AGENT_THREAD
-
-#include <pthread.h>
-
-static GMainLoop *agentLoop = NULL;
-#endif
-
-static GDBusConnection *system_conn = NULL;
-static gboolean agent_registered = FALSE;
-static const char *agent_capability = NULL;
-static Agent_RegisterCallback_t agent_RegisterCallback = { 0 };
-static AGENTOrgBluezAgent1 * agnet_interface = NULL;
-
-static struct Agent_Node *agent_event = NULL;
-
-
-static void agent_event_auto_release(struct Agent_Node *event)
-{
- if (NULL == event ){
- return;
- }
- g_dbus_method_invocation_return_dbus_error (event->invocation,
- ERROR_BLUEZ_REJECT, "");
- g_free(event);
-}
-
-/*
- * Store the agent event
- */
-static void agent_event_new(AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation, int type)
-{
- LOGD("\n");
- if(NULL !=agent_event )
- {
- agent_event_auto_release(agent_event);
- }
- agent_event = g_malloc0(sizeof(struct Agent_Node));
- agent_event->type = type;
- agent_event->object = object;
- agent_event->invocation = invocation;
-
-}
-
-
-/*
- * agent api
- *
- * Methods : void Release()
- * This method gets called when the service daemon
- * unregisters the agent. An agent can use it to do
- * cleanup tasks. There is no need to unregister the
- * agent, because when this method gets called it has
- * already been unregistered.
- */
-static gboolean
-on_handle_Release (AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation,
- gpointer user_data)
-{
- LOGD("\n");
-
- //gboolean ret = FALSE;
-
- if (NULL != agent_RegisterCallback.agent_Release)
- {
- agent_RegisterCallback.agent_Release();
- }
-
- agent_org_bluez_agent1_complete_release(object, invocation);
-
- g_dbus_interface_skeleton_unexport(
- G_DBUS_INTERFACE_SKELETON(agnet_interface));
-
- g_object_unref(agnet_interface);
- agent_registered = FALSE;
-
-#ifdef AGENT_THREAD
- if(agentLoop){
- g_main_loop_quit(agentLoop);
- }
-#endif
-
- return TRUE;
-}
-
-/*
- * agent api
- * Methods : string RequestPinCode(object device)
- *
- * This method gets called when the service daemon
- * needs to get the passkey for an authentication.
- *
- * The return value should be a string of 1-16 characters
- * length. The string can be alphanumeric.
- */
-static gboolean
-on_handle_RequestPinCode (AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation,
- const gchar *device,
- gpointer user_data)
-{
-
- LOGD("device:%s.\n",device);
-
- gboolean ret = FALSE;
- const gchar *error = ERROR_BLUEZ_REJECT;
- gchar *response;
-
- if (NULL != agent_RegisterCallback.agent_RequestPinCode)
- {
- ret = agent_RegisterCallback.agent_RequestPinCode (device,
- &response, &error);
- }
-
- if (TRUE == ret)
- {
- agent_org_bluez_agent1_complete_request_pin_code(object,
- invocation, response);
- g_free(response);
-
- }
- else
- {
- g_dbus_method_invocation_return_dbus_error (invocation, error, "");
- }
-
- return TRUE;
-}
-
-/*
- * agent api
- * Methods : void DisplayPinCode(object device, string pincode)
- *
- * This method gets called when the service daemon
- * needs to display a pincode for an authentication.
- */
-static gboolean
-on_handle_DisplayPinCode (AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation,
- const gchar *device,
- const gchar *pincode,
- gpointer user_data)
-{
-
- LOGD("device:%s,pincode:%s.\n",device, pincode);
-
- gboolean ret = FALSE;
- const gchar *error = ERROR_BLUEZ_REJECT;
-
- if (NULL != agent_RegisterCallback.agent_DisplayPinCode)
- {
- ret = agent_RegisterCallback.agent_DisplayPinCode(device,
- pincode, &error);
- }
-
- if (TRUE == ret)
- {
- agent_org_bluez_agent1_complete_display_pin_code(object, invocation);
- }
- else
- {
- g_dbus_method_invocation_return_dbus_error (invocation, error, "");
- }
-
- return TRUE;
-}
-
-
-/*
- * agent api
- * Methods : uint32 RequestPasskey(object device)
- *
- * This method gets called when the service daemon
- * needs to get the passkey for an authentication.
- *
- * The return value should be a numeric value
- * between 0-999999.
- */
-static gboolean
-on_handle_RequestPasskey (AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation,
- const gchar *device,
- gpointer user_data)
-{
-
- LOGD("device:%s.\n",device);
-
- gboolean ret = FALSE;
- const gchar *error = ERROR_BLUEZ_REJECT;
- guint passkey;
-
- if (NULL != agent_RegisterCallback.agent_RequestPasskey)
- {
- ret = agent_RegisterCallback.agent_RequestPasskey(device,
- &passkey, &error);
- }
-
- if (TRUE == ret)
- {
- agent_org_bluez_agent1_complete_request_passkey(object,
- invocation, passkey);
- }
- else
- {
- g_dbus_method_invocation_return_dbus_error (invocation, error, "");
- }
-
- return TRUE;
-
-}
-
-
-/*
- * agent api
- * Methods : void DisplayPasskey(object device, uint32 passkey, uint16 entered)
- *
- * This method gets called when the service daemon
- * needs to display a passkey for an authentication.
- *
- * The entered parameter indicates the number of already
- * typed keys on the remote side.
- */
-static gboolean
-on_handle_DisplayPasskey (AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation,
- const gchar *device,
- guint passkey,
- guint16 entered,
- gpointer user_data)
-{
-
- LOGD("device:%s,passkey:%d,entered:%d.\n",device, passkey, entered);
-
- //gboolean ret = FALSE;
-
- if (NULL != agent_RegisterCallback.agent_DisplayPasskey)
- {
- agent_RegisterCallback.agent_DisplayPasskey(device, passkey, entered);
- }
-
- agent_org_bluez_agent1_complete_display_passkey(object, invocation);
-
-
- return TRUE;
-
-}
-
-/*
- * agent api
- * Methods : void RequestConfirmation(object device, uint32 passkey)
- *
- * This method gets called when the service daemon
- * needs to confirm a passkey for an authentication.
- *
- * To confirm the value it should return an empty reply
- * or an error in case the passkey is invalid.
- */
-static gboolean
-on_handle_RequestConfirmation (AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation,
- const gchar *device,
- guint passkey,
- gpointer user_data)
-{
- LOGD("device:%s,passkey:%d.\n", device, passkey);
-
- gboolean ret = FALSE;
- const gchar *error = ERROR_BLUEZ_REJECT;
-
- if (NULL != agent_RegisterCallback.agent_RequestConfirmation)
- {
- ret = agent_RegisterCallback.agent_RequestConfirmation(device,
- passkey, &error);
- }
- LOGD("ret %d\n",ret);
- if (TRUE == ret)
- {
- agent_event_new(object, invocation,REQUEST_CONFIRMATION);
- //agent_org_bluez_agent1_complete_request_confirmation(object,
- // invocation);
- }
- else
- {
- g_dbus_method_invocation_return_dbus_error (invocation, error, "");
- }
-
- return TRUE;
-}
-
-/*
- * agent api
- * Methods : void RequestAuthorization(object device)
- *
- * This method gets called to request the user to
- * authorize an incoming pairing attempt which
- * would in other circumstances trigger the just-works
- * model.
- */
-static gboolean
-on_handle_RequestAuthorization (AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation,
- const gchar *device,
- gpointer user_data)
-{
- LOGD("device:%s.\n",device);
-
- gboolean ret = FALSE;
- const gchar *error = ERROR_BLUEZ_REJECT;
-
- if (NULL != agent_RegisterCallback.agent_RequestAuthorization)
- {
- ret = agent_RegisterCallback.agent_RequestAuthorization(device,&error);
- }
-
- if (TRUE == ret)
- {
- agent_org_bluez_agent1_complete_request_authorization(object,
- invocation);
- }
- else
- {
- g_dbus_method_invocation_return_dbus_error (invocation, error, "");
- }
-
- return TRUE;
-}
-
-/*
- * agent api
- * Methods : void AuthorizeService(object device, string uuid)
- *
- * This method gets called when the service daemon
- * needs to authorize a connection/service request.
- */
-static gboolean
-on_handle_AuthorizeService (AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation,
- const gchar *device,
- const gchar *uuid,
- gpointer user_data)
-{
-
- LOGD("device:%s.uuid:%s\n",device,uuid);
-
- gboolean ret = FALSE;
- const gchar *error = ERROR_BLUEZ_REJECT;
-
- if (NULL != agent_RegisterCallback.agent_AuthorizeService)
- {
- ret = agent_RegisterCallback.agent_AuthorizeService(device,
- uuid, &error);
- }
-
- if (TRUE == ret)
- {
- agent_org_bluez_agent1_complete_authorize_service(object, invocation);
- }
- else
- {
- g_dbus_method_invocation_return_dbus_error (invocation, error, "");
- }
-
- return TRUE;
-}
-
-/*
- * agent api
- * Methods : void Cancel()
- *
- * This method gets called to indicate that the agent
- * request failed before a reply was returned.
- */
-static gboolean
-on_handle_Cancel (AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation,
- gpointer user_data)
-{
- LOGD("\n");
-
- if (NULL != agent_RegisterCallback.agent_Cancel)
- {
- agent_RegisterCallback.agent_Cancel();
- }
-
- agent_org_bluez_agent1_complete_cancel(object, invocation);
-
- return TRUE;
-
-}
-
-/*
- * agent init
- * init the dbus and register the agent to bluez
- */
-static int create_and_register_agent(const char *capability)
-{
- GError *error = NULL;
- gboolean ret;
- GVariant *value;
-
- LOGD("%s\n",capability);
-
- if (agent_registered == TRUE) {
- LOGD("Agent is already registered\n");
- return -1;
- }
-
- system_conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
-
- if (error)
- {
- LOGE("errr:%s",error->message);
- g_error_free(error);
-
- return -1;
- }
-
- agent_capability = capability;
-
- agnet_interface = agent_org_bluez_agent1_skeleton_new ();
-
- g_signal_connect (agnet_interface,
- "handle-release",
- G_CALLBACK (on_handle_Release),
- NULL);
-
- g_signal_connect (agnet_interface,
- "handle-request-pin-code",
- G_CALLBACK (on_handle_RequestPinCode),
- NULL);
-
- g_signal_connect (agnet_interface,
- "handle-display-pin-code",
- G_CALLBACK (on_handle_DisplayPinCode),
- NULL);
-
- g_signal_connect (agnet_interface,
- "handle-request-passkey",
- G_CALLBACK (on_handle_RequestPasskey),
- NULL);
-
- g_signal_connect (agnet_interface,
- "handle-display-passkey",
- G_CALLBACK (on_handle_DisplayPasskey),
- NULL);
-
- g_signal_connect (agnet_interface,
- "handle-request-confirmation",
- G_CALLBACK (on_handle_RequestConfirmation),
- NULL);
-
- g_signal_connect (agnet_interface,
- "handle-request-authorization",
- G_CALLBACK (on_handle_RequestAuthorization),
- NULL);
-
- g_signal_connect (agnet_interface,
- "handle-authorize-service",
- G_CALLBACK (on_handle_AuthorizeService),
- NULL);
-
- g_signal_connect (agnet_interface,
- "handle-cancel",
- G_CALLBACK (on_handle_Cancel),
- NULL);
-
- ret = g_dbus_interface_skeleton_export (
- G_DBUS_INTERFACE_SKELETON (agnet_interface),
- system_conn,
- AGENT_PATH,
- &error);
-
- if (FALSE == ret)
- {
- LOGE("errr:%s",error->message);
- g_error_free(error);
- g_object_unref(system_conn);
-
- return -1;
- }
-
- value = g_dbus_connection_call_sync(system_conn, BLUEZ_SERVICE,
- AGENT_PATH, AGENT_MANAGER_INTERFACE,
- "RegisterAgent", g_variant_new("(os)", AGENT_PATH,
- agent_capability),
- NULL, G_DBUS_CALL_FLAGS_NONE, DBUS_REPLY_TIMEOUT,
- NULL, &error);
-
- if (NULL == value) {
- LOGE ("RegisterAgent Err: %s", error->message);
- g_error_free(error);
-
- g_dbus_interface_skeleton_unexport(
- G_DBUS_INTERFACE_SKELETON(agnet_interface));
-
- g_object_unref(system_conn);
- return -1;
- }
-
- g_variant_unref(value);
-
- value = g_dbus_connection_call_sync(system_conn, BLUEZ_SERVICE,
- AGENT_PATH, AGENT_MANAGER_INTERFACE,
- "RequestDefaultAgent", g_variant_new("(o)", AGENT_PATH),
- NULL, G_DBUS_CALL_FLAGS_NONE, DBUS_REPLY_TIMEOUT,
- NULL, &error);
-
- if (NULL == value) {
- LOGE ("RequestDefaultAgent Err: %s", error->message);
- g_error_free(error);
-
- g_dbus_interface_skeleton_unexport(
- G_DBUS_INTERFACE_SKELETON(agnet_interface));
-
- g_object_unref(system_conn);
- return -1;
- }
-
- g_variant_unref(value);
-
- agent_capability = NULL;
-
- agent_registered = TRUE;
-
- return 0;
-}
-
-#ifdef AGENT_THREAD
-/*
- * agent thread function
- */
-static void *agent_event_loop_thread(const char *capability)
-{
-
- agentLoop = g_main_loop_new(NULL, FALSE);
- guint id;
- GError *error = NULL;
- gboolean ret;
-
- ret = create_and_register_agent(capability);
-
- if (0 == ret)
- {
- LOGD("g_main_loop_run\n");
- g_main_loop_run(agentLoop);
-
-
- }
-
- g_main_loop_unref(agentLoop);
- agentLoop = NULL;
- LOGD("exit...\n");
-}
-#endif
-
-
-/* --- PUBLIC FUNCTIONS --- */
-
-
-/*
- * start agent.
- * Returns: 0 - success or other errors
- */
-int agent_register(const char *capability)
-{
- int ret = 0;
- LOGD("\n");
-
- if (agent_registered == TRUE) {
- LOGD("Agent is already registered\n");
- return -1;
- }
-
-#ifdef AGENT_THREAD
- pthread_t thread_id;
- pthread_create(&thread_id, NULL, agent_event_loop_thread, capability);
- pthread_setname_np(thread_id, "agent");
-
-#else
- ret = create_and_register_agent(capability);
-#endif
-
- return ret;
-}
-
-/*
- * stop agent.
- * Returns: 0 - success or other errors
- */
-int stop_agent()
-{
- GError *error = NULL;
- GVariant *value;
-
- LOGD("\n");
-
- if (agent_registered == FALSE) {
- LOGD("No agent is registered\n");
- return -1;
- }
-
- value = g_dbus_connection_call_sync(system_conn, BLUEZ_SERVICE,
- AGENT_PATH, AGENT_MANAGER_INTERFACE,
- "UnregisterAgent", g_variant_new("(o)", AGENT_PATH ),
- NULL, G_DBUS_CALL_FLAGS_NONE, DBUS_REPLY_TIMEOUT,
- NULL, &error);
-
- if (NULL == value) {
- LOGE ("Error UnregisterAgent: %s", error->message);
- g_error_free(error);
-
- return -1;
- }
-
- g_dbus_interface_skeleton_unexport(
- G_DBUS_INTERFACE_SKELETON(agnet_interface));
-
- g_object_unref(agnet_interface);
-
- g_object_unref(system_conn);
-
- agent_registered = FALSE;
-
- memset(&agent_RegisterCallback, 0, sizeof(Agent_RegisterCallback_t));
-
-#ifdef AGENT_THREAD
- if(agentLoop){
- g_main_loop_quit(agentLoop);
- }
-#endif
-
- return 0;
-}
-
-/*
- * Register Agent Callback function
- */
-void agent_API_register(const Agent_RegisterCallback_t* pstRegisterCallback)
-{
- LOGD("\n");
-
- if (NULL != pstRegisterCallback)
- {
- if (NULL != pstRegisterCallback->agent_Release)
- {
- agent_RegisterCallback.agent_Release =
- pstRegisterCallback->agent_Release;
- }
-
- if (NULL != pstRegisterCallback->agent_RequestPinCode)
- {
- agent_RegisterCallback.agent_RequestPinCode =
- pstRegisterCallback->agent_RequestPinCode;
- }
-
- if (NULL != pstRegisterCallback->agent_DisplayPinCode)
- {
- agent_RegisterCallback.agent_DisplayPinCode =
- pstRegisterCallback->agent_DisplayPinCode;
- }
-
- if (NULL != pstRegisterCallback->agent_RequestPasskey)
- {
- agent_RegisterCallback.agent_RequestPasskey =
- pstRegisterCallback->agent_RequestPasskey;
- }
-
- if (NULL != pstRegisterCallback->agent_DisplayPasskey)
- {
- agent_RegisterCallback.agent_DisplayPasskey =
- pstRegisterCallback->agent_DisplayPasskey;
- }
-
- if (NULL != pstRegisterCallback->agent_RequestConfirmation)
- {
- agent_RegisterCallback.agent_RequestConfirmation =
- pstRegisterCallback->agent_RequestConfirmation;
- }
-
- if (NULL != pstRegisterCallback->agent_RequestAuthorization)
- {
- agent_RegisterCallback.agent_RequestAuthorization =
- pstRegisterCallback->agent_RequestAuthorization;
- }
-
- if (NULL != pstRegisterCallback->agent_AuthorizeService)
- {
- agent_RegisterCallback.agent_AuthorizeService =
- pstRegisterCallback->agent_AuthorizeService;
- }
-
- if (NULL != pstRegisterCallback->agent_Cancel)
- {
- agent_RegisterCallback.agent_Cancel =
- pstRegisterCallback->agent_Cancel;
- }
-
- }
-
-}
-
-/*
- * Send the agent event "RequestConfirmation" reply
- */
-int agent_send_confirmation(gboolean confirmation)
-{
- if (NULL == agent_event)
- {
- LOGW("Not agent event");
- return -1;
- }
- LOGD("%d-%d\n", confirmation, agent_event->type);
-
- if (REQUEST_CONFIRMATION != agent_event->type)
- {
- return -1;
- }
-
- if (TRUE == confirmation){
- agent_org_bluez_agent1_complete_request_confirmation(agent_event->object,
- agent_event->invocation);
- }else{
- g_dbus_method_invocation_return_dbus_error (agent_event->invocation,
- ERROR_BLUEZ_REJECT, "");
- }
-
- g_free(agent_event);
- agent_event = NULL;
- return 0;
-}
-/****************************** The End Of File ******************************/
-
diff --git a/binding-bluetooth/bluetooth-agent.h b/binding-bluetooth/bluetooth-agent.h
deleted file mode 100644
index 2b4b78a..0000000
--- a/binding-bluetooth/bluetooth-agent.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Copyright 2016 ALPS ELECTRIC CO., LTD.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-#ifndef BLUETOOTH_AGENT_H
-#define BLUETOOTH_AGENT_H
-
-#include <glib.h>
-#include <gio/gio.h>
-#include <glib-object.h>
-
-#include "lib_agent.h"
-#include "bluetooth-manager.h"
-
-//#define AGENT_THREAD
-#define REQUEST_PINCCODE 1
-#define REQUEST_PASSKEY 2
-#define REQUEST_CONFIRMATION 3
-#define REQUEST_AUTHORIZATION 4
-
-struct Agent_Node
-{
- int type;
- AGENTOrgBluezAgent1 *object;
- GDBusMethodInvocation *invocation;
-};
-
-typedef struct tagAgent_RegisterCallback
-{
- void (*agent_Release)(void);
- gboolean (*agent_RequestPinCode) (const gchar *device, gchar **pincode, const gchar **error);
- gboolean (*agent_DisplayPinCode)(const gchar *device, const gchar *pincode, const gchar **error);
- gboolean (*agent_RequestPasskey)(const gchar *device, guint *passkey, const gchar **error);
- void (*agent_DisplayPasskey)(const gchar *device, guint passkey, guint16 entered);
- gboolean (*agent_RequestConfirmation)(const gchar *device, guint passkey, const gchar **error);
- gboolean (*agent_RequestAuthorization)(const gchar *device, const gchar **error);
- gboolean (*agent_AuthorizeService)(const gchar *device, const gchar *uuid, const gchar **error);
- void (*agent_Cancel)(void);
-}Agent_RegisterCallback_t;
-
-
-
-/* --- PUBLIC FUNCTIONS --- */
-void agent_API_register(const Agent_RegisterCallback_t* pstRegisterCallback);
-
-int agent_register(const char *capability);
-int stop_agent();
-
-int agent_send_confirmation(gboolean confirmation);
-
-#endif /* BLUETOOTH_AGENT_H */
-
-
-/****************************** The End Of File ******************************/
-
diff --git a/binding-bluetooth/bluetooth-api.c b/binding-bluetooth/bluetooth-api.c
deleted file mode 100644
index 41c89bd..0000000
--- a/binding-bluetooth/bluetooth-api.c
+++ /dev/null
@@ -1,908 +0,0 @@
-/* Copyright 2016 ALPS ELECTRIC CO., LTD.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#define _GNU_SOURCE
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <json-c/json.h>
-
-#define AFB_BINDING_VERSION 2
-#include <afb/afb-binding.h>
-
-#include "bluetooth-manager.h"
-#include "bluetooth-agent.h"
-#include "bluetooth-api.h"
-
-struct event
-{
- struct event *next;
- struct afb_event event;
- char name[];
-};
-
-static struct event *events = NULL;
-
-/* searchs the event of name */
-static struct event *event_get(const char *name)
-{
- struct event *e = events;
- while(e && strcmp(e->name, name))
- e = e->next;
- return e;
-}
-
-/* creates the event of name */
-static int event_add(const char *name)
-{
- struct event *e;
-
- /* check valid name */
- e = event_get(name);
- if (e) return -1;
-
- /* creation */
- e = malloc(strlen(name) + sizeof *e + 1);
- if (!e) return -1;
- strcpy(e->name, name);
-
- /* make the event */
- e->event = afb_daemon_make_event(name);
- if (!e->event.closure) { free(e); return -1; }
-
- /* link */
- e->next = events;
- events = e;
- return 0;
-}
-
-static int event_subscribe(struct afb_req request, const char *name)
-{
- struct event *e;
- e = event_get(name);
- return e ? afb_req_subscribe(request, e->event) : -1;
-}
-
-static int event_unsubscribe(struct afb_req request, const char *name)
-{
- struct event *e;
- e = event_get(name);
- return e ? afb_req_unsubscribe(request, e->event) : -1;
-}
-
-static int event_push(struct json_object *args, const char *name)
-{
- struct event *e;
- e = event_get(name);
- return e ? afb_event_push(e->event, json_object_get(args)) : -1;
-}
-
-static json_object *new_json_object_parse_avrcp(struct btd_device *BDdevice, unsigned int filter)
-{
- json_object *jresp = json_object_new_object();
- json_object *jstring = NULL;
-
- if (BD_AVRCP_TITLE & filter)
- {
- if (BDdevice->avrcp_title)
- {
- jstring = json_object_new_string(BDdevice->avrcp_title);
- }
- else
- {
- jstring = json_object_new_string("");
- }
- json_object_object_add(jresp, "Title", jstring);
- }
-
- if (BD_AVRCP_ARTIST & filter)
- {
- if (BDdevice->avrcp_artist)
- {
- jstring = json_object_new_string(BDdevice->avrcp_artist);
- }
- else
- {
- jstring = json_object_new_string("");
- }
- json_object_object_add(jresp, "Artist", jstring);
- }
-
- if (BD_AVRCP_STATUS & filter)
- {
- if (BDdevice->avrcp_status)
- {
- jstring = json_object_new_string(BDdevice->avrcp_status);
- }
- else
- {
- jstring = json_object_new_string("");
- }
- json_object_object_add(jresp, "Status", jstring);
- }
-
- if (BD_AVRCP_DURATION & filter)
- {
- json_object_object_add(jresp, "Duration",
- json_object_new_int(BDdevice->avrcp_duration));
- }
-
- if (BD_AVRCP_POSITION & filter)
- {
- json_object_object_add(jresp, "Position",
- json_object_new_int(BDdevice->avrcp_position));
- }
-
- return jresp;
-}
-
-/* create device json object*/
-static json_object *new_json_object_from_device(struct btd_device *BDdevice, unsigned int filter)
-{
- json_object *jresp = json_object_new_object();
- json_object *jstring = NULL;
-
- if (BD_PATH & filter)
- {
- if (BDdevice->path)
- {
- gchar **str;
-
- jstring = json_object_new_string(BDdevice->path);
- json_object_object_add(jresp, "Path", jstring);
-
- str = g_strsplit(BDdevice->path, "/", 0);
- jstring = json_object_new_string(str[3]);
- g_strfreev(str);
-
- json_object_object_add(jresp, "Adapter", jstring);
- }
- }
-
- if (BD_ADDER & filter)
- {
- if (BDdevice->bdaddr)
- {
- jstring = json_object_new_string(BDdevice->bdaddr);
- }
- else
- {
- jstring = json_object_new_string("");
- }
- json_object_object_add(jresp, "Address", jstring);
- }
-
- if (BD_NAME & filter)
- {
- if (BDdevice->name)
- {
- jstring = json_object_new_string(BDdevice->name);
- }
- else
- {
- jstring = json_object_new_string("");
- }
- json_object_object_add(jresp, "Name", jstring);
- }
-
- if (BD_PAIRED & filter)
- {
- jstring = (TRUE == BDdevice->paired) ?
- json_object_new_string("True"):json_object_new_string("False");
- json_object_object_add(jresp, "Paired", jstring);
- }
-
- if (BD_TRUSTED & filter)
- {
- jstring = (TRUE == BDdevice->trusted) ?
- json_object_new_string("True"):json_object_new_string("False");
- json_object_object_add(jresp, "Trusted", jstring);
- }
-
- if (BD_ACLCONNECTED & filter)
- {
- jstring = (TRUE == BDdevice->connected) ?
- json_object_new_string("True"):json_object_new_string("False");
- json_object_object_add(jresp, "Connected", jstring);
- }
-
- if (BD_AVCONNECTED & filter)
- {
- jstring = (TRUE == BDdevice->avconnected) ?
- json_object_new_string("True"):json_object_new_string("False");
- json_object_object_add(jresp, "AVPConnected", jstring);
-
- if (BDdevice->avconnected)
- {
- jstring = new_json_object_parse_avrcp(BDdevice, filter);
- json_object_object_add(jresp, "Metadata", jstring);
- }
- }
-
- if (BD_TRANSPORT_STATE & filter)
- {
- jstring = BDdevice->transport_state ?
- json_object_new_string(BDdevice->transport_state) :
- json_object_new_string("none");
- json_object_object_add(jresp, "TransportState", jstring);
- }
-
- if (BD_TRANSPORT_VOLUME & filter)
- {
- json_object_object_add(jresp, "TransportVolume",
- json_object_new_int(BDdevice->transport_volume));
- }
-
- if (BD_HFPCONNECTED & filter)
- {
- gpointer found = NULL;
-
- if (BDdevice->connected)
- found = g_list_find_custom(BDdevice->uuids, HFP_UUID, strcmp);
-
- json_object_object_add(jresp, "HFPConnected",
- json_object_new_string(found ? "True": "False"));
- }
-
- if (BD_UUID_PROFILES & filter)
- {
- GList *list = BDdevice->uuids;
-
- if (list)
- {
- json_object *jarray = json_object_new_array();
-
- for (;list;list=list->next)
- {
- jstring = json_object_new_string(list->data);
- json_object_array_add(jarray, jstring);
- }
- json_object_object_add(jresp, "UUIDs", jarray);
- }
- }
-
- return jresp;
-}
-
-/**/
-static void bt_power (struct afb_req request)
-{
- LOGD("\n");
-
- const char *value = afb_req_value (request, "value");
- json_object *jresp = NULL;
- int ret = 0;
-
- jresp = json_object_new_object();
-
- /* no "?value=" parameter : return current state */
- if (!value) {
- gboolean power_value;
- ret = adapter_get_powered(&power_value);
-
- if (0==ret)
- {
-
- setHMIStatus(ACTIVE);
- (TRUE==power_value)?json_object_object_add (jresp, "power", json_object_new_string ("on"))
- : json_object_object_add (jresp, "power", json_object_new_string ("off"));
- }
- else
- {
- afb_req_fail (request, "failed", "Unable to get power status");
- return;
- }
-
- }
-
- /* "?value=" parameter is "1" or "true" */
- else if ( atoi(value) == 1 || !strcasecmp(value, "true") )
- {
- if (adapter_set_powered (TRUE))
- {
- afb_req_fail (request,"failed","no more radio devices available");
- return;
- }
- json_object_object_add (jresp, "power", json_object_new_string ("on"));
- setHMIStatus(ACTIVE);
- }
-
- /* "?value=" parameter is "0" or "false" */
- else if ( atoi(value) == 0 || !strcasecmp(value, "false") )
- {
- if (adapter_set_powered (FALSE))
- {
- afb_req_fail (request, "failed", "Unable to release radio device");
- return;
- }
-
- json_object_object_add (jresp, "power", json_object_new_string("off"));
- setHMIStatus(INACTIVE);
- }
- else
- {
- afb_req_fail (request, "failed", "Invalid value");
- return;
- }
-
- afb_req_success (request, jresp, "Radio - Power set");
-}
-
-/**/
-static void bt_start_discovery (struct afb_req request)
-{
- LOGD("\n");
- int ret = 0;
-
- ret = adapter_start_discovery();
-
- if (ret)
- {
- afb_req_fail (request, "failed", "Unable to start discovery");
- return;
- }
-
- afb_req_success (request, NULL, NULL);
-}
-
-/**/
-static void bt_stop_discovery (struct afb_req request)
-{
- LOGD("\n");
- int ret = 0;
-
- ret = adapter_stop_discovery();
-
- if (ret)
- {
- afb_req_fail (request, "failed", "Unable to stop discovery");
- return;
- }
-
- afb_req_success (request, NULL, NULL);
-}
-
-
-/**/
-static void bt_discovery_result (struct afb_req request)
-{
- LOGD("\n");
- GSList *list = NULL;
- GSList *tmp = NULL;
- //adapter_update_devices();
- list = adapter_get_devices_list();
- if (NULL == list)
- {
- afb_req_fail (request, "failed", "No find devices");
- return;
- }
-
- json_object *jresp = json_object_new_object();
- json_object *my_array = json_object_new_array();
-
- tmp = list;
- for(;tmp;tmp=tmp->next)
- {
- struct btd_device *BDdevice = tmp->data;
- //LOGD("\n%s\t%s\n",BDdevice->bdaddr,BDdevice->name);
-
- unsigned int filter = BD_ADDER|BD_NAME|BD_PATH|BD_PAIRED|BD_ACLCONNECTED|BD_AVCONNECTED|BD_HFPCONNECTED|BD_UUID_PROFILES;
-
- json_object *jresp = new_json_object_from_device(BDdevice, filter);
-
- json_object_array_add(my_array, jresp);
- }
-
- adapter_devices_list_free(list);
-
- json_object_object_add(jresp, "list", my_array);
-
- afb_req_success(request, jresp, "BT - Scan Result is Displayed");
-}
-
-/**/
-static void bt_pair (struct afb_req request)
-{
- LOGD("\n");
-
- const char *value = afb_req_value (request, "value");
- int ret = 0;
-
- if (NULL == value)
- {
- afb_req_fail (request, "failed", "Please Input the Device Address");
- return;
- }
-
- ret = device_pair(value);
- if (0 == ret)
- {
- afb_req_success (request, NULL, NULL);
- }
- else
- {
- afb_req_fail (request, "failed", "Device pairing failed");
- }
-
-}
-
-/**/
-static void bt_cancel_pairing (struct afb_req request)
-{
- LOGD("\n");
-
- const char *value = afb_req_value (request, "value");
- int ret = 0;
-
- if (NULL == value)
- {
- afb_req_fail (request, "failed", "Please Input the Device Address");
- return;
- }
-
- ret = device_cancelPairing(value);
- if (0 == ret)
- {
- afb_req_success (request, NULL, NULL);
- }
- else
- {
- afb_req_fail (request, "failed", "Device cancel pairing failed");
- }
-
-}
-
-/**/
-static void bt_connect (struct afb_req request)
-{
- LOGD("\n");
-
- const char *value = afb_req_value (request, "value");
- const char *uuid = afb_req_value (request, "uuid");
- int ret = 0;
-
- if (NULL == value)
- {
- afb_req_fail (request, "failed", "Please Input the Device Address");
- return;
- }
-
- ret = device_connect(value, uuid);
-
- if (0 == ret)
- {
- json_object *jresp = json_object_new_object();
- json_object *jstring;
-
- jstring = json_object_new_string("connected");
- json_object_object_add(jresp, "Status", jstring);
-
- jstring = json_object_new_string(value);
- json_object_object_add(jresp, "Address", jstring);
-
- if (uuid) {
- jstring = json_object_new_string(uuid);
- json_object_object_add(jresp, "UUID", jstring);
- }
-
- event_push(jresp, "connection");
- afb_req_success (request, NULL, NULL);
- }
- else
- {
- afb_req_fail (request, "failed", "Device connect failed");
- }
-
-}
-
-/**/
-static void bt_disconnect (struct afb_req request)
-{
- LOGD("\n");
-
- const char *value = afb_req_value (request, "value");
- const char *uuid = afb_req_value (request, "uuid");
- int ret = 0;
-
- if (NULL == value)
- {
- afb_req_fail (request, "failed", "Please Input the Device Address");
- return;
- }
-
- ret = device_disconnect(value, uuid);
- if (0 == ret)
- {
- json_object *jresp = json_object_new_object();
- json_object *jstring;
-
- jstring = json_object_new_string("disconnected");
- json_object_object_add(jresp, "Status", jstring);
-
- jstring = json_object_new_string(value);
- json_object_object_add(jresp, "Address", jstring);
-
- if (uuid) {
- jstring = json_object_new_string(uuid);
- json_object_object_add(jresp, "UUID", jstring);
- }
-
- event_push(jresp, "connection");
- afb_req_success (request, NULL, NULL);
- }
- else
- {
- afb_req_fail (request, "failed", "Device disconnect failed");
- }
-
-}
-
-/**/
-static void bt_remove_device (struct afb_req request)
-{
- LOGD("\n");
-
- const char *value = afb_req_value (request, "value");
- int ret = 0;
-
- if (NULL == value)
- {
- afb_req_fail (request, "failed", "Please Input the Device Address");
- return;
- }
-
- ret = adapter_remove_device(value);
- if (0 == ret)
- {
- afb_req_success (request, NULL, NULL);
- }
- else
- {
- afb_req_fail (request, "failed", "Remove Device failed");
- }
-
-}
-
-static void bt_device_priorities_cb (json_object *array, gchar *str)
-{
- json_object_array_add(array, json_object_new_string(str));
-}
-
-static void bt_device_priorities (struct afb_req request)
-{
- json_object *jarray = json_object_new_array();
-
- device_priority_list(&bt_device_priorities_cb, jarray);
-
- afb_req_success(request, jarray, "Display paired device priority");
-}
-
-/**/
-static void bt_set_device_property (struct afb_req request)
-{
- LOGD("\n");
-
- const char *address = afb_req_value (request, "Address");
- const char *property = afb_req_value (request, "Property");
- const char *value = afb_req_value (request, "value");
- int ret = 0;
- GSList *list = NULL;
-
- if (NULL == address || NULL==property || NULL==value)
- {
- afb_req_fail (request, "failed", "Please Check Input Parameter");
- return;
- }
-
- ret = device_set_property(address, property, value);
- if (0 == ret)
- {
- afb_req_success (request, NULL, NULL);
- }
- else
- {
- afb_req_fail (request, "failed", "Device set property failed");
- }
-
-}
-
-/**/
-static void bt_set_property (struct afb_req request)
-{
- LOGD("\n");
-
- const char *property = afb_req_value (request, "Property");
- const char *value = afb_req_value (request, "value");
- int ret = 0;
- gboolean setvalue;
-
-
- if (NULL==property || NULL==value)
- {
- afb_req_fail (request, "failed", "Please Check Input Parameter");
- return;
- }
-
-
- if ( atoi(value) == 1 || !strcasecmp(value, "true") )
- {
- ret = adapter_set_property (property, TRUE);
-
- }
-
- /* "?value=" parameter is "0" or "false" */
- else if ( atoi(value) == 0 || !strcasecmp(value, "false") )
- {
- ret = adapter_set_property (property, FALSE);
- }
- else
- {
- afb_req_fail (request, "failed", "Invalid value");
- return;
- }
-
- if (0 == ret)
- {
- afb_req_success (request, NULL, NULL);
- }
- else
- {
- afb_req_fail (request, "failed", "Bluetooth set property failed");
- }
-
-}
-
-/**/
-static void bt_set_avrcp_controls (struct afb_req request)
-{
- LOGD("\n");
-
- const char *address = afb_req_value (request, "Address");
- const char *value = afb_req_value (request, "value");
- int ret = 0;
- GSList *list = NULL;
-
- if (NULL==value)
- {
- afb_req_fail (request, "failed", "Please Check Input Parameter");
- return;
- }
-
- if (NULL == address)
- {
- list = adapter_get_devices_list();
- if (NULL == list)
- {
- afb_req_fail (request, "failed", "No find devices");
- return;
- }
-
- for (;list;list=list->next)
- {
- struct btd_device *BDdevice = list->data;
- //LOGD("\n%s\t%s\n",BDdevice->bdaddr,BDdevice->name);
- if (BDdevice->avconnected)
- {
- address = BDdevice->bdaddr;
- break;
- }
- }
- }
-
- ret = device_call_avrcp_method(address, value);
- if (0 == ret)
- {
- afb_req_success (request, NULL, NULL);
- }
- else
- {
- afb_req_fail (request, "failed", "Bluetooth set avrcp control failed");
- }
-}
-
-static void subscribe(struct afb_req request)
-{
- const char *name = afb_req_value(request, "value");
-
- if (name == NULL)
- afb_req_fail(request, "failed", "bad arguments");
- else if (0 != event_subscribe(request, name))
- afb_req_fail(request, "failed", "subscription error");
- else
- afb_req_success(request, NULL, NULL);
-}
-
-static void unsubscribe(struct afb_req request)
-{
- const char *name = afb_req_value(request, "value");
-
- if (name == NULL)
- afb_req_fail(request, "failed", "bad arguments");
- else if (0 != event_unsubscribe(request, name))
- afb_req_fail(request, "failed", "unsubscription error");
- else
- afb_req_success(request, NULL, NULL);
-}
-
-/*
- * broadcast new device
- */
-void bt_broadcast_device_added(struct btd_device *BDdevice)
-{
- unsigned int filter = BD_ADDER|BD_NAME|BD_PATH|BD_PAIRED|BD_ACLCONNECTED|BD_AVCONNECTED|BD_HFPCONNECTED|BD_UUID_PROFILES;
- int ret;
- json_object *jresp = new_json_object_from_device(BDdevice, filter);
-
- LOGD("\n");
- ret = event_push(jresp,"device_added");
- LOGD("%d\n",ret);
-}
-
-/*
- * broadcast device removed
- */
-void bt_broadcast_device_removed(struct btd_device *BDdevice)
-{
- unsigned int filter = BD_ADDER|BD_PATH;
- int ret;
- json_object *jresp = new_json_object_from_device(BDdevice, filter);
-
- LOGD("\n");
- ret = event_push(jresp,"device_removed");
- LOGD("%d\n",ret);
-}
-
-
-/*
- * broadcast device updated
- */
-void bt_broadcast_device_properties_change(struct btd_device *BDdevice)
-{
-
- unsigned int filter = BD_ADDER|BD_NAME|BD_PATH|BD_PAIRED|BD_ACLCONNECTED|BD_AVCONNECTED|BD_HFPCONNECTED|BD_AVRCP_TITLE|BD_AVRCP_ARTIST|BD_AVRCP_STATUS|BD_AVRCP_DURATION|BD_AVRCP_POSITION|BD_TRANSPORT_STATE|BD_TRANSPORT_VOLUME|BD_UUID_PROFILES;
-
- int ret;
- json_object *jresp = new_json_object_from_device(BDdevice, filter);
-
- LOGD("\n");
- ret = event_push(jresp,"device_updated");
- LOGD("%d\n",ret);
-}
-
-/*
- * broadcast request confirmation
- */
-gboolean bt_request_confirmation(const gchar *device, guint passkey)
-{
- json_object *jresp = json_object_new_object();
- json_object *jstring = NULL;
- int ret;
-
- jstring = json_object_new_string(device);
- json_object_object_add(jresp, "Address", jstring);
- jstring = json_object_new_int(passkey);
- json_object_object_add(jresp, "Passkey", jstring);
-
- ret = event_push(jresp,"request_confirmation");
-
- LOGD("%d\n",ret);
-
- if (ret >0) {
- return TRUE;
- }else {
- return FALSE;
- }
-
-}
-
-static void bt_send_confirmation(struct afb_req request)
-{
- const char *value = afb_req_value(request, "value");
- int ret;
- gboolean confirmation;
-
- if (!value) {
- afb_req_fail (request, "failed", "Unable to get value status");
- return;
- }
-
- /* "?value=" parameter is "1" or "yes" */
- else if ( atoi(value) == 1 || !strcasecmp(value, "yes") )
- {
- ret = agent_send_confirmation (TRUE);
- }
-
- /* "?value=" parameter is "0" or "no" */
- else if ( atoi(value) == 0 || !strcasecmp(value, "no") )
- {
- ret = agent_send_confirmation (TRUE);
- }
- else
- {
- afb_req_fail (request, "failed", "Invalid value");
- return;
- }
-
- if ( 0==ret) {
- afb_req_success(request, NULL, NULL);
- }else {
- afb_req_success(request, "failed", "fail");
- }
-
-}
-
-/*
- * array of the verbs exported to afb-daemon
- */
-static const struct afb_verb_v2 binding_verbs[]= {
-/* VERB'S NAME FUNCTION TO CALL SHORT DESCRIPTION */
-{ .verb = "power", .callback = bt_power, .info = "Set Bluetooth Power ON or OFF" },
-{ .verb = "start_discovery", .callback = bt_start_discovery, .info = "Start discovery" },
-{ .verb = "stop_discovery", .callback = bt_stop_discovery, .info = "Stop discovery" },
-{ .verb = "discovery_result", .callback = bt_discovery_result, .info = "Get discovery result" },
-{ .verb = "remove_device", .callback = bt_remove_device, .info = "Remove the special device" },
-{ .verb = "pair", .callback = bt_pair, .info = "Pair to special device" },
-{ .verb = "cancel_pair", .callback = bt_cancel_pairing, .info = "Cancel the pairing process" },
-{ .verb = "connect", .callback = bt_connect, .info = "Connect to special device" },
-{ .verb = "disconnect", .callback = bt_disconnect, .info = "Disconnect special device" },
-{ .verb = "device_priorities", .callback = bt_device_priorities, .info = "Get BT paired device priorites" },
-{ .verb = "set_device_property", .callback = bt_set_device_property, .info = "Set special device property" },
-{ .verb = "set_property", .callback = bt_set_property, .info = "Set Bluetooth property" },
-{ .verb = "set_avrcp_controls", .callback = bt_set_avrcp_controls, .info = "Set Bluetooth AVRCP controls" },
-{ .verb = "send_confirmation", .callback = bt_send_confirmation, .info = "Send Confirmation" },
-{ .verb = "subscribe", .callback = subscribe, .info = "subscribes to the event of 'value'"},
-{ .verb = "unsubscribe", .callback = unsubscribe, .info = "unsubscribes to the event of 'value'"},
-
-{ } /* marker for end of the array */
-};
-
-/*
- * activation function for registering the binding called by afb-daemon
- */
-
-static int init()
-{
- Binding_RegisterCallback_t API_Callback;
- API_Callback.binding_device_added = bt_broadcast_device_added;
- API_Callback.binding_device_removed = bt_broadcast_device_removed;
- API_Callback.binding_device_properties_changed = bt_broadcast_device_properties_change;
- API_Callback.binding_request_confirmation = bt_request_confirmation;
- BindingAPIRegister(&API_Callback);
-
- // register binding events
- event_add("connection");
- event_add("request_confirmation");
- event_add("device_added");
- event_add("device_removed");
- event_add("device_updated");
-
- return BluetoothManagerInit();
-}
-
-/*
- * description of the binding for afb-daemon
- */
-const struct afb_binding_v2 afbBindingV2 =
-{
- .specification = "Application Framework Binder - Bluetooth Manager plugin",
- .api = "Bluetooth-Manager",
- .verbs = binding_verbs,
- .init = init,
-};
-
-/***************************** The End Of File ******************************/
-
diff --git a/binding-bluetooth/bluetooth-api.h b/binding-bluetooth/bluetooth-api.h
deleted file mode 100644
index 55a9095..0000000
--- a/binding-bluetooth/bluetooth-api.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Copyright 2016 ALPS ELECTRIC CO., LTD.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-#ifndef BLUETOOTH_API_H
-#define BLUETOOTH_API_H
-
-
-#define LEFT_SHIFT(shift) (0x00000001ul << (shift) )
-
-#define BD_NONE 0x00000000
-#define BD_PATH LEFT_SHIFT(0)
-#define BD_ADDER LEFT_SHIFT(1)
-#define BD_NAME LEFT_SHIFT(2)
-#define BD_ALIAS LEFT_SHIFT(3)
-#define BD_PAIRED LEFT_SHIFT(4)
-#define BD_TRUSTED LEFT_SHIFT(5)
-#define BD_BLOCKED LEFT_SHIFT(6)
-#define BD_ACLCONNECTED LEFT_SHIFT(7)
-#define BD_AVCONNECTED LEFT_SHIFT(8)
-#define BD_HFPCONNECTED LEFT_SHIFT(9)
-#define BD_LEGACYPAIRING LEFT_SHIFT(10)
-#define BD_RSSI LEFT_SHIFT(11)
-#define BD_AVRCP_TITLE LEFT_SHIFT(12)
-#define BD_AVRCP_ARTIST LEFT_SHIFT(13)
-#define BD_AVRCP_STATUS LEFT_SHIFT(14)
-#define BD_AVRCP_DURATION LEFT_SHIFT(15)
-#define BD_AVRCP_POSITION LEFT_SHIFT(16)
-#define BD_TRANSPORT_STATE LEFT_SHIFT(17)
-#define BD_TRANSPORT_VOLUME LEFT_SHIFT(18)
-#define BD_UUID_PROFILES LEFT_SHIFT(19)
-
-
-/* -------------- PLUGIN DEFINITIONS ----------------- */
-
-typedef struct {
- void *bt_server; /* handle to implementation */
- unsigned int index; /* currently selected media file */
-} BtCtxHandleT;
-
-#define HFP_UUID "0000111f-0000-1000-8000-00805f9b34fb"
-
-#endif /* BLUETOOTH_API_H */
-
-
-
-/****************************** The End Of File ******************************/
-
-
diff --git a/binding-bluetooth/bluetooth-manager.c b/binding-bluetooth/bluetooth-manager.c
deleted file mode 100644
index 38e780b..0000000
--- a/binding-bluetooth/bluetooth-manager.c
+++ /dev/null
@@ -1,2017 +0,0 @@
-/* Copyright 2016 ALPS ELECTRIC CO., LTD.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <pthread.h>
-#include <fcntl.h>
-#include <glib.h>
-#include <gio/gio.h>
-#include <glib/gstdio.h>
-#include <glib-object.h>
-#include <syslog.h>
-#include <linux/rfkill.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-
-#include "bluetooth-manager.h"
-#include "bluez-client.h"
-#include "bluetooth-agent.h"
-
-static Client cli = { 0 };
-static Binding_RegisterCallback_t g_RegisterCallback = { 0 };
-static stBluetoothManage BluetoothManage = { 0 };
-static FILE *logfp= NULL;
-
-/* ------ LOCAL FUNCTIONS --------- */
-void BluetoothManage_InitFlag_Set(gboolean value)
-{
- g_mutex_lock(&(BluetoothManage.m));
- BluetoothManage.inited = value;
- g_mutex_unlock(&(BluetoothManage.m));
-}
-
-gboolean BluetoothManage_InitFlag_Get(void)
-{
- gboolean inited;
-
- g_mutex_lock(&(BluetoothManage.m));
- inited = BluetoothManage.inited;
- g_mutex_unlock(&(BluetoothManage.m));
-
- return inited;
-}
-
-void devices_list_lock(void)
-{
- g_mutex_lock(&(BluetoothManage.m));
-}
-
-void devices_list_unlock(void)
-{
- g_mutex_unlock(&(BluetoothManage.m));
-}
-
-gchar *bt_priority_path()
-{
- gchar *path = g_build_filename(g_get_user_config_dir(), "bluetooth", NULL);
- gchar *file;
-
- g_mkdir(path, 0664);
-
- file = g_build_filename(path, "priorities.lst", NULL);
- g_free(path);
-
- return file;
-}
-
-void bt_remove_priority(gchar *bdaddr)
-{
- LOGD("\n");
- FILE *fp;
- GSList *item, *tmp;
- gchar *path;
-
- LOGD("bd_addr: %s\n", bdaddr);
-
- devices_list_lock();
-
- item = g_slist_find_custom(BluetoothManage.priorities, bdaddr, g_strcmp0);
- if (item == NULL)
- {
- devices_list_unlock();
- return;
- }
- g_free(item->data);
- tmp = BluetoothManage.priorities = g_slist_remove_link(BluetoothManage.priorities, item);
-
- path = bt_priority_path();
- fp = g_fopen(path, "w");
- g_free(path);
-
- if (fp == NULL)
- {
- devices_list_unlock();
- return;
- }
-
- while (tmp && tmp->data)
- {
- fputs(tmp->data, fp);
- fputs("\n", fp);
- tmp = tmp->next;
- }
-
- fclose(fp);
-
- devices_list_unlock();
-}
-
-void bt_save_priority(gchar *bdaddr)
-{
- LOGD("\n");
- FILE *fp;
- gchar *path;
-
- LOGD("bd_addr: %s\n", bdaddr);
-
- devices_list_lock();
-
- if (g_slist_find(BluetoothManage.priorities, bdaddr))
- {
- devices_list_unlock();
- return;
- }
-
- path = bt_priority_path();
- fp = g_fopen(path, "a+");
- g_free(path);
-
- if (fp == NULL)
- {
- devices_list_unlock();
- return;
- }
-
- fputs(bdaddr, fp);
- fputs("\n", fp);
- fclose(fp);
-
- BluetoothManage.priorities = g_slist_append(BluetoothManage.priorities, g_strdup(bdaddr));
-
- devices_list_unlock();
-}
-
-GSList *bt_priority_list()
-{
- LOGD("\n");
- FILE *fp;
- GSList *list = NULL;
- gchar *path;
- gchar bdaddr[18];
-
- devices_list_lock();
-
- path = bt_priority_path();
-
- fp = g_fopen(path, "r");
- g_free(path);
-
- if (fp == NULL)
- {
- devices_list_unlock();
- return NULL;
- }
-
- while (fscanf(fp, "%17s\n", &bdaddr) == 1)
- {
- LOGD("Found priority device %s\n", bdaddr);
- list = g_slist_append(list, g_strdup(bdaddr));
- }
-
- devices_list_unlock();
-
- return list;
-}
-
-int device_priority_list(void *(object_cb)(void *, gchar *), void *ptr)
-{
- GSList *tmp;
-
- devices_list_lock();
-
- tmp = BluetoothManage.priorities;
-
- while (tmp)
- {
- object_cb(ptr, tmp->data);
- tmp = tmp->next;
- }
-
- devices_list_unlock();
-
- return 0;
-}
-
-static int device_path_cmp(struct btd_device * device, const gchar* pPath )
-{
- return !g_str_has_prefix (pPath, device->path);
-}
-
-/*
- * search device by path
- * Returns the first found btd_device or NULL if it is not found
- */
-struct btd_device *devices_list_find_device_by_path(const gchar* pPath)
-{
- GSList * temp;
-
- temp = g_slist_find_custom (BluetoothManage.device, pPath,
- (GCompareFunc)device_path_cmp);
-
- if (temp) {
- return temp->data;
- }
-
- return NULL;
-
-}
-
-
-static int device_bdaddr_cmp(struct btd_device * device, const gchar* pBDaddr )
-{
- return g_strcmp0 (device->bdaddr, pBDaddr);
-}
-
-/*
- * search device by path
- * Returns the first found btd_device or NULL if it is not found
- */
-struct btd_device *devices_list_find_device_by_bdaddr(const gchar* pBDaddr)
-{
- GSList * temp;
-
- temp = g_slist_find_custom (BluetoothManage.device, pBDaddr,
- (GCompareFunc)device_bdaddr_cmp);
-
- if (temp) {
- return temp->data;
- }
-
- return NULL;
-
-}
-
-
-/*
- * make a copy of each element
- * And, to entirely free the new btd_device, you could do: device_free
- */
-struct btd_device *device_copy(struct btd_device* device)
-{
- struct btd_device * temp;
-
- if (NULL == device) {
- return NULL;
- }
-
- temp = g_malloc0(sizeof(struct btd_device));
- temp->path = g_strdup(device->path);
- temp->bdaddr = g_strdup(device->bdaddr);
- temp->name = g_strdup(device->name);
- temp->paired = device->paired;
- temp->trusted = device->trusted;
- temp->connected = device->connected;
- temp->avconnected = device->avconnected;
- temp->hfpconnected = device->hfpconnected;
- temp->uuids = g_list_copy_deep(device->uuids, g_strdup, NULL);
-
- return temp;
-}
-
-/*
- * Frees all of the memory
- */
-void device_free(struct btd_device* device)
-{
-
- if (NULL == device) {
- return ;
- }
- D_PRINTF("device %p\n",device);
- if (device->path) {
- D_PRINTF("path:%s\n",device->path);
- g_free(device->path);
- device->path = NULL;
- }
- if (device->bdaddr) {
- D_PRINTF("bdaddr:%s\n",device->bdaddr);
- g_free(device->bdaddr);
- device->bdaddr = NULL;
- }
- if (device->name) {
- D_PRINTF("name:%s\n",device->name);
- g_free(device->name);
- device->name = NULL;
- }
-
- if (device->avrcp_title) {
- D_PRINTF("avrcp_title:%s\n",device->avrcp_title);
- g_free(device->avrcp_title);
- device->avrcp_title = NULL;
- }
-
- if (device->avrcp_artist) {
- D_PRINTF("avrcp_artist:%s\n",device->avrcp_artist);
- g_free(device->avrcp_artist);
- device->avrcp_artist = NULL;
- }
-
- if (device->avrcp_status) {
- D_PRINTF("avrcp_status:%s\n",device->avrcp_status);
- g_free(device->avrcp_status);
- device->avrcp_status = NULL;
- }
-
- if (device->transport_state) {
- D_PRINTF("transport_state:%s\n",device->transport_state);
- g_free(device->transport_state);
- device->transport_state = NULL;
- }
-
- if (device->uuids) {
- D_PRINTF("uuids: xxx\n");
- g_list_free_full(device->uuids, g_free);
- device->uuids = NULL;
- }
-
- g_free(device);
-}
-
-void device_print(struct btd_device *BDdevice)
-{
- g_print("device %p\n",BDdevice);
- g_print("bdaddr\t\t:%s\n",BDdevice->bdaddr);
- g_print("name\t\t:%s\n",BDdevice->name);
- g_print("trusted\t\t:%d\n",BDdevice->trusted);
- g_print("paired\t\t:%d\n",BDdevice->paired);
-
- g_print("connected\t:%d\n",BDdevice->connected);
- g_print("AVPconnected\t:%d\n",BDdevice->avconnected);
- g_print("HFPconnected\t:%d\n",BDdevice->hfpconnected);
-}
-
-/*
- * remove all the devices
- */
-void devices_list_cleanup()
-{
- LOGD("\n");
- GSList * temp = BluetoothManage.device;
- while (temp) {
- struct btd_device *BDdevice = temp->data;
- temp = temp->next;
-
- BluetoothManage.device = g_slist_remove_all(BluetoothManage.device,
- BDdevice);
-
- device_free(BDdevice);
- }
-}
-
-/*
- * Print all the devices
- */
-void devices_list_print()
-{
- LOGD("\n");
- GSList * temp = BluetoothManage.device;
- while (temp) {
- struct btd_device *BDdevice = temp->data;
- temp = temp->next;
- g_print("----------------------------------------\n");
- device_print(BDdevice);
- }
- g_print("----------------------------------------\n");
-}
-
-/*
- * update device from Interfcace org.bluez.MediaControl1 properties
- */
-static int device_update_from_MediaControl1(struct btd_device *device,
- GVariant *value)
-{
- GVariantIter iter;
- const gchar *key;
- GVariant *subValue;
-
- if ((NULL==device) || (NULL==value))
- {
- return -1;
- }
-
- g_variant_iter_init (&iter, value);
- while (g_variant_iter_next (&iter, "{&sv}", &key, &subValue))
- {
- //gchar *s = g_variant_print (subValue, TRUE);
- //g_print (" %s -> %s\n", key, s);
- //g_free (s);
-
- gboolean value_b = FALSE;//b gboolean
- //gchar value_c = 0;
- //guchar value_y = 0;//y guchar
- //gint16 value_n = 0;//n gint16
- //guint16 value_q = 0;//q guint16
- //gint32 value_i = 0;//i gint32
- //guint32 value_u = 0;//u guint32
- //gint64 value_x = 0;//x gint64
- //guint64 value_t = 0;//t guint64
- //gint32 value_h = 0;//h gint32
- //gdouble value_d = 0.0;//d gdouble
- gchar *str;//d gdouble
-
- if (0==g_strcmp0(key,"Connected")) {
- g_variant_get(subValue, "b", &value_b );
- D_PRINTF("Connected %d\n",value_b);
- device->avconnected = value_b;
- }else if (0==g_strcmp0(key,"Player")) {
- g_variant_get(subValue, "o", &str );
- D_PRINTF("Player Object %s\n",str);
- }
- }
-
- return 0;
-}
-
-/*
- * update device from Interface org.bluez.MediaTransport1 properties
- */
-static int device_update_from_MediaTransport1(struct btd_device *device,
- GVariant *value)
-{
- GVariantIter iter;
- const gchar *key;
- GVariant *subValue;
-
- if ((NULL==device) || (NULL==value))
- {
- return -1;
- }
-
- g_variant_iter_init (&iter, value);
- while (g_variant_iter_next (&iter, "{&sv}", &key, &subValue))
- {
- //gchar *s = g_variant_print (subValue, TRUE);
- //g_print (" %s -> %s\n", key, s);
- //g_free (s);
-
- //gboolean value_b = FALSE;//b gboolean
- //gchar value_c = 0;
- //guchar value_y = 0;//y guchar
- //gint16 value_n = 0;//n gint16
- guint16 value_q = 0;//q guint16
- //gint32 value_i = 0;//i gint32
- //guint32 value_u = 0;//u guint32
- //gint64 value_x = 0;//x gint64
- //guint64 value_t = 0;//t guint64
- //gint32 value_h = 0;//h gint32
- //gdouble value_d = 0.0;//d gdouble
- gchar *str;//d gdouble
-
- if (0==g_strcmp0(key,"State")) {
- g_variant_get(subValue, "s", &str);
- D_PRINTF("State %s\n", str);
- if (device->transport_state)
- free(device->transport_state);
- device->transport_state = g_strdup(str);
- } else if (0==g_strcmp0(key,"Volume")) {
- g_variant_get(subValue, "q", &value_q);
- D_PRINTF("Volume %d\n", value_q);
- device->transport_volume = value_q;
- }
- }
-
- return 0;
-}
-
-
-static int device_update_from_Track(struct btd_device *device,
- GVariant *value)
-{
- GVariantIter iter;
- const gchar *key;
- GVariant *subValue;
-
- if ((NULL==device) || (NULL==value))
- {
- return -1;
- }
-
- g_variant_iter_init (&iter, value);
- while (g_variant_iter_next (&iter, "{&sv}", &key, &subValue))
- {
- //gchar *s = g_variant_print (subValue, TRUE);
- //g_print (" %s -> %s\n", key, s);
- //g_free (s);
-
- gboolean value_b = FALSE;//b gboolean
- //gchar value_c = 0;
- //guchar value_y = 0;//y guchar
- //gint16 value_n = 0;//n gint16
- //guint16 value_q = 0;//q guint16
- //gint32 value_i = 0;//i gint32
- guint32 value_u = 0;//u guint32
- //gint64 value_x = 0;//x gint64
- //guint64 value_t = 0;//t guint64
- //gint32 value_h = 0;//h gint32
- //gdouble value_d = 0.0;//d gdouble
- gchar *str;//d gdouble
-
- if (0==g_strcmp0(key,"Title")) {
- g_variant_get(subValue, "s", &str);
- D_PRINTF("Title %s\n", str);
- if (device->avrcp_title)
- free(device->avrcp_title);
- device->avrcp_title = g_strdup(str);
- } else if (0==g_strcmp0(key,"Artist")) {
- g_variant_get(subValue, "s", &str);
- D_PRINTF("Artist %s\n", str);
- if (device->avrcp_artist)
- free(device->avrcp_artist);
- device->avrcp_artist = g_strdup(str);
- } else if (0==g_strcmp0(key,"Duration")) {
- g_variant_get(subValue, "u", &value_u);
- D_PRINTF("Duration %u\n", value_u);
- device->avrcp_duration = value_u;
- }
- }
-
- return 0;
-}
-
-/*
- * update device from Interface org.bluez.MediaPlayer1 properties
- */
-static int device_update_from_MediaPlayer1(struct btd_device *device,
- GVariant *value)
-{
- GVariantIter iter;
- const gchar *key;
- GVariant *subValue;
-
- if ((NULL==device) || (NULL==value))
- {
- return -1;
- }
-
- g_variant_iter_init (&iter, value);
- while (g_variant_iter_next (&iter, "{&sv}", &key, &subValue))
- {
- //gchar *s = g_variant_print (subValue, TRUE);
- //g_print (" %s -> %s\n", key, s);
- //g_free (s);
-
- gboolean value_b = FALSE;//b gboolean
- //gchar value_c = 0;
- //guchar value_y = 0;//y guchar
- //gint16 value_n = 0;//n gint16
- //guint16 value_q = 0;//q guint16
- //gint32 value_i = 0;//i gint32
- guint32 value_u = 0;//u guint32
- //gint64 value_x = 0;//x gint64
- //guint64 value_t = 0;//t guint64
- //gint32 value_h = 0;//h gint32
- //gdouble value_d = 0.0;//d gdouble
- gchar *str;//d gdouble
-
- if (0==g_strcmp0(key,"Status")) {
- g_variant_get(subValue, "s", &str);
- D_PRINTF("Status %s\n", str);
- if (device->avrcp_status)
- free(device->avrcp_status);
- device->avrcp_status = g_strdup(str);
- } else if (0==g_strcmp0(key,"Position")) {
- g_variant_get(subValue, "u", &value_u);
- D_PRINTF("Position %d\n", value_u);
- device->avrcp_position = value_u;
- } else if (0==g_strcmp0(key,"Track")) {
- device_update_from_Track(device, subValue);
- }
- }
-
- return 0;
-}
-
-/*
- * update device from Interfcace org.bluez.Device1 properties
- */
-static int device_update_from_Device1(struct btd_device *device,
- GVariant *value)
-{
- if ((NULL==device) || (NULL==value))
- {
- return -1;
- }
-
- GVariantIter iter;
- const gchar *key;
- GVariant *subValue;
-
- g_variant_iter_init (&iter, value);
- while (g_variant_iter_next (&iter, "{&sv}", &key, &subValue))
- {
- //gchar *s = g_variant_print (subValue, TRUE);
- //g_print (" %s -> %s\n", key, s);
- //g_free (s);
-
- gboolean value_b = FALSE;//b gboolean
- //gchar value_c = 0;
- //guchar value_y = 0;//y guchar
- //gint16 value_n = 0;//n gint16
- //guint16 value_q = 0;//q guint16
- //gint32 value_i = 0;//i gint32
- //guint32 value_u = 0;//u guint32
- //gint64 value_x = 0;//x gint64
- //guint64 value_t = 0;//t guint64
- //gint32 value_h = 0;//h gint32
- //gdouble value_d = 0.0;//d gdouble
- gchar *str;//d gdouble
-
- if (0==g_strcmp0(key,"Address")) {
- g_variant_get(subValue, "s", &str );
- D_PRINTF("Address %s\n",str);
-
- if (device->bdaddr)
- g_free (device->bdaddr);
-
- device->bdaddr = g_strdup(str);
-
- g_free (str);
- str = NULL;
-
- }else if (0==g_strcmp0(key,"Name")) {
- g_variant_get(subValue, "s", &str );
- D_PRINTF("Name %s\n",str);
-
- if (device->name)
- g_free (device->name);
-
- device->name = g_strdup(str);
-
- g_free (str);
- str = NULL;
-
- }else if (0==g_strcmp0(key,"Paired")) {
- g_variant_get(subValue, "b", &value_b );
- D_PRINTF("Paired %d\n",value_b);
- device->paired = value_b;
- }else if (0==g_strcmp0(key,"Trusted")) {
- g_variant_get(subValue, "b", &value_b );
- D_PRINTF("Trusted %d\n",value_b);
- device->trusted = value_b;
- }else if (0==g_strcmp0(key,"Connected")) {
- g_variant_get(subValue, "b", &value_b );
- D_PRINTF("Connected %d\n",value_b);
- device->connected = value_b;
- }
- }
-
- return 0;
-
-}
-#if 0
-/*
- * update device from Interfcace org.bluez.MediaControl1 properties
- */
-static int bluez_mediacontrol1_properties_update(struct bt_device *device,
- GVariant *value)
-{
- GVariantIter iter;
- const gchar *key;
- GVariant *subValue;
-
- if ((NULL==device) || (NULL==value))
- {
- return -1;
- }
-
- g_variant_iter_init (&iter, value);
- while (g_variant_iter_next (&iter, "{&sv}", &key, &subValue))
- {
- //gchar *s = g_variant_print (subValue, TRUE);
- //g_print (" %s -> %s\n", key, s);
- //g_free (s);
-
- gboolean value_b = FALSE;//b gboolean
- //gchar value_c = 0;
- //guchar value_y = 0;//y guchar
- gint16 value_n = 0;//n gint16
- //guint16 value_q = 0;//q guint16
- //gint32 value_i = 0;//i gint32
- //guint32 value_u = 0;//u guint32
- //gint64 value_x = 0;//x gint64
- //guint64 value_t = 0;//t guint64
- //gint32 value_h = 0;//h gint32
- //gdouble value_d = 0.0;//d gdouble
- gchar *str;//d gdouble
-
- if (0==g_strcmp0(key,"Connected")) {
- g_variant_get(subValue, "b", &value_b );
- D_PRINTF("Connected %d\n",value_b);
- device->avconnected = value_b;
-
- }else if (0==g_strcmp0(key,"Player")) {
- g_variant_get(subValue, "o", &str );
- D_PRINTF("Player Object %s\n",str);
-
- }
- }
-
- return 0;
-
-}
-#endif
-
-/*
- * make a copy of each element
- */
-struct btd_device *device_copy_from_bluez(struct bt_device* device)
-{
- struct btd_device * temp;
-
- if (NULL == device) {
- return NULL;
- }
-
- temp = g_malloc0(sizeof(struct btd_device));
- temp->path = g_strdup(device->path);
- temp->bdaddr = g_strdup(device->bdaddr);
- temp->name = g_strdup(device->name);
- temp->paired = device->paired;
- temp->trusted = device->trusted;
- temp->connected = device->connected;
- temp->avconnected = device->avconnected;
- temp->uuids = g_list_copy_deep(device->uuids, g_strdup, NULL);
-
- return temp;
-}
-
-/*
- * Force Update the device list
- * Call <method>GetManagedObjects
- * Returns: 0 - success or other errors
- */
-int devices_list_update(void)
-{
- LOGD("\n");
-
- GSList* list;
- GSList* tmp;
- list = GetBluezDevicesList();
-
- if (NULL == list)
- {
- return -1;
- }
-
- tmp = list;
-
- devices_list_lock();
-
- devices_list_cleanup();
-
- while(tmp)
- {
- struct bt_device *BDdevice = tmp->data;
- tmp = tmp->next;
-
- struct btd_device * new_device = device_copy_from_bluez(BDdevice);
-
- if (new_device)
- {
- //BluetoothManage.device = g_slist_prepend(BluetoothManage.device, new_device);
- BluetoothManage.device =
- g_slist_append(BluetoothManage.device, new_device);
- }
-
- }
-
- FreeBluezDevicesList(list);
-
- devices_list_unlock();
-
-
- return 0;
-}
-
-
-/*
- * notify::name-owner callback function
- */
-static void bluez_device_added_cb(struct bt_device *device)
-{
- LOGD("\n");
-
- struct btd_device * new_device;
-
- if (NULL == device)
- {
- return;
- }
-
- new_device = device_copy_from_bluez(device);
-
- devices_list_lock();
-
- //BluetoothManage.device = g_slist_prepend(BluetoothManage.device, new_device);
- BluetoothManage.device = g_slist_append(BluetoothManage.device,new_device);
- if (NULL != g_RegisterCallback.binding_device_added)
- {
- g_RegisterCallback.binding_device_added(new_device);
- }
-
- devices_list_unlock();
-
-}
-
-/*
- * object-removed callback function
- */
-static void bluez_device_removed_cb (const gchar *path)
-{
- struct btd_device *device;
-
- LOGD("%s\n",path);
-
- devices_list_lock();
-
- device = devices_list_find_device_by_path(path);
-
- if (device) {
- BluetoothManage.device = g_slist_remove_all(BluetoothManage.device,
- device);
-
- if (NULL != g_RegisterCallback.binding_device_removed)
- {
- g_RegisterCallback.binding_device_removed(device);
- }
-
- device_free(device);
- }
-
- devices_list_unlock();
-
-}
-
-/*
- * BLUEZ interface-proxy-properties-changed callback function
- */
-static void
-bluez_device_properties_changed_cb (const gchar *pObjecPath,
- const gchar *pInterface,
- GVariant *properties)
-{
-
- struct btd_device *device;
-
-#if 0
- gchar *s;
- g_print ("Path:%s, Interface:%s\n",pObjecPath, pInterface);
- g_print ("type '%s'\n", g_variant_get_type_string (properties));
- s = g_variant_print (properties, TRUE);
- g_print (" %s\n", s);
- g_free (s);
-#endif
-
- LOGD("%s\n",pObjecPath);
-
- devices_list_lock();
-
- device = devices_list_find_device_by_path(pObjecPath);
-
- if (0 == g_strcmp0(pInterface, DEVICE_INTERFACE)) {
-
- device_update_from_Device1(device, properties);
-
- } else if (0 == g_strcmp0(pInterface, MEDIA_CONTROL1_INTERFACE)) {
-
- device_update_from_MediaControl1(device, properties);
-
- } else if (0 == g_strcmp0(pInterface, MEDIA_PLAYER1_INTERFACE)) {
-
- device_update_from_MediaPlayer1(device, properties);
-
- } else if (0 == g_strcmp0(pInterface, MEDIA_TRANSPORT1_INTERFACE)) {
-
- device_update_from_MediaTransport1(device, properties);
-
- }
-
- if (g_RegisterCallback.binding_device_properties_changed)
- g_RegisterCallback.binding_device_properties_changed(device);
-
- devices_list_unlock();
-
-}
-
-gboolean agent_requset_confirm( const gchar *device_path,
- guint passkey,
- const gchar **error)
-{
- gboolean ret = FALSE;
-
- const gchar *myerror = ERROR_BLUEZ_REJECT;
-
- LOGD("-%s,%d\n",device_path,passkey);
-
- if (NULL != g_RegisterCallback.binding_request_confirmation)
- {
-
- devices_list_lock();
- struct btd_device *device = devices_list_find_device_by_path(device_path);
- gchar *device_bdaddr = NULL;
-
- if (device)
- {
- device_bdaddr = g_strdup(device->bdaddr);
- }
- devices_list_unlock();
-
- if (device_bdaddr)
- ret = g_RegisterCallback.binding_request_confirmation(device_bdaddr, passkey);
- }
-
- if (TRUE == ret)
- {
- LOGD("return TRUE\n");
- return TRUE;
- }else{
- *error = myerror;
- LOGD("return FALSE\n");
- return FALSE;
- }
-}
-
-
-/*
- * register callback function
- * Returns: 0 - success or other errors
- */
-static int bt_manager_app_init(void)
-{
- GError *error = NULL;
- int ret;
-
- cli.system_conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
- if (error) {
- LOGE("Create System GDBusconnection fail\n");
- LOGE("Error:%s\n", error->message);
- g_error_free(error);
- return -1;
- }
-
- cli.session_conn = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, &error);
- if (error) {
- LOGE("Create Session GDBusconnection fail\n");
- LOGE("Error:%s\n", error->message);
- g_error_free(error);
- g_object_unref(cli.system_conn);
- return -1;
- }
-
- Bluez_RegisterCallback_t Bluez_API_Callback;
- Bluez_API_Callback.device_added = bluez_device_added_cb;
- Bluez_API_Callback.device_removed = bluez_device_removed_cb;
- Bluez_API_Callback.device_properties_changed = bluez_device_properties_changed_cb;
- BluezDeviceAPIRegister(&Bluez_API_Callback);
-
- Agent_RegisterCallback_t AgentRegCallback;
- AgentRegCallback.agent_RequestConfirmation = agent_requset_confirm;
- agent_API_register(&AgentRegCallback);
-
- BluetoothManage.priorities = bt_priority_list();
-
- ret = BluezManagerInit();
- if (0 != ret )
- {
- LOGE("BluezManagerInit fail\n");
- return -1;
- }
-
- ret = agent_register("");
- if (0 != ret )
- {
- LOGE("agent_register fail\n");
-
- BluezManagerQuit();
- return -1;
- }
-
- return 0;
-}
-
-int hci_interface_enable(int hdev)
-{
- int ctl = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
- int ret;
-
- if (ctl < 0)
- return ctl;
-
- ret = ioctl(ctl, HCIDEVUP, hdev);
-
- close(ctl);
-
- return ret;
-}
-
-gboolean bluetooth_rfkill_event(GIOChannel *chan, GIOCondition cond, gpointer data)
-{
- LOGD("\n");
- struct rfkill_event event;
- gchar *name, buf[8];
- int fd, len;
-
- fd = g_io_channel_unix_get_fd(chan);
- len = read(fd, &event, sizeof(struct rfkill_event));
-
- if (len != sizeof(struct rfkill_event))
- return TRUE;
-
- if (event.type != RFKILL_TYPE_BLUETOOTH)
- return TRUE;
-
- if (event.op == RFKILL_OP_DEL)
- return TRUE;
-
- name = g_strdup_printf("/sys/class/rfkill/rfkill%u/soft", event.idx);
-
- fd = g_open(name, O_WRONLY);
- write(fd, "0", 1);
- g_close(fd, NULL);
-
- g_free(name);
-
- memset(&buf, 0, sizeof(buf));
-
- name = g_strdup_printf("/sys/class/rfkill/rfkill%u/name", event.idx);
- fd = g_open(name, O_RDONLY);
- len = read(fd, &buf, sizeof(buf) - 1);
-
- if (len > 0)
- {
- int idx = 0;
- sscanf(buf, "hci%d", &idx);
-
- /*
- * 50 millisecond delay to allow time for rfkill to unblock before
- * attempting to bring up HCI interface
- */
- g_usleep(50000);
-
- LOGD ("Enabling hci%d interface\n", idx);
- hci_interface_enable(idx);
- }
-
- g_free(name);
-
- return TRUE;
-}
-
-
-/* Create RFKILL monitor to soft unblock bluetooth devices
- *
- * Returns: 0 - success or other errors
- */
-int BluetoothMonitorInit()
-{
- int fd = g_open("/dev/rfkill", O_RDWR);
- GIOChannel *chan = NULL;
-
- if (fd < 0)
- {
- LOGE("Cannot open /dev/rfkill");
- return -1;
- }
-
- chan = g_io_channel_unix_new(fd);
- g_io_channel_set_close_on_unref(chan, TRUE);
-
- BluetoothManage.watch = g_io_add_watch(chan, G_IO_IN, bluetooth_rfkill_event, NULL);
-
- g_io_channel_unref(chan);
-
- return 0;
-}
-
-gboolean bt_autoconnect(gpointer ptr)
-{
- LOGD("\n");
- gboolean ret = TRUE;
- GSList *list, *tmp;
-
- devices_list_lock();
-
- list = GetBluezDevicesList();
- tmp = list;
-
- while (tmp)
- {
- struct bt_device *BDdevice = tmp->data;
- tmp = tmp->next;
-
- if (BDdevice->connected)
- {
- g_slist_free_full(list, g_free);
- devices_list_unlock();
- return FALSE;
- }
- }
-
- g_slist_free_full(list, g_free);
- devices_list_unlock();
-
- tmp = BluetoothManage.priorities;
-
- if (tmp == NULL)
- {
- return TRUE;
- }
-
- while (tmp)
- {
- LOGD("Autoconnect to %s\n", tmp->data);
- ret = device_connect(tmp->data, NULL) ? TRUE : FALSE;
- tmp = tmp->next;
-
- if (ret == FALSE)
- {
- setHMIStatus(ACTIVE);
- break;
- }
- }
-
- return ret;
-}
-
-/*
- * Bluetooth Manager Thread
- * register callback function and create a new GMainLoop structure
- */
-static void *bt_event_loop_thread()
-{
- int ret = 0;
-
- cli.clientloop = g_main_loop_new(NULL, FALSE);
-
- ret = bt_manager_app_init();
-
- if (0 == ret){
-
- devices_list_update();
-
- BluetoothManage_InitFlag_Set(TRUE);
- BluetoothMonitorInit();
-
- BluetoothManage.autoconnect = g_timeout_add_seconds(5, bt_autoconnect, NULL);
-
- LOGD("g_main_loop_run\n");
- g_main_loop_run(cli.clientloop);
-
- }
-
- g_main_loop_unref(cli.clientloop);
-
- LOGD("Exit\n");
-}
-
-/*
- * print log message
- */
-void DebugTraceSendMsg(int level, gchar* message)
-{
-
- if (logfp)
- {
- struct timeval tv;
- struct tm tm;
- char s[32] = {0};
-
- gettimeofday(&tv, NULL);
- localtime_r(&tv.tv_sec, &tm);
- strftime(s, sizeof(s), "%Y-%m-%d %H:%M:%S", &tm);
- fprintf(logfp, "[%s.%6.6d] ", s, (int)(tv.tv_usec));
-
- switch (level)
- {
- case DT_LEVEL_ERROR:
- fprintf(logfp,"[E]");
- break;
-
- case DT_LEVEL_WARNING:
- fprintf(logfp,"[W]");
- break;
-
- case DT_LEVEL_NOTICE:
- fprintf(logfp,"[N]");
- break;
-
- case DT_LEVEL_INFO:
- fprintf(logfp,"[I]");
- break;
-
- case DT_LEVEL_DEBUG:
- fprintf(logfp,"[D]");
- break;
-
- default:
- fprintf(logfp,"[-]");
- break;
- }
-
- fprintf(logfp,"%s\n",message);
- fflush(logfp);
- }
-#ifdef LOCAL_PRINT_DEBUG
- switch (level)
- {
- case DT_LEVEL_ERROR:
- g_print("[E]");
- break;
-
- case DT_LEVEL_WARNING:
- g_print("[W]");
- break;
-
- case DT_LEVEL_NOTICE:
- g_print("[N]");
- break;
-
- case DT_LEVEL_INFO:
- g_print("[I]");
- break;
-
- case DT_LEVEL_DEBUG:
- g_print("[D]");
- break;
-
- default:
- g_print("[-]");
- break;
- }
-
- g_print("%s",message);
-#endif
-
- if (message) {
- g_free(message);
- }
-
-}
-
-
-
-/* ------ PUBLIC PLUGIN FUNCTIONS --------- */
-
-/*
- * Set the Bluez Adapter Property "Powered" value
- * If success return 0, else return -1;
- */
-int adapter_set_powered(gboolean powervalue)
-{
- LOGD("value:%d\n",powervalue);
-
- GError *error = NULL;
- GVariant *value;
-
- if (FALSE == BluetoothManage_InitFlag_Get()) {
- LOGD("BluetoothManage Not Init\n");
- return -1;
- }
-
- value = g_dbus_connection_call_sync(cli.system_conn, BLUEZ_SERVICE,
- ADAPTER_PATH, FREEDESKTOP_PROPERTIES,
- "Set", g_variant_new("(ssv)", ADAPTER_INTERFACE,
- "Powered", g_variant_new("b", powervalue)),
- NULL, G_DBUS_CALL_FLAGS_NONE, DBUS_REPLY_TIMEOUT,
- NULL, &error);
-
- if (NULL == value) {
- LOGW ("Error getting object manager client: %s", error->message);
- g_error_free(error);
- return -1;
- }
-
- g_variant_unref(value);
- return 0;
-}
-
-/*
- * Get the Bluez Adapter Property "Powered" value
- * If success return 0, else return -1;
- */
-int adapter_get_powered(gboolean *powervalue) {
- LOGD("\n");
-
- GError *error = NULL;
- GVariant *value = NULL;
- GVariant *subValue = NULL;
-
- if (FALSE == BluetoothManage_InitFlag_Get()) {
- LOGD("BluetoothManage Not Init\n");
- return -1;
- }
-
- if (NULL == powervalue) {
- LOGD("powervalue is NULL\n");
- return -1;
- }
-
- value = g_dbus_connection_call_sync(cli.system_conn, BLUEZ_SERVICE,
- ADAPTER_PATH, FREEDESKTOP_PROPERTIES, "Get",
- g_variant_new("(ss)", ADAPTER_INTERFACE, "Powered"),
- NULL, G_DBUS_CALL_FLAGS_NONE, DBUS_REPLY_TIMEOUT,
- NULL, &error);
-
- if (NULL == value) {
- LOGW ("Error getting object manager client: %s\n", error->message);
- g_error_free(error);
- return -1;
- }
-
- g_variant_get(value, "(v)", &subValue);
- g_variant_get(subValue, "b", powervalue);
- g_variant_unref(subValue);
-
- g_variant_unref(value);
-
- LOGD("get ret :%d\n",*powervalue);
- return 0;
-}
-
-/*
- * Set the Bluez Adapter Property value
- * Only support boolean property now.(Discoverable, Pairable, Powered)
- * If success return 0, else return -1;
- */
-int adapter_set_property(const gchar* property, gboolean setvalue)
-{
- LOGD("property:%s,value:%d\n",property, setvalue);
-
- GError *error = NULL;
- GVariant *value;
-
- if (FALSE == BluetoothManage_InitFlag_Get()) {
- LOGW("BluetoothManage Not Init\n");
- return -1;
- }
-
- if ((0!=g_strcmp0 (property, "Discoverable"))&&
- (0!=g_strcmp0 (property, "Pairable"))&&
- (0!=g_strcmp0 (property, "Powered")))
- {
- LOGD("Invalid value\n");
- return -1;
- }
- value = g_dbus_connection_call_sync(cli.system_conn, BLUEZ_SERVICE,
- ADAPTER_PATH, FREEDESKTOP_PROPERTIES,
- "Set", g_variant_new("(ssv)", ADAPTER_INTERFACE,
- property, g_variant_new("b", setvalue)),
- NULL, G_DBUS_CALL_FLAGS_NONE, DBUS_REPLY_TIMEOUT,
- NULL, &error);
-
- if (NULL == value) {
- LOGW ("Error : %s", error->message);
- g_error_free(error);
- return -1;
- }
-
- g_variant_unref(value);
-
- return 0;
-}
-
-
-/*
- * Call the Bluez Adapter Method "StartDiscovery"
- * If success return 0, else return -1;
- */
-int adapter_start_discovery()
-{
- LOGD("\n");
-
- GError *error = NULL;
- GVariant *value = NULL;
-
- if (FALSE == BluetoothManage_InitFlag_Get()) {
- LOGW("BluetoothManage Not Init\n");
- return -1;
- }
-
- if (BluetoothManage.autoconnect > 0) {
- LOGW("Canceling autoconnection for discovery mode\n");
- g_source_remove(BluetoothManage.autoconnect);
- }
-
- value = g_dbus_connection_call_sync(cli.system_conn, BLUEZ_SERVICE,
- ADAPTER_PATH, ADAPTER_INTERFACE, "StartDiscovery",
- NULL, NULL, G_DBUS_CALL_FLAGS_NONE,
- DBUS_REPLY_TIMEOUT, NULL, &error);
-
- if (NULL == value) {
- LOGW ("Error getting object manager client: %s\n", error->message);
- g_error_free(error);
- return -1;
- }
-
- g_variant_unref(value);
- return 0;
-}
-
-/*
- * Call the Bluez Adapter Method "StopDiscovery"
- * If success return 0, else return -1;
- */
-int adapter_stop_discovery()
-{
- LOGD("\n");
-
- GError *error = NULL;
- GVariant *value = NULL;
-
- if (FALSE == BluetoothManage_InitFlag_Get()) {
- LOGW("BluetoothManage Not Init\n");
- return -1;
- }
-
- value = g_dbus_connection_call_sync(cli.system_conn, BLUEZ_SERVICE,
- ADAPTER_PATH, ADAPTER_INTERFACE, "StopDiscovery",
- NULL, NULL, G_DBUS_CALL_FLAGS_NONE,
- DBUS_REPLY_TIMEOUT, NULL, &error);
-
- if (NULL == value) {
- LOGW ("Error getting object manager client: %s\n", error->message);
- g_error_free(error);
- return -1;
- }
-
- g_variant_unref(value);
-
- return 0;
-}
-
-/*
- * Call the Bluez Adapter Method "RemoveDevice"
- * If success return 0, else return -1;
- */
-int adapter_remove_device(const gchar* bdaddr)
-{
- LOGD("\n%s\n",bdaddr);
-
- struct btd_device * device;
- gchar *path;
- GError *error = NULL;
- GVariant *value;
-
-
- if (FALSE == BluetoothManage_InitFlag_Get()) {
- LOGW("BluetoothManage Not Init\n");
- return -1;
- }
-
- devices_list_lock();
- device = devices_list_find_device_by_bdaddr(bdaddr);
-
- if (NULL == device) {
- devices_list_unlock();
- LOGD("not find device\n");
- return -1;
- }
- path = g_strdup(device->path);
- devices_list_unlock();
-
- value = g_dbus_connection_call_sync(cli.system_conn, BLUEZ_SERVICE,
- ADAPTER_PATH, ADAPTER_INTERFACE, "RemoveDevice",
- g_variant_new("(o)", path), NULL,
- G_DBUS_CALL_FLAGS_NONE, DBUS_REPLY_TIMEOUT, NULL, &error);
-
- bt_remove_priority(bdaddr);
-
- g_free(path);
-
- if (NULL == value) {
- LOGW ("Error getting object manager client: %s", error->message);
- g_error_free(error);
- return -1;
- }
-
- g_variant_unref(value);
- return 0;
-
-}
-
-
-/*
- * Get the copy of device list.
- */
-GSList* adapter_get_devices_list()
-{
- GSList* tmp;
- devices_list_lock();
- tmp = g_slist_copy_deep (BluetoothManage.device,
- (GCopyFunc)device_copy, NULL);
- devices_list_unlock();
- return tmp;
-}
-
-/*
- * free device list.
- */
-void adapter_devices_list_free(GSList* list)
-{
- if (NULL != list)
- g_slist_free_full(list,(GDestroyNotify)device_free);
-
-}
-
-/*
- * device_pair callback
- */
-void device_pair_done_cb(GDBusConnection *source_object,
- GAsyncResult *res,
- gpointer user_data)
-{
- LOGD("\n");
- gchar *bdaddr = user_data;
-
- if (g_task_had_error(G_TASK(res)) == FALSE)
- {
- bt_save_priority(bdaddr);
- }
- g_free(bdaddr);
-
- g_dbus_connection_call_finish (source_object, res, NULL);
-
-}
-
-/*
- * send pairing command
- * If success return 0, else return -1;
- */
-int device_pair(const gchar * bdaddr)
-{
- LOGD("\n%s\n",bdaddr);
-
- struct btd_device * device;
- gchar *path;
- GError *error = NULL;
- GVariant *value;
-
-
- if (FALSE == BluetoothManage_InitFlag_Get()) {
- LOGD("BluetoothManage Not Init\n");
- return -1;
- }
-
- devices_list_lock();
- device = devices_list_find_device_by_bdaddr(bdaddr);
-
- if (NULL == device) {
- devices_list_unlock();
- LOGD("not find device\n");
- return -1;
- }
- path = g_strdup(device->path);
- devices_list_unlock();
-
-#if 0
- value = g_dbus_connection_call_sync(cli.system_conn, BLUEZ_SERVICE,
- path, DEVICE_INTERFACE, "Pair",
- NULL, NULL, G_DBUS_CALL_FLAGS_NONE,
- DBUS_REPLY_TIMEOUT, NULL, &error);
-
- g_free(path);
-
- if (NULL == value) {
- LOGW ("Error getting object manager client: %s", error->message);
- g_error_free(error);
- return -1;
- }
-
- g_variant_unref(value);
-#else
-
- g_dbus_connection_call(cli.system_conn, BLUEZ_SERVICE,
- path, DEVICE_INTERFACE, "Pair",
- NULL, NULL, G_DBUS_CALL_FLAGS_NONE,
- DBUS_REPLY_TIMEOUT, NULL,
- (GAsyncReadyCallback)device_pair_done_cb, g_strdup(bdaddr));
-
- g_free(path);
-#endif
- return 0;
-
-}
-
-/*
- * send cancel pairing command
- * If success return 0, else return -1;
- */
-int device_cancelPairing(const gchar * bdaddr)
-{
- LOGD("\n%s\n",bdaddr);
-
- struct btd_device * device;
- gchar *path;
- GError *error = NULL;
- GVariant *value;
-
-
- if (FALSE == BluetoothManage_InitFlag_Get()) {
- LOGD("BluetoothManage Not Init\n");
- return -1;
- }
-
- devices_list_lock();
- device = devices_list_find_device_by_bdaddr(bdaddr);
-
- if (NULL == device) {
- devices_list_unlock();
- LOGD("not find device\n");
- return -1;
- }
- path = g_strdup(device->path);
- devices_list_unlock();
-
- value = g_dbus_connection_call_sync(cli.system_conn, BLUEZ_SERVICE,
- path, DEVICE_INTERFACE, "CancelPairing",
- NULL, NULL, G_DBUS_CALL_FLAGS_NONE,
- DBUS_REPLY_TIMEOUT, NULL, &error);
-
- g_free(path);
-
- if (NULL == value) {
- LOGW ("Error getting object manager client: %s", error->message);
- g_error_free(error);
- return -1;
- }
-
- g_variant_unref(value);
- return 0;
-
-}
-/*
- * send connect command
- * If success return 0, else return -1;
- */
-int device_connect(const gchar * bdaddr, const gchar * uuid)
-{
- LOGD("\n%s\n",bdaddr);
-
- struct btd_device * device;
- gchar *path;
- GError *error = NULL;
- GVariant *value;
-
-
- if (FALSE == BluetoothManage_InitFlag_Get()) {
- LOGD("BluetoothManage Not Init\n");
- return -1;
- }
-
- devices_list_lock();
- device = devices_list_find_device_by_bdaddr(bdaddr);
-
- if (NULL == device) {
- devices_list_unlock();
- LOGD("not find device\n");
- return -1;
- }
- path = g_strdup(device->path);
- devices_list_unlock();
-
- value = g_dbus_connection_call_sync(cli.system_conn, BLUEZ_SERVICE,
- path, DEVICE_INTERFACE, uuid ? "ConnectProfile" : "Connect",
- uuid ? g_variant_new("(s)", uuid) : NULL,
- NULL, G_DBUS_CALL_FLAGS_NONE,
- DBUS_REPLY_TIMEOUT, NULL, &error);
-
- g_free(path);
-
- if (NULL == value) {
- LOGW ("Error getting object manager client: %s", error->message);
- g_error_free(error);
- return -1;
- }
-
- g_variant_unref(value);
- return 0;
-
-}
-
-/*
- * send disconnect command
- * If success return 0, else return -1;
- */
-int device_disconnect(const gchar* bdaddr, const gchar *uuid)
-{
- LOGD("\n%s\n",bdaddr);
-
- struct btd_device * device;
- gchar *path;
- GError *error = NULL;
- GVariant *value;
-
-
- if (FALSE == BluetoothManage_InitFlag_Get()) {
- LOGD("BluetoothManage Not Init\n");
- return -1;
- }
-
- devices_list_lock();
- device = devices_list_find_device_by_bdaddr(bdaddr);
-
- if (NULL == device) {
- devices_list_unlock();
- LOGD("not find device\n");
- return -1;
- }
- path = g_strdup(device->path);
- devices_list_unlock();
-
- value = g_dbus_connection_call_sync(cli.system_conn, BLUEZ_SERVICE,
- path, DEVICE_INTERFACE, uuid ? "DisconnectProfile" : "Disconnect",
- uuid ? g_variant_new("(s)", uuid) : NULL,
- NULL, G_DBUS_CALL_FLAGS_NONE,
- DBUS_REPLY_TIMEOUT, NULL, &error);
-
- g_free(path);
-
- if (NULL == value) {
- LOGW ("Error getting object manager client: %s", error->message);
- g_error_free(error);
- return -1;
- }
-
- g_variant_unref(value);
- return 0;
-}
-
-/*
- * set remote device property
- * If success return 0, else return -1;
- */
-int device_set_property(const char * bdaddr, const char *property_name,
- const char *property_value)
-{
- LOGD("\n%s-%s-%s\n",bdaddr,property_name,property_value);
-
- GError *error = NULL;
- GVariant *ret;
- struct btd_device * device;
- gchar *path;
- gboolean value;
-
- if (FALSE == BluetoothManage_InitFlag_Get()) {
- LOGD("BluetoothManage Not Init\n");
- return -1;
- }
-
- //Only support set "Trusted"
- if (strcmp(property_name, "Trusted")) {
- LOGD("Not support property name\n");
- return -1;
- }
-
- if (atoi(property_value) == 1 || !strcasecmp(property_value, "true")) {
- value = TRUE;
- } else if (atoi(property_value) == 0
- || !strcasecmp(property_value, "false")) {
- value = FALSE;
- } else {
- LOGD("Not support property value\n");
- return -1;
- }
-
- devices_list_lock();
- device = devices_list_find_device_by_bdaddr(bdaddr);
-
- if (NULL == device) {
- devices_list_unlock();
- LOGD("not find device\n");
- return -1;
- }
- path = g_strdup(device->path);
- devices_list_unlock();
-
- ret = g_dbus_connection_call_sync(cli.system_conn, BLUEZ_SERVICE,
- path, FREEDESKTOP_PROPERTIES, "Set",
- g_variant_new("(ssv)", DEVICE_INTERFACE, property_name,
- g_variant_new("b", value)), NULL, G_DBUS_CALL_FLAGS_NONE,
- DBUS_REPLY_TIMEOUT, NULL, &error);
-
- g_free(path);
-
- if (NULL == ret) {
- LOGW ("Error getting object manager client: %s", error->message);
- g_error_free(error);
- return -1;
- }
-
- g_variant_unref(ret);
- return 0;
-}
-
-/*
- * call remote device avrcp method
- * Only support controls (Play, Pause, Stop, Previous, Next)
- * If success return 0, else return -1;
- */
-int device_call_avrcp_method(const gchar* bdaddr, const gchar* method)
-{
- LOGD("device:%s,value:%d\n", bdaddr, method);
-
- struct btd_device * device;
- GError *error = NULL;
- GVariant *value;
- gchar *path;
-
- if (FALSE == BluetoothManage_InitFlag_Get()) {
- LOGW("BluetoothManage Not Init\n");
- return -1;
- }
-
- if ((0!=g_strcmp0 (method, "Play"))&&
- (0!=g_strcmp0 (method, "Pause"))&&
- (0!=g_strcmp0 (method, "Stop"))&&
- (0!=g_strcmp0 (method, "Previous"))&&
- (0!=g_strcmp0 (method, "Next")))
- {
- LOGD("Invalid method\n");
- return -1;
- }
-
- devices_list_lock();
- device = devices_list_find_device_by_bdaddr(bdaddr);
-
- if (NULL == device) {
- devices_list_unlock();
- LOGD("not find device\n");
- return -1;
- }
- path = g_strdup(device->path);
- devices_list_unlock();
-
- value = g_dbus_connection_call_sync(cli.system_conn, BLUEZ_SERVICE,
- path, MEDIA_CONTROL1_INTERFACE,
- method, NULL, NULL,
- G_DBUS_CALL_FLAGS_NONE, DBUS_REPLY_TIMEOUT,
- NULL, &error);
-
- g_free(path);
-
- if (NULL == value) {
- LOGW ("Error : %s", error->message);
- g_error_free(error);
- return -1;
- }
-
- g_variant_unref(value);
-
- return 0;
-}
-
-
-/*
- * Stops the GMainLoop
- */
-int BluetoothManagerQuit()
-{
- LOGD("\n");
-
- if (FALSE == BluetoothManage.inited )
- {
- LOGD("BluetoothManage Not init\n");
- return -1;
- }
-
- if(cli.clientloop){
- g_main_loop_quit(cli.clientloop);
- }
-
- BluezManagerQuit();
- stop_agent();
-
- devices_list_lock();
- devices_list_cleanup();
- devices_list_unlock();
-
-
- g_mutex_clear (&(BluetoothManage.m));
-
- g_object_unref(cli.system_conn);
- g_object_unref(cli.session_conn);
-
- if (logfp)
- fclose(logfp);
- logfp = NULL;
-
- BluetoothManage.inited = FALSE;
-
- return 0;
-}
-
-/*
- * Create Bluetooth Manager Thread
- * Note: bluetooth-api shall do BluetoothManageInit() first before call other APIs.
- * bluetooth-api shall register callback function
- * Returns: 0 - success or other errors
- */
-int BluetoothManagerInit() {
- pthread_t thread_id;
-
- LOGD("\n");
-
- if (TRUE == BluetoothManage.inited )
- {
- LOGW("BluetoothManage already init\n");
- return -1;
- }
-
- logfp = fopen("/var/log/BluetoothManager.log", "a+");
-
- if (NULL == logfp)
- {
- openlog("BluetoothManager", LOG_CONS | LOG_PID, LOG_USER);
- syslog(LOG_WARNING, "BluetoothManager create log file fail\n");
- closelog();
- }
-
- g_mutex_init(&(BluetoothManage.m));
-
- pthread_create(&thread_id, NULL, bt_event_loop_thread, NULL);
- //pthread_setname_np(thread_id, "BT_Manager");
-
- return 0;
-}
-
-/*
- * Register Bluetooth Manager Callback function
- */
-void BindingAPIRegister(const Binding_RegisterCallback_t* pstRegisterCallback)
-{
- if (NULL != pstRegisterCallback)
- {
- if (NULL != pstRegisterCallback->binding_device_added)
- {
- g_RegisterCallback.binding_device_added =
- pstRegisterCallback->binding_device_added;
- }
-
- if (NULL != pstRegisterCallback->binding_device_removed)
- {
- g_RegisterCallback.binding_device_removed =
- pstRegisterCallback->binding_device_removed;
- }
-
- if (NULL != pstRegisterCallback->binding_device_properties_changed)
- {
- g_RegisterCallback.binding_device_properties_changed =
- pstRegisterCallback->binding_device_properties_changed;
- }
-
- if (NULL != pstRegisterCallback->binding_request_confirmation)
- {
- g_RegisterCallback.binding_request_confirmation =
- pstRegisterCallback->binding_request_confirmation;
- }
- }
-}
-
-GError* setHMIStatus(enum btStates state) {
-
- gchar *iconString = NULL;
- GDBusConnection *connection;
- GVariant *params = NULL;
- GVariant *message = NULL;
- GError *error = NULL;
-
- if (state==INACTIVE) iconString = "qrc:/images/Status/HMI_Status_Bluetooth_Inactive-01.png";
- else if (state==ACTIVE) iconString = "qrc:/images/Status/HMI_Status_Bluetooth_On-01.png";
- else iconString = "qrc:/images/Status/HMI_Status_Bluetooth_Inactive-01.png";
-
- connection = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, &error);
-
- params = g_variant_new("(is)", HOMESCREEN_BT_ICON_POSITION, iconString);
-
- message = g_dbus_connection_call_sync(connection, HOMESCREEN_SERVICE,
- HOMESCREEN_ICON_PATH, HOMESCREEN_ICON_INTERFACE, "setStatusIcon", params,
- NULL, G_DBUS_CALL_FLAGS_NONE,
- DBUS_REPLY_TIMEOUT, NULL, &error);
-
- if (error) {
- printf("error: %s\n", error->message);
-
- return error;
- } else {
- return NULL;
- }
-
-}
-
-
diff --git a/binding-bluetooth/bluetooth-manager.h b/binding-bluetooth/bluetooth-manager.h
deleted file mode 100644
index 4ad27e4..0000000
--- a/binding-bluetooth/bluetooth-manager.h
+++ /dev/null
@@ -1,200 +0,0 @@
-/* Copyright 2016 ALPS ELECTRIC CO., LTD.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-#ifndef BLUEZ_MANAGER_H
-#define BLUEZ_MANAGER_H
-
-#include <glib.h>
-#include <gio/gio.h>
-#include <glib-object.h>
-#include <sys/ioctl.h>
-
- /* Debug Trace Level */
-#define DT_LEVEL_ERROR (1 << 1)
-#define DT_LEVEL_WARNING (1 << 2)
-#define DT_LEVEL_NOTICE (1 << 3)
-#define DT_LEVEL_INFO (1 << 4)
-#define DT_LEVEL_DEBUG (1 << 5)
-//#define _DEBUG
-
-#define LOGE(fmt, args...) \
- DebugTraceSendMsg(DT_LEVEL_ERROR, g_strdup_printf("[%d:%s]" fmt, __LINE__, __FUNCTION__, ## args))
-#define LOGW(fmt, args...) \
- DebugTraceSendMsg(DT_LEVEL_WARNING, g_strdup_printf("[%d:%s]" fmt, __LINE__, __FUNCTION__, ## args))
-#define LOGN(fmt, args...) \
- DebugTraceSendMsg(DT_LEVEL_NOTICE, g_strdup_printf("[%d:%s]" fmt, __LINE__, __FUNCTION__, ## args))
-#define LOGI(fmt, args...) \
- DebugTraceSendMsg(DT_LEVEL_INFO, g_strdup_printf("[%d:%s]" fmt, __LINE__, __FUNCTION__, ## args))
-#define LOGD(fmt, args...) \
- DebugTraceSendMsg(DT_LEVEL_DEBUG, g_strdup_printf("[%d:%s]" fmt, __LINE__, __FUNCTION__, ## args))
-
-#ifdef _DEBUG
- #define _DEBUG_PRINT_DBUS
- #define LOCAL_PRINT_DEBUG
-#endif
-
-#ifdef LOCAL_PRINT_DEBUG
-#define D_PRINTF(fmt, args...) \
- g_print("[DEBUG][%d:%s]"fmt, __LINE__, __FUNCTION__, ## args)
-#define D_PRINTF_RAW(fmt, args...) \
- g_print(""fmt, ## args)
-#else
-#define D_PRINTF(fmt, args...)
-#define D_PRINTF_RAW(fmt, args...)
-#endif /* ifdef _DEBUG */
-
-//service
-#define AGENT_SERVICE "org.agent"
-
-//remote service
-#define BLUEZ_SERVICE "org.bluez"
-#define CLIENT_SERVICE "org.bluez.obex"
-
-//object path
-#define BLUEZ_MANAGER_PATH "/"
-#define AGENT_PATH "/org/bluez"
-#define ADAPTER_PATH "/org/bluez/hci0"
-#define OBEX_CLIENT_PATH "/org/bluez/obex"
-
-
-//interface
-#define ADAPTER_INTERFACE "org.bluez.Adapter1"
-#define DEVICE_INTERFACE "org.bluez.Device1"
-#define AGENT_MANAGER_INTERFACE "org.bluez.AgentManager1"
-//#define SERVICE_INTERFACE "org.bluez.Service"
-#define AGENT_INTERFACE "org.bluez.Agent"
-
-#define CLIENT_INTERFACE "org.bluez.obex.Client1"
-#define TRANSFER_INTERFACE "org.bluez.obex.Transfer"
-#define SESSION_INTERFACE "org.bluez.obex.Session"
-#define OBEX_ERROR_INTERFACE "org.bluez.obex.Error"
-#define BLUEZ_ERROR_INTERFACE "org.bluez.Error"
-#define PBAP_INTERFACE "org.bluez.obex.PhonebookAccess"
-#define MAP_INTERFACE "org.bluez.obex.MessageAccess"
-#define MAP_MSG_INTERFACE "org.bluez.obex.Message"
-
-#define MEDIA_PLAYER_INTERFACE "org.bluez.MediaPlayer"
-#define MEDIA_PLAYER1_INTERFACE "org.bluez.MediaPlayer1"
-#define MEDIA_FOLDER_INTERFACE "org.bluez.MediaFolder"
-#define MEDIA_ITEM_INTERFACE "org.bluez.MediaItem"
-#define MEDIA_TRANSPORT_INTERFACE "org.bluez.MediaTransport"
-#define MEDIA_TRANSPORT1_INTERFACE "org.bluez.MediaTransport1"
-#define MEDIA_CONTROL1_INTERFACE "org.bluez.MediaControl1"
-
-#define FREEDESKTOP_INTROSPECT "org.freedesktop.DBus.Introspectable"
-#define FREEDESKTOP_PROPERTIES "org.freedesktop.DBus.Properties"
-#define FREEDESKTOP_OBJECTMANAGER "org.freedesktop.DBus.ObjectManager"
-
-#define HOMESCREEN_SERVICE "org.agl.homescreen"
-#define HOMESCREEN_ICON_INTERFACE "org.agl.statusbar"
-#define HOMESCREEN_ICON_PATH "/StatusBar"
-#define HOMESCREEN_BT_ICON_POSITION 1
-
-#define DBUS_REPLY_TIMEOUT (120 * 1000)
-#define DBUS_REPLY_TIMEOUT_SHORT (10 * 1000)
-
-#define ERROR_BLUEZ_REJECT "org.bluez.Error.Rejected"
-#define ERROR_BLUEZ_CANCELED "org.bluez.Error.Canceled"
-
-#define HCIDEVUP _IOW('H', 201, int)
-
-#define AF_BLUETOOTH 31
-#define BTPROTO_HCI 1
-
-#if 0
-void DebugTraceSendMsg(int level, gchar* message);
-#else
-
-typedef struct _client
-{
- GDBusConnection *system_conn;
- GDBusConnection *session_conn;
- GMainLoop *clientloop;
-} Client;
-
-//Bluetooth Device Properties
-struct btd_device {
- gchar *path;
- gchar *bdaddr;
- gchar *name;
- gchar *avrcp_title;
- gchar *avrcp_artist;
- gchar *avrcp_status;
- gchar *transport_state;
- guint32 avrcp_duration;
- guint32 avrcp_position;
- guint16 transport_volume;
- gboolean paired;
- gboolean trusted;
- gboolean connected;
- gboolean avconnected;
- gboolean hfpconnected;
- GList *uuids;
-};
-
-typedef struct {
- gboolean inited;
- GMutex m;
- gint watch;
- guint autoconnect;
- GSList * device;
- GSList * priorities;
-} stBluetoothManage;
-
-typedef struct tagBinding_RegisterCallback
-{
- void (*binding_device_added)(struct btd_device *BDdevice);
- void (*binding_device_removed)(struct btd_device *BDdevice);
- void (*binding_device_properties_changed)(struct btd_device *BDdevice);
- gboolean (*binding_request_confirmation)(const gchar *device, guint passkey);
-}Binding_RegisterCallback_t;
-
-enum btStates {INACTIVE, ACTIVE};
-
-void DebugTraceSendMsg(int level, gchar* message);
-
-/* ------ PUBLIC PLUGIN FUNCTIONS --------- */
-void BindingAPIRegister(const Binding_RegisterCallback_t* pstRegisterCallback);
-int BluetoothManagerInit(void);
-int BluetoothManagerQuit(void);
-
-GSList* adapter_get_devices_list() ;
-void adapter_devices_list_free(GSList* list) ;
-
-int adapter_set_powered(gboolean value);
-int adapter_get_powered(gboolean *value);
-//int adapter_set_discoverable(gboolean value);
-int adapter_start_discovery();
-int adapter_stop_discovery();
-int adapter_remove_device(const gchar *addr);
-int device_pair(const gchar * addr);
-int device_cancelPairing(const gchar * bdaddr);
-int device_connect(const gchar *addr, const gchar *uuid);
-int device_disconnect(const gchar *addr, const gchar *uuid);
-int device_set_property(const gchar * bdaddr, const gchar *property, const gchar *value);
-int device_call_avrcp_method(const gchar* device, const gchar* method);
-int device_priority_list(void *(object_cb)(void *, gchar *), void *ptr);
-
-int adapter_set_property(const gchar* property, gboolean value) ;
-
-GError* setHMIStatus(enum btStates);
-
-#endif
-#endif /* BLUETOOTH_MANAGER_H */
-
-
-/****************************** The End Of File ******************************/
-
diff --git a/binding-bluetooth/bluez-client.c b/binding-bluetooth/bluez-client.c
deleted file mode 100644
index d078d06..0000000
--- a/binding-bluetooth/bluez-client.c
+++ /dev/null
@@ -1,966 +0,0 @@
-/* Copyright 2016 ALPS ELECTRIC CO., LTD.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <pthread.h>
-#include <glib.h>
-#include <gio/gio.h>
-#include <glib-object.h>
-
-#include "lib_bluez.h"
-#include "bluez-client.h"
-
-#ifdef BLUEZ_THREAD
-static GMainLoop *BluezLoop;
-#endif
-static Bluez_RegisterCallback_t bluez_RegisterCallback = { 0 };
-static stBluezManage BluezManage = { 0 };
-
-
-/* ------ LOCAL FUNCTIONS --------- */
-
-/*
- * make a copy of each element
- * And, to entirely free the new btd_device, you could do: device_free
- */
-static struct bt_device *bluez_device_copy(struct bt_device* device)
-{
- struct bt_device * temp;
-
- if (NULL == device) {
- return NULL;
- }
-
- temp = g_malloc0(sizeof(struct bt_device));
- temp->path = g_strdup(device->path);
- temp->bdaddr = g_strdup(device->bdaddr);
- temp->name = g_strdup(device->name);
- temp->alias = g_strdup(device->alias);
- temp->paired = device->paired;
- temp->trusted = device->trusted;
- temp->blocked = device->blocked;
- temp->connected = device->connected;
- temp->avconnected = device->avconnected;
- temp->legacypairing = device->legacypairing;
- temp->rssi = device->rssi;
- temp->uuids = g_list_copy(device->uuids);
-
- return temp;
-}
-
-/*
- * Frees all of the memory
- */
-static void bluez_device_free(struct bt_device* device)
-{
-
- if (NULL == device) {
- return ;
- }
- D_PRINTF("device %p\n",device);
- if (device->path) {
- D_PRINTF("path:%s\n",device->path);
- g_free(device->path);
- device->path = NULL;
- }
- if (device->bdaddr) {
- D_PRINTF("bdaddr:%s\n",device->bdaddr);
- g_free(device->bdaddr);
- device->bdaddr = NULL;
- }
- if (device->name) {
- D_PRINTF("name:%s\n",device->name);
- g_free(device->name);
- device->name = NULL;
- }
- if (device->alias) {
- D_PRINTF("alias:%s\n",device->alias);
- g_free(device->alias);
- device->alias = NULL;
- }
-
- if (device->uuids){
- D_PRINTF("uuids xxx\n");
- g_list_free_full(device->uuids, g_free);
- device->uuids = NULL;
- }
-
- g_free(device);
-
-}
-
-#ifdef BLUEZ_BD_LIST
-
-static void bluez_devices_list_lock(void)
-{
- g_mutex_lock(&(BluezManage.m));
-}
-
-static void bluez_devices_list_unlock(void)
-{
- g_mutex_unlock(&(BluezManage.m));
-}
-
-static int bluez_device_path_cmp(struct bt_device * device, const gchar* pPath )
-{
- return g_strcmp0 (device->path, pPath);
-}
-
-/*
- * search device by path
- * Returns the first found btd_device or NULL if it is not found
- */
-static struct bt_device *bluez_devices_list_find_device_by_path(const gchar* pPath)
-{
- GSList * temp;
-
- temp = g_slist_find_custom (BluezManage.device, pPath,
- (GCompareFunc)bluez_device_path_cmp);
-
- if (temp) {
- return temp->data;
- }
-
- return NULL;
-
-}
-
-
-static int bluez_device_bdaddr_cmp(struct bt_device * device, const gchar* pBDaddr )
-{
- return g_strcmp0 (device->bdaddr, pBDaddr);
-}
-
-/*
- * search device by path
- * Returns the first found btd_device or NULL if it is not found
- */
-static struct
-bt_device *bluez_devices_list_find_device_by_bdaddr(const gchar* pBDaddr)
-{
- GSList * temp;
-
- temp = g_slist_find_custom (BluezManage.device, pBDaddr,
- (GCompareFunc)bluez_device_bdaddr_cmp);
-
- if (temp) {
- return temp->data;
- }
-
- return NULL;
-
-}
-
-/*
- * remove all the devices
- */
-static void bluez_devices_list_cleanup()
-{
- LOGD("\n");
- GSList * temp = BluezManage.device;
- while (temp) {
- struct bt_device *BDdevice = temp->data;
- temp = temp->next;
-
- BluezManage.device = g_slist_remove_all(BluezManage.device,
- BDdevice);
-
- bluez_device_free(BDdevice);
- }
-}
-
-/*
- * Get the copy of device list.
- */
-GSList* bluez_devices_list_copy()
-{
- GSList* tmp;
- bluez_devices_list_lock();
- tmp = g_slist_copy_deep (BluezManage.device,
- (GCopyFunc)bluez_device_copy, NULL);
- bluez_devices_list_unlock();
- return tmp;
-}
-
-#endif
-
-/*
- * free device list.
- */
-void bluez_devices_list_free(GSList* list)
-{
- if (NULL != list)
- g_slist_free_full(list,(GDestroyNotify)bluez_device_free);
-
-}
-
-/*
- * update device from Interfcace org.bluez.Device1 properties
- */
-static int
-bluez_device1_properties_update(struct bt_device *device, GVariant *value)
-{
- if ((NULL==device) || (NULL==value))
- {
- return -1;
- }
-
- GVariantIter iter;
- const gchar *key;
- GVariant *subValue;
-
- g_variant_iter_init (&iter, value);
- while (g_variant_iter_next (&iter, "{&sv}", &key, &subValue))
- {
- //gchar *s = g_variant_print (subValue, TRUE);
- //g_print (" %s -> %s\n", key, s);
- //g_free (s);
-
- gboolean value_b = FALSE;//b gboolean
- //gchar value_c = 0;
- //guchar value_y = 0;//y guchar
- gint16 value_n = 0;//n gint16
- //guint16 value_q = 0;//q guint16
- //gint32 value_i = 0;//i gint32
- //guint32 value_u = 0;//u guint32
- //gint64 value_x = 0;//x gint64
- //guint64 value_t = 0;//t guint64
- //gint32 value_h = 0;//h gint32
- //gdouble value_d = 0.0;//d gdouble
- gchar *str;
-
- if (0==g_strcmp0(key,"Address")) {
- g_variant_get(subValue, "s", &str );
- D_PRINTF("Address %s\n",str);
-
- if (device->bdaddr)
- g_free (device->bdaddr);
-
- device->bdaddr = g_strdup(str);
-
- g_free (str);
- str = NULL;
-
- }else if (0==g_strcmp0(key,"Name")) {
- g_variant_get(subValue, "s", &str );
- D_PRINTF("Name %s\n",str);
-
- if (device->name)
- g_free (device->name);
-
- device->name = g_strdup(str);
-
- g_free (str);
- str = NULL;
-
- }else if (0==g_strcmp0(key,"Alias")) {
- g_variant_get(subValue, "s", &str );
- D_PRINTF("Alias %s\n",str);
-
- if (device->alias)
- g_free (device->alias);
-
- device->alias = g_strdup(str);
-
- g_free (str);
- str = NULL;
- }else if (0==g_strcmp0(key,"LegacyPairing")) {
- g_variant_get(subValue, "b", &value_b );
- D_PRINTF("LegacyPairing %d\n",value_b);
- device->legacypairing = value_b;
-
- }else if (0==g_strcmp0(key,"Paired")) {
- g_variant_get(subValue, "b", &value_b );
- D_PRINTF("Paired %d\n",value_b);
- device->paired = value_b;
-
- }else if (0==g_strcmp0(key,"Trusted")) {
- g_variant_get(subValue, "b", &value_b );
- D_PRINTF("Trusted %d\n",value_b);
- device->trusted = value_b;
-
- }else if (0==g_strcmp0(key,"Blocked")) {
- g_variant_get(subValue, "b", &value_b );
- D_PRINTF("Blocked %d\n",value_b);
- device->blocked = value_b;
-
- }else if (0==g_strcmp0(key,"Connected")) {
- g_variant_get(subValue, "b", &value_b );
- D_PRINTF("Connected %d\n",value_b);
- device->connected = value_b;
-
- }else if (0==g_strcmp0(key,"RSSI")) {
- g_variant_get(subValue, "n", &value_n );
- D_PRINTF("RSSI %d\n",value_n);
- device->rssi = value_n;
-
- }else if (0==g_strcmp0(key,"UUIDs")) {
- GVariantIter iter;
- gchar *val;
-
- //g_print ("type '%s'\n", g_variant_get_type_string (subValue));
- if (device->uuids) {
- g_list_free_full(device->uuids, g_free);
- }
-
- g_variant_iter_init (&iter, subValue);
- while (g_variant_iter_next (&iter, "s", &val))
- {
- device->uuids = g_list_append(device->uuids, g_strdup(val));
- }
- }
- }
-
- return 0;
-
-}
-
-/*
- * update device from Interfcace org.bluez.MediaControl1 properties
- */
-static int
-bluez_mediacontrol1_properties_update(struct bt_device *device, GVariant *value)
-{
- GVariantIter iter;
- const gchar *key;
- GVariant *subValue;
-
- if ((NULL==device) || (NULL==value))
- {
- return -1;
- }
-
- g_variant_iter_init (&iter, value);
- while (g_variant_iter_next (&iter, "{&sv}", &key, &subValue))
- {
- //gchar *s = g_variant_print (subValue, TRUE);
- //g_print (" %s -> %s\n", key, s);
- //g_free (s);
-
- gboolean value_b = FALSE;//b gboolean
- gchar *str;
-
- if (0==g_strcmp0(key,"Connected")) {
- g_variant_get(subValue, "b", &value_b );
- D_PRINTF("Connected %d\n",value_b);
- device->avconnected = value_b;
-
- }else if (0==g_strcmp0(key,"Player")) {
- g_variant_get(subValue, "o", &str );
- D_PRINTF("Player Object %s\n",str);
-
- }
- }
-
- return 0;
-
-}
-
-/*
- * Get the device list
- * Call <method>GetManagedObjects
- * Returns: 0 - success or other errors
- */
-static GSList * bluez_get_devices_list() {
- LOGD("\n");
-
- GError *error = NULL;
- GVariant *result = NULL;
- GSList *newDeviceList = NULL;
-
- result = g_dbus_connection_call_sync(BluezManage.system_conn,
- BLUEZ_SERVICE, BLUEZ_MANAGER_PATH, FREEDESKTOP_OBJECTMANAGER,
- "GetManagedObjects", NULL, NULL,
- G_DBUS_CALL_FLAGS_NONE, DBUS_REPLY_TIMEOUT, NULL, &error);
-
- if (error) {
- LOGW ("Error : %s\n", error->message);
- g_error_free(error);
- return NULL;
- }
-
- GVariant *ArrayValue = NULL;
- GVariantIter *ArrayValueIter;
- GVariant *Value = NULL;
-
- g_variant_get(result, "(*)", &ArrayValue);
-
- g_variant_get(ArrayValue, "a*", &ArrayValueIter);
- while (g_variant_iter_loop(ArrayValueIter, "*", &Value)) {
-
- GVariantIter dbus_object_iter;
- GVariant *dbusObjecPath;
- GVariant *dbusObjecInterfaces;
-
- gchar *pObjecPath = NULL;
- struct bt_device *device = NULL;
-
- g_variant_iter_init(&dbus_object_iter, Value);
-
- //1st : DBus Object Path
- dbusObjecPath = g_variant_iter_next_value(&dbus_object_iter);
-
- g_variant_get(dbusObjecPath, "o", &pObjecPath);
-
- LOGD("object path %s\n",pObjecPath);
- //ObjectPath is /org/bluez/hci0/dev_xx_xx_xx_xx_xx_xx
- if ((37 != strlen(pObjecPath))
- || (NULL == g_strrstr_len(pObjecPath, 19,
- ADAPTER_PATH"/dev"))) {
- g_free(pObjecPath);
- pObjecPath = NULL;
- g_variant_unref(dbusObjecPath);
- continue;
- }
- device = g_malloc0(sizeof(struct bt_device));
- device->path = g_strdup(pObjecPath);
- g_free(pObjecPath);
- pObjecPath = NULL;
- g_variant_unref(dbusObjecPath);
-
- LOGD("Found new device%s\n",device->path );
-
- //2nd : DBus Interfaces under Object Path
- dbusObjecInterfaces = g_variant_iter_next_value(&dbus_object_iter);
-
- GVariant *interfaces_value = NULL;
- g_variant_lookup(dbusObjecInterfaces, DEVICE_INTERFACE,
- "*", &interfaces_value);
-
- if (interfaces_value)
- {
- bluez_device1_properties_update(device, interfaces_value);
-
- g_variant_unref (interfaces_value);
- interfaces_value = NULL;
- }
-
- g_variant_lookup(dbusObjecInterfaces, MEDIA_CONTROL1_INTERFACE,
- "*", &interfaces_value);
-
- if (interfaces_value)
- {
- bluez_mediacontrol1_properties_update(device, interfaces_value);
-
- g_variant_unref (interfaces_value);
- interfaces_value = NULL;
- }
-
- g_variant_unref(dbusObjecInterfaces);
-
- //newDeviceList = g_slist_prepend(newDeviceList, device);
- newDeviceList = g_slist_append(newDeviceList, device);
-
-
- }
-
- g_variant_iter_free(ArrayValueIter);
- g_variant_unref(ArrayValue);
-
- g_variant_unref(result);
-
- return newDeviceList;
-}
-
-
-
-/*
- * notify::name-owner callback function
- */
-static void on_notify_name_owner (GObject *object,
- GParamSpec *pspec,
- gpointer user_data)
-{
-#ifdef _DEBUG_PRINT_DBUS
- GDBusObjectManagerClient *manager = G_DBUS_OBJECT_MANAGER_CLIENT (object);
- gchar *name_owner;
-
- name_owner = g_dbus_object_manager_client_get_name_owner (manager);
- g_print ("name-owner: %s\n", name_owner);
- g_free (name_owner);
-#endif
-}
-
-/*
- * object_added callback function
- */
-static void on_object_added (GDBusObjectManager *manager,
- GDBusObject *object,
- gpointer user_data)
-{
-#ifdef _DEBUG_PRINT_DBUS
- gchar *owner;
- owner = g_dbus_object_manager_client_get_name_owner (
- G_DBUS_OBJECT_MANAGER_CLIENT (manager));
- g_print ("Added object at %s (owner %s)\n",
- g_dbus_object_get_object_path (object), owner);
- g_free (owner);
-#endif
-
-
- const gchar *dbusObjecPath;
- GError *error = NULL;
- GVariant *value = NULL;
- struct bt_device *device;
-
- dbusObjecPath = g_dbus_object_get_object_path (object);
-
- LOGD("%s\n", dbusObjecPath);
-
- //ObjectPath is /org/bluez/hci0/dev_xx_xx_xx_xx_xx_xx
- if ((37 != strlen(dbusObjecPath))
- || (NULL == g_strrstr_len(dbusObjecPath, 19,ADAPTER_PATH"/dev"))) {
- return;
- }
-
- device = g_malloc0(sizeof(struct bt_device));
- device->path = g_strdup(dbusObjecPath);
-
- value = g_dbus_connection_call_sync(BluezManage.system_conn, BLUEZ_SERVICE,
- dbusObjecPath, FREEDESKTOP_PROPERTIES,
- "GetAll", g_variant_new("(s)", DEVICE_INTERFACE),
- NULL, G_DBUS_CALL_FLAGS_NONE,
- DBUS_REPLY_TIMEOUT, NULL, &error);
-
- if (error) {
- LOGW ("Error : %s\n", error->message);
- g_error_free(error);
- g_free(device->path);
- g_free(device);
- return;
- }
-
- if (value) {
- GVariant *subValue;
- g_variant_get(value, "(*)", &subValue);
-
- bluez_device1_properties_update(device, subValue);
-
- g_variant_unref (subValue);
- g_variant_unref(value);
- }
-
-#ifdef BLUEZ_BD_LIST
-
- bluez_devices_list_lock();
-
- //BluezManage.device = g_slist_prepend(BluezManage.device, device);
- BluezManage.device = g_slist_append(BluezManage.device, device);
-
- if (NULL != bluez_RegisterCallback.device_added)
- {
- bluez_RegisterCallback.device_added(device);
- }
-
- bluez_devices_list_unlock();
-#else
-
- if (NULL != bluez_RegisterCallback.device_added)
- {
- bluez_RegisterCallback.device_added(device);
- }
- bluez_device_free(device);
-
-#endif
-}
-
-/*
- * object-removed callback function
- */
-static void on_object_removed (GDBusObjectManager *manager,
- GDBusObject *object,
- gpointer user_data)
-{
-#ifdef _DEBUG_PRINT_DBUS
- gchar *owner;
-
- owner = g_dbus_object_manager_client_get_name_owner (
- G_DBUS_OBJECT_MANAGER_CLIENT (manager));
- g_print ("Removed object at %s (owner %s)\n",
- g_dbus_object_get_object_path (object), owner);
- g_free (owner);
-#endif
-
- const gchar *dbusObjecPath;
- //int ret;
-
-
- dbusObjecPath = g_dbus_object_get_object_path (object);
-
- if ((37 != strlen(dbusObjecPath))
- || (NULL == g_strrstr_len(dbusObjecPath, 19,ADAPTER_PATH"/dev"))) {
- return;
- }
-
- if (NULL != bluez_RegisterCallback.device_removed)
- {
- bluez_RegisterCallback.device_removed(dbusObjecPath);
- }
- LOGD("%s\n", dbusObjecPath);
-#ifdef BLUEZ_BD_LIST
- struct bt_device *device;
-
- bluez_devices_list_lock();
-
- device = bluez_devices_list_find_device_by_path(dbusObjecPath);
-
- if (device) {
- LOGD("Path :%s.\n", dbusObjecPath);
- BluezManage.device = g_slist_remove_all(BluezManage.device,
- device);
-
- bluez_device_free(device);
- }
-
- bluez_devices_list_unlock();
-#endif
-
-}
-
-/*
- * BLUEZ interface-proxy-properties-changed callback function
- */
-static void
-on_interface_proxy_properties_changed (GDBusObjectManagerClient *manager,
- GDBusObjectProxy *object_proxy,
- GDBusProxy *interface_proxy,
- GVariant *changed_properties,
- const gchar *const *invalidated_properties,
- gpointer user_data)
-{
- const gchar *pObjecPath;
- const gchar *pInterface;
-
- pObjecPath = g_dbus_object_get_object_path (G_DBUS_OBJECT (object_proxy));
- pInterface = g_dbus_proxy_get_interface_name (interface_proxy);
-
-#ifdef _DEBUG_PRINT_DBUS
- gchar *s;
- g_print ("Path:%s, Interface:%s\n",pObjecPath, pInterface);
- g_print ("type '%s'\n", g_variant_get_type_string (changed_properties));
- s = g_variant_print (changed_properties, TRUE);
- g_print (" %s\n", s);
- g_free (s);
-#endif
-
- //ObjectPath is /org/bluez/hci0/dev_xx_xx_xx_xx_xx_xx
-
- LOGD("%s\n",pObjecPath);
-
- if( (0 == g_strcmp0(pInterface, DEVICE_INTERFACE)) ||
- (0 == g_strcmp0(pInterface, MEDIA_CONTROL1_INTERFACE)) ||
- (0 == g_strcmp0(pInterface, MEDIA_PLAYER1_INTERFACE)) ||
- (0 == g_strcmp0(pInterface, MEDIA_TRANSPORT1_INTERFACE))) {
-
- if (bluez_RegisterCallback.device_properties_changed)
- bluez_RegisterCallback.device_properties_changed(pObjecPath,
- pInterface, changed_properties);
-
- }
-
-#ifdef BLUEZ_BD_LIST
- struct bt_device *device;
-
- if (0 == g_strcmp0(pInterface, DEVICE_INTERFACE)) {
-
- bluez_devices_list_lock();
-
- device = bluez_devices_list_find_device_by_path(pObjecPath);
-
- bluez_device1_properties_update(device, changed_properties);
-
- bluez_devices_list_unlock();
-
- } else if (0 == g_strcmp0(pInterface, MEDIA_CONTROL1_INTERFACE)) {
-
- bluez_devices_list_lock();
-
- device = bluez_devices_list_find_device_by_path(pObjecPath);
-
- bluez_mediacontrol1_properties_update(device, changed_properties);
-
- bluez_devices_list_unlock();
- }
-#endif
-}
-
-/*
- * init cli dbus connection
- * Returns: 0 - success or other errors
- */
-static int bluez_manager_connect_to_dbus(void)
-{
- GError *error = NULL;
-
- BluezManage.system_conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
-
- if (error) {
- LOGE("Create System GDBusconnection fail\n");
- LOGE("Error:%s\n", error->message);
- g_error_free(error);
-
- return -1;
- }
-
- BluezManage.session_conn = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, &error);
-
- if (error) {
- LOGE("Create Session GDBusconnection fail\n");
- LOGE("Error:%s\n", error->message);
- g_error_free(error);
-
- g_object_unref(BluezManage.system_conn);
-
- return -1;
- }
-
- BluezManage.proxy = bluez_object_manager_client_new_for_bus_sync(
- G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, BLUEZ_SERVICE,
- BLUEZ_MANAGER_PATH, NULL, &error);
-
- if (error) {
- LOGE("Create Bluez manager client fail\n");
- LOGE("Error:%s\n", error->message);
- g_error_free(error);
-
- g_object_unref(BluezManage.system_conn);
- g_object_unref(BluezManage.session_conn);
- return -1;
- }
-
- return 0;
-}
-
-
-/*
- * register dbus callback function
- * Returns: 0 - success or other errors
- */
-static int bluez_manager_register_callback(void)
-{
-
- g_signal_connect (BluezManage.proxy,
- "notify::name-owner",
- G_CALLBACK (on_notify_name_owner),
- NULL);
-
- g_signal_connect (BluezManage.proxy,
- "object-added",
- G_CALLBACK (on_object_added),
- NULL);
-
- g_signal_connect (BluezManage.proxy,
- "object-removed",
- G_CALLBACK (on_object_removed),
- NULL);
-
- g_signal_connect (BluezManage.proxy,
- "interface-proxy-properties-changed",
- G_CALLBACK (on_interface_proxy_properties_changed),
- NULL);
-
- return 0;
-}
-
-/*
- * init bluez client
- * Returns: 0 - success or other errors
- */
-static int bluez_manager_int()
-{
- int ret = 0;
-
- LOGD("\n");
-
- ret = bluez_manager_connect_to_dbus();
-
- if (ret){
- LOGE("Init Fail\n");
- return -1;
- }
-
- bluez_manager_register_callback();
-
-#ifdef BLUEZ_BD_LIST
-
- g_mutex_init(&(BluezManage.m));
-
- BluezManage.device = bluez_get_devices_list();
-
-#endif
-
- BluezManage.inited = TRUE;
-
- return 0;
-
-}
-
-#ifdef BLUEZ_THREAD
-/*
- * Bluetooth Manager Thread
- * register callback function and create a new GMainLoop structure
- */
-static void *bluez_event_loop_thread()
-{
- int ret = 0;
-
- BluezLoop = g_main_loop_new(NULL, FALSE);;
-
- ret = bluez_manager_int();
-
- if (0 == ret){
- LOGD("g_main_loop_run\n");
- g_main_loop_run(BluezLoop);
- }
-
- g_main_loop_unref(BluezLoop);
- LOGD("exit...\n");
-}
-#endif
-
-
-/* ------ PUBLIC FUNCTIONS --------- */
-
-
-/*
- * Get the device list
- * The list should free by FreeBluezDevicesList()
- */
-GSList * GetBluezDevicesList(void)
-{
- LOGD("\n");
-
- GSList* newDeviceList = NULL;
-
- if (TRUE != BluezManage.inited)
- {
- LOGD("Bluez Manager is not inited\n");
- return NULL;
- }
-
-#ifdef BLUEZ_BD_LIST
- newDeviceList = bluez_devices_list_copy();
-#else
- newDeviceList = bluez_get_devices_list();
-#endif
- return newDeviceList;
-}
-
-/*
- * free device list.
- */
-void FreeBluezDevicesList(GSList* list)
-{
- bluez_devices_list_free(list);
-}
-
-/*
- * Stops the GMainLoop
- */
-int BluezManagerQuit(void)
-{
- LOGD("\n");
-
- if (FALSE == BluezManage.inited)
- {
- LOGD("Bluez Manager is not inited\n");
- return -1;
- }
-
-#ifdef BLUEZ_THREAD
- g_main_loop_quit(BluezLoop);
-#endif
-
- memset(&bluez_RegisterCallback, 0, sizeof(Bluez_RegisterCallback_t));
-
- g_object_unref(BluezManage.proxy);
-
-#ifdef BLUEZ_BD_LIST
- bluez_devices_list_lock();
- bluez_devices_list_cleanup();
- bluez_devices_list_unlock();
-
- g_mutex_clear (&(BluezManage.m));
-#endif
-
- g_object_unref(BluezManage.system_conn);
- g_object_unref(BluezManage.session_conn);
-
- BluezManage.inited = FALSE;
-
- return 0;
-}
-
-/*
- * Init Bluez Manager
- */
-int BluezManagerInit()
-{
- LOGD("\n");
- int ret = 0;
-
-
- if (TRUE == BluezManage.inited)
- {
- LOGD("Bluez Manager is already inited\n");
- return -1;
- }
-
-#ifdef BLUEZ_THREAD
-
- pthread_t thread_id;
- pthread_create(&thread_id, NULL, bluez_event_loop_thread, NULL);
- pthread_setname_np(thread_id, "Bluez_Manage");
-
-#else
-
- ret = bluez_manager_int();
-#endif
-
- return ret;
-}
-
-/*
- * Register Bluez Manager Callback function
- */
-void BluezDeviceAPIRegister(const Bluez_RegisterCallback_t* pstRegisterCallback)
-{
- if (NULL != pstRegisterCallback)
- {
- if (NULL != pstRegisterCallback->device_added)
- {
- bluez_RegisterCallback.device_added =
- pstRegisterCallback->device_added;
- }
-
- if (NULL != pstRegisterCallback->device_removed)
- {
- bluez_RegisterCallback.device_removed =
- pstRegisterCallback->device_removed;
- }
-
- if (NULL != pstRegisterCallback->device_properties_changed)
- {
- bluez_RegisterCallback.device_properties_changed =
- pstRegisterCallback->device_properties_changed;
- }
- }
-}
-
-
-
diff --git a/binding-bluetooth/bluez-client.h b/binding-bluetooth/bluez-client.h
deleted file mode 100644
index 17f82f0..0000000
--- a/binding-bluetooth/bluez-client.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Copyright 2016 ALPS ELECTRIC CO., LTD.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifndef BLUEZ_CLIENT_H
-#define BLUEZ_CLIENT_H
-
-#include <glib.h>
-#include <gio/gio.h>
-#include <glib-object.h>
-
-#include "lib_bluez.h"
-#include "bluetooth-manager.h"
-
-//#define BLUEZ_THREAD
-//#define BLUEZ_BD_LIST
-
-//Bluetooth Device Properties
-struct bt_device {
- gchar *path;
- gchar *bdaddr;
- gchar *name;
- gchar *alias;
- gboolean paired;
- gboolean trusted;
- gboolean blocked;
- gboolean connected;
- gboolean avconnected;
- gboolean legacypairing;
- gint16 rssi;
- GList *uuids;
-};
-
-typedef struct {
- gboolean inited;
- #ifdef BLUEZ_BD_LIST
- GMutex m;
- GSList * device;
- #endif
- GDBusObjectManager *proxy;
- GDBusConnection *system_conn;
- GDBusConnection *session_conn;
-} stBluezManage;
-
-typedef struct tagBluez_RegisterCallback
-{
- void (*device_added)(struct bt_device *device);
- void (*device_removed)(const gchar *path);
- void (*device_properties_changed)(const gchar *pObjecPath, const gchar *pInterface, GVariant *value);
-}Bluez_RegisterCallback_t;
-
-/* --- PUBLIC FUNCTIONS --- */
-void BluezDeviceAPIRegister(const Bluez_RegisterCallback_t* pstRegisterCallback);
-
-int BluezManagerInit(void) ;
-int BluezManagerQuit(void) ;
-
-GSList * GetBluezDevicesList(void);
-void FreeBluezDevicesList(GSList* list) ;
-
-#endif /* BLUEZ_CLIENT_H */
-
-
-/****************************** The End Of File ******************************/
-
diff --git a/binding-bluetooth/lib_agent.c b/binding-bluetooth/lib_agent.c
deleted file mode 100644
index 6324dfb..0000000
--- a/binding-bluetooth/lib_agent.c
+++ /dev/null
@@ -1,2504 +0,0 @@
-/*
- * Generated by gdbus-codegen 2.48.1. DO NOT EDIT.
- *
- * The license of this code is the same as for the source it was derived from.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "lib_agent.h"
-
-#include <string.h>
-#ifdef G_OS_UNIX
-# include <gio/gunixfdlist.h>
-#endif
-
-typedef struct
-{
- GDBusArgInfo parent_struct;
- gboolean use_gvariant;
-} _ExtendedGDBusArgInfo;
-
-typedef struct
-{
- GDBusMethodInfo parent_struct;
- const gchar *signal_name;
- gboolean pass_fdlist;
-} _ExtendedGDBusMethodInfo;
-
-typedef struct
-{
- GDBusSignalInfo parent_struct;
- const gchar *signal_name;
-} _ExtendedGDBusSignalInfo;
-
-typedef struct
-{
- GDBusPropertyInfo parent_struct;
- const gchar *hyphen_name;
- gboolean use_gvariant;
-} _ExtendedGDBusPropertyInfo;
-
-typedef struct
-{
- GDBusInterfaceInfo parent_struct;
- const gchar *hyphen_name;
-} _ExtendedGDBusInterfaceInfo;
-
-typedef struct
-{
- const _ExtendedGDBusPropertyInfo *info;
- guint prop_id;
- GValue orig_value; /* the value before the change */
-} ChangedProperty;
-
-static void
-_changed_property_free (ChangedProperty *data)
-{
- g_value_unset (&data->orig_value);
- g_free (data);
-}
-
-static gboolean
-_g_strv_equal0 (gchar **a, gchar **b)
-{
- gboolean ret = FALSE;
- guint n;
- if (a == NULL && b == NULL)
- {
- ret = TRUE;
- goto out;
- }
- if (a == NULL || b == NULL)
- goto out;
- if (g_strv_length (a) != g_strv_length (b))
- goto out;
- for (n = 0; a[n] != NULL; n++)
- if (g_strcmp0 (a[n], b[n]) != 0)
- goto out;
- ret = TRUE;
-out:
- return ret;
-}
-
-static gboolean
-_g_variant_equal0 (GVariant *a, GVariant *b)
-{
- gboolean ret = FALSE;
- if (a == NULL && b == NULL)
- {
- ret = TRUE;
- goto out;
- }
- if (a == NULL || b == NULL)
- goto out;
- ret = g_variant_equal (a, b);
-out:
- return ret;
-}
-
-G_GNUC_UNUSED static gboolean
-_g_value_equal (const GValue *a, const GValue *b)
-{
- gboolean ret = FALSE;
- g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b));
- switch (G_VALUE_TYPE (a))
- {
- case G_TYPE_BOOLEAN:
- ret = (g_value_get_boolean (a) == g_value_get_boolean (b));
- break;
- case G_TYPE_UCHAR:
- ret = (g_value_get_uchar (a) == g_value_get_uchar (b));
- break;
- case G_TYPE_INT:
- ret = (g_value_get_int (a) == g_value_get_int (b));
- break;
- case G_TYPE_UINT:
- ret = (g_value_get_uint (a) == g_value_get_uint (b));
- break;
- case G_TYPE_INT64:
- ret = (g_value_get_int64 (a) == g_value_get_int64 (b));
- break;
- case G_TYPE_UINT64:
- ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b));
- break;
- case G_TYPE_DOUBLE:
- {
- /* Avoid -Wfloat-equal warnings by doing a direct bit compare */
- gdouble da = g_value_get_double (a);
- gdouble db = g_value_get_double (b);
- ret = memcmp (&da, &db, sizeof (gdouble)) == 0;
- }
- break;
- case G_TYPE_STRING:
- ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0);
- break;
- case G_TYPE_VARIANT:
- ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b));
- break;
- default:
- if (G_VALUE_TYPE (a) == G_TYPE_STRV)
- ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b));
- else
- g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a)));
- break;
- }
- return ret;
-}
-
-/* ------------------------------------------------------------------------
- * Code for interface org.bluez.Agent1
- * ------------------------------------------------------------------------
- */
-
-/**
- * SECTION:AGENTOrgBluezAgent1
- * @title: AGENTOrgBluezAgent1
- * @short_description: Generated C code for the org.bluez.Agent1 D-Bus interface
- *
- * This section contains code for working with the <link linkend="gdbus-interface-org-bluez-Agent1.top_of_page">org.bluez.Agent1</link> D-Bus interface in C.
- */
-
-/* ---- Introspection data for org.bluez.Agent1 ---- */
-
-static const _ExtendedGDBusMethodInfo _agent_org_bluez_agent1_method_info_release =
-{
- {
- -1,
- (gchar *) "Release",
- NULL,
- NULL,
- NULL
- },
- "handle-release",
- FALSE
-};
-
-static const _ExtendedGDBusArgInfo _agent_org_bluez_agent1_method_info_request_pin_code_IN_ARG_device =
-{
- {
- -1,
- (gchar *) "device",
- (gchar *) "o",
- NULL
- },
- FALSE
-};
-
-static const _ExtendedGDBusArgInfo * const _agent_org_bluez_agent1_method_info_request_pin_code_IN_ARG_pointers[] =
-{
- &_agent_org_bluez_agent1_method_info_request_pin_code_IN_ARG_device,
- NULL
-};
-
-static const _ExtendedGDBusArgInfo _agent_org_bluez_agent1_method_info_request_pin_code_OUT_ARG_pincode =
-{
- {
- -1,
- (gchar *) "pincode",
- (gchar *) "s",
- NULL
- },
- FALSE
-};
-
-static const _ExtendedGDBusArgInfo * const _agent_org_bluez_agent1_method_info_request_pin_code_OUT_ARG_pointers[] =
-{
- &_agent_org_bluez_agent1_method_info_request_pin_code_OUT_ARG_pincode,
- NULL
-};
-
-static const _ExtendedGDBusMethodInfo _agent_org_bluez_agent1_method_info_request_pin_code =
-{
- {
- -1,
- (gchar *) "RequestPinCode",
- (GDBusArgInfo **) &_agent_org_bluez_agent1_method_info_request_pin_code_IN_ARG_pointers,
- (GDBusArgInfo **) &_agent_org_bluez_agent1_method_info_request_pin_code_OUT_ARG_pointers,
- NULL
- },
- "handle-request-pin-code",
- FALSE
-};
-
-static const _ExtendedGDBusArgInfo _agent_org_bluez_agent1_method_info_display_pin_code_IN_ARG_device =
-{
- {
- -1,
- (gchar *) "device",
- (gchar *) "o",
- NULL
- },
- FALSE
-};
-
-static const _ExtendedGDBusArgInfo _agent_org_bluez_agent1_method_info_display_pin_code_IN_ARG_pincode =
-{
- {
- -1,
- (gchar *) "pincode",
- (gchar *) "s",
- NULL
- },
- FALSE
-};
-
-static const _ExtendedGDBusArgInfo * const _agent_org_bluez_agent1_method_info_display_pin_code_IN_ARG_pointers[] =
-{
- &_agent_org_bluez_agent1_method_info_display_pin_code_IN_ARG_device,
- &_agent_org_bluez_agent1_method_info_display_pin_code_IN_ARG_pincode,
- NULL
-};
-
-static const _ExtendedGDBusMethodInfo _agent_org_bluez_agent1_method_info_display_pin_code =
-{
- {
- -1,
- (gchar *) "DisplayPinCode",
- (GDBusArgInfo **) &_agent_org_bluez_agent1_method_info_display_pin_code_IN_ARG_pointers,
- NULL,
- NULL
- },
- "handle-display-pin-code",
- FALSE
-};
-
-static const _ExtendedGDBusArgInfo _agent_org_bluez_agent1_method_info_request_passkey_IN_ARG_device =
-{
- {
- -1,
- (gchar *) "device",
- (gchar *) "o",
- NULL
- },
- FALSE
-};
-
-static const _ExtendedGDBusArgInfo * const _agent_org_bluez_agent1_method_info_request_passkey_IN_ARG_pointers[] =
-{
- &_agent_org_bluez_agent1_method_info_request_passkey_IN_ARG_device,
- NULL
-};
-
-static const _ExtendedGDBusArgInfo _agent_org_bluez_agent1_method_info_request_passkey_OUT_ARG_passkey =
-{
- {
- -1,
- (gchar *) "passkey",
- (gchar *) "u",
- NULL
- },
- FALSE
-};
-
-static const _ExtendedGDBusArgInfo * const _agent_org_bluez_agent1_method_info_request_passkey_OUT_ARG_pointers[] =
-{
- &_agent_org_bluez_agent1_method_info_request_passkey_OUT_ARG_passkey,
- NULL
-};
-
-static const _ExtendedGDBusMethodInfo _agent_org_bluez_agent1_method_info_request_passkey =
-{
- {
- -1,
- (gchar *) "RequestPasskey",
- (GDBusArgInfo **) &_agent_org_bluez_agent1_method_info_request_passkey_IN_ARG_pointers,
- (GDBusArgInfo **) &_agent_org_bluez_agent1_method_info_request_passkey_OUT_ARG_pointers,
- NULL
- },
- "handle-request-passkey",
- FALSE
-};
-
-static const _ExtendedGDBusArgInfo _agent_org_bluez_agent1_method_info_display_passkey_IN_ARG_device =
-{
- {
- -1,
- (gchar *) "device",
- (gchar *) "o",
- NULL
- },
- FALSE
-};
-
-static const _ExtendedGDBusArgInfo _agent_org_bluez_agent1_method_info_display_passkey_IN_ARG_passkey =
-{
- {
- -1,
- (gchar *) "passkey",
- (gchar *) "u",
- NULL
- },
- FALSE
-};
-
-static const _ExtendedGDBusArgInfo _agent_org_bluez_agent1_method_info_display_passkey_IN_ARG_entered =
-{
- {
- -1,
- (gchar *) "entered",
- (gchar *) "q",
- NULL
- },
- FALSE
-};
-
-static const _ExtendedGDBusArgInfo * const _agent_org_bluez_agent1_method_info_display_passkey_IN_ARG_pointers[] =
-{
- &_agent_org_bluez_agent1_method_info_display_passkey_IN_ARG_device,
- &_agent_org_bluez_agent1_method_info_display_passkey_IN_ARG_passkey,
- &_agent_org_bluez_agent1_method_info_display_passkey_IN_ARG_entered,
- NULL
-};
-
-static const _ExtendedGDBusMethodInfo _agent_org_bluez_agent1_method_info_display_passkey =
-{
- {
- -1,
- (gchar *) "DisplayPasskey",
- (GDBusArgInfo **) &_agent_org_bluez_agent1_method_info_display_passkey_IN_ARG_pointers,
- NULL,
- NULL
- },
- "handle-display-passkey",
- FALSE
-};
-
-static const _ExtendedGDBusArgInfo _agent_org_bluez_agent1_method_info_request_confirmation_IN_ARG_device =
-{
- {
- -1,
- (gchar *) "device",
- (gchar *) "o",
- NULL
- },
- FALSE
-};
-
-static const _ExtendedGDBusArgInfo _agent_org_bluez_agent1_method_info_request_confirmation_IN_ARG_passkey =
-{
- {
- -1,
- (gchar *) "passkey",
- (gchar *) "u",
- NULL
- },
- FALSE
-};
-
-static const _ExtendedGDBusArgInfo * const _agent_org_bluez_agent1_method_info_request_confirmation_IN_ARG_pointers[] =
-{
- &_agent_org_bluez_agent1_method_info_request_confirmation_IN_ARG_device,
- &_agent_org_bluez_agent1_method_info_request_confirmation_IN_ARG_passkey,
- NULL
-};
-
-static const _ExtendedGDBusMethodInfo _agent_org_bluez_agent1_method_info_request_confirmation =
-{
- {
- -1,
- (gchar *) "RequestConfirmation",
- (GDBusArgInfo **) &_agent_org_bluez_agent1_method_info_request_confirmation_IN_ARG_pointers,
- NULL,
- NULL
- },
- "handle-request-confirmation",
- FALSE
-};
-
-static const _ExtendedGDBusArgInfo _agent_org_bluez_agent1_method_info_request_authorization_IN_ARG_device =
-{
- {
- -1,
- (gchar *) "device",
- (gchar *) "o",
- NULL
- },
- FALSE
-};
-
-static const _ExtendedGDBusArgInfo * const _agent_org_bluez_agent1_method_info_request_authorization_IN_ARG_pointers[] =
-{
- &_agent_org_bluez_agent1_method_info_request_authorization_IN_ARG_device,
- NULL
-};
-
-static const _ExtendedGDBusMethodInfo _agent_org_bluez_agent1_method_info_request_authorization =
-{
- {
- -1,
- (gchar *) "RequestAuthorization",
- (GDBusArgInfo **) &_agent_org_bluez_agent1_method_info_request_authorization_IN_ARG_pointers,
- NULL,
- NULL
- },
- "handle-request-authorization",
- FALSE
-};
-
-static const _ExtendedGDBusArgInfo _agent_org_bluez_agent1_method_info_authorize_service_IN_ARG_device =
-{
- {
- -1,
- (gchar *) "device",
- (gchar *) "o",
- NULL
- },
- FALSE
-};
-
-static const _ExtendedGDBusArgInfo _agent_org_bluez_agent1_method_info_authorize_service_IN_ARG_uuid =
-{
- {
- -1,
- (gchar *) "uuid",
- (gchar *) "s",
- NULL
- },
- FALSE
-};
-
-static const _ExtendedGDBusArgInfo * const _agent_org_bluez_agent1_method_info_authorize_service_IN_ARG_pointers[] =
-{
- &_agent_org_bluez_agent1_method_info_authorize_service_IN_ARG_device,
- &_agent_org_bluez_agent1_method_info_authorize_service_IN_ARG_uuid,
- NULL
-};
-
-static const _ExtendedGDBusMethodInfo _agent_org_bluez_agent1_method_info_authorize_service =
-{
- {
- -1,
- (gchar *) "AuthorizeService",
- (GDBusArgInfo **) &_agent_org_bluez_agent1_method_info_authorize_service_IN_ARG_pointers,
- NULL,
- NULL
- },
- "handle-authorize-service",
- FALSE
-};
-
-static const _ExtendedGDBusMethodInfo _agent_org_bluez_agent1_method_info_cancel =
-{
- {
- -1,
- (gchar *) "Cancel",
- NULL,
- NULL,
- NULL
- },
- "handle-cancel",
- FALSE
-};
-
-static const _ExtendedGDBusMethodInfo * const _agent_org_bluez_agent1_method_info_pointers[] =
-{
- &_agent_org_bluez_agent1_method_info_release,
- &_agent_org_bluez_agent1_method_info_request_pin_code,
- &_agent_org_bluez_agent1_method_info_display_pin_code,
- &_agent_org_bluez_agent1_method_info_request_passkey,
- &_agent_org_bluez_agent1_method_info_display_passkey,
- &_agent_org_bluez_agent1_method_info_request_confirmation,
- &_agent_org_bluez_agent1_method_info_request_authorization,
- &_agent_org_bluez_agent1_method_info_authorize_service,
- &_agent_org_bluez_agent1_method_info_cancel,
- NULL
-};
-
-static const _ExtendedGDBusInterfaceInfo _agent_org_bluez_agent1_interface_info =
-{
- {
- -1,
- (gchar *) "org.bluez.Agent1",
- (GDBusMethodInfo **) &_agent_org_bluez_agent1_method_info_pointers,
- NULL,
- NULL,
- NULL
- },
- "org-bluez-agent1",
-};
-
-
-/**
- * agent_org_bluez_agent1_interface_info:
- *
- * Gets a machine-readable description of the <link linkend="gdbus-interface-org-bluez-Agent1.top_of_page">org.bluez.Agent1</link> D-Bus interface.
- *
- * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
- */
-GDBusInterfaceInfo *
-agent_org_bluez_agent1_interface_info (void)
-{
- return (GDBusInterfaceInfo *) &_agent_org_bluez_agent1_interface_info.parent_struct;
-}
-
-/**
- * agent_org_bluez_agent1_override_properties:
- * @klass: The class structure for a #GObject<!-- -->-derived class.
- * @property_id_begin: The property id to assign to the first overridden property.
- *
- * Overrides all #GObject properties in the #AGENTOrgBluezAgent1 interface for a concrete class.
- * The properties are overridden in the order they are defined.
- *
- * Returns: The last property id.
- */
-guint
-agent_org_bluez_agent1_override_properties (GObjectClass *klass, guint property_id_begin)
-{
- return property_id_begin - 1;
-}
-
-
-
-/**
- * AGENTOrgBluezAgent1:
- *
- * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Agent1.top_of_page">org.bluez.Agent1</link>.
- */
-
-/**
- * AGENTOrgBluezAgent1Iface:
- * @parent_iface: The parent interface.
- * @handle_authorize_service: Handler for the #AGENTOrgBluezAgent1::handle-authorize-service signal.
- * @handle_cancel: Handler for the #AGENTOrgBluezAgent1::handle-cancel signal.
- * @handle_display_passkey: Handler for the #AGENTOrgBluezAgent1::handle-display-passkey signal.
- * @handle_display_pin_code: Handler for the #AGENTOrgBluezAgent1::handle-display-pin-code signal.
- * @handle_release: Handler for the #AGENTOrgBluezAgent1::handle-release signal.
- * @handle_request_authorization: Handler for the #AGENTOrgBluezAgent1::handle-request-authorization signal.
- * @handle_request_confirmation: Handler for the #AGENTOrgBluezAgent1::handle-request-confirmation signal.
- * @handle_request_passkey: Handler for the #AGENTOrgBluezAgent1::handle-request-passkey signal.
- * @handle_request_pin_code: Handler for the #AGENTOrgBluezAgent1::handle-request-pin-code signal.
- *
- * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Agent1.top_of_page">org.bluez.Agent1</link>.
- */
-
-typedef AGENTOrgBluezAgent1Iface AGENTOrgBluezAgent1Interface;
-G_DEFINE_INTERFACE (AGENTOrgBluezAgent1, agent_org_bluez_agent1, G_TYPE_OBJECT);
-
-static void
-agent_org_bluez_agent1_default_init (AGENTOrgBluezAgent1Iface *iface)
-{
- /* GObject signals for incoming D-Bus method calls: */
- /**
- * AGENTOrgBluezAgent1::handle-release:
- * @object: A #AGENTOrgBluezAgent1.
- * @invocation: A #GDBusMethodInvocation.
- *
- * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Agent1.Release">Release()</link> D-Bus method.
- *
- * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call agent_org_bluez_agent1_complete_release() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
- *
- * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
- */
- g_signal_new ("handle-release",
- G_TYPE_FROM_INTERFACE (iface),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (AGENTOrgBluezAgent1Iface, handle_release),
- g_signal_accumulator_true_handled,
- NULL,
- g_cclosure_marshal_generic,
- G_TYPE_BOOLEAN,
- 1,
- G_TYPE_DBUS_METHOD_INVOCATION);
-
- /**
- * AGENTOrgBluezAgent1::handle-request-pin-code:
- * @object: A #AGENTOrgBluezAgent1.
- * @invocation: A #GDBusMethodInvocation.
- * @arg_device: Argument passed by remote caller.
- *
- * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Agent1.RequestPinCode">RequestPinCode()</link> D-Bus method.
- *
- * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call agent_org_bluez_agent1_complete_request_pin_code() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
- *
- * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
- */
- g_signal_new ("handle-request-pin-code",
- G_TYPE_FROM_INTERFACE (iface),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (AGENTOrgBluezAgent1Iface, handle_request_pin_code),
- g_signal_accumulator_true_handled,
- NULL,
- g_cclosure_marshal_generic,
- G_TYPE_BOOLEAN,
- 2,
- G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
-
- /**
- * AGENTOrgBluezAgent1::handle-display-pin-code:
- * @object: A #AGENTOrgBluezAgent1.
- * @invocation: A #GDBusMethodInvocation.
- * @arg_device: Argument passed by remote caller.
- * @arg_pincode: Argument passed by remote caller.
- *
- * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Agent1.DisplayPinCode">DisplayPinCode()</link> D-Bus method.
- *
- * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call agent_org_bluez_agent1_complete_display_pin_code() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
- *
- * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
- */
- g_signal_new ("handle-display-pin-code",
- G_TYPE_FROM_INTERFACE (iface),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (AGENTOrgBluezAgent1Iface, handle_display_pin_code),
- g_signal_accumulator_true_handled,
- NULL,
- g_cclosure_marshal_generic,
- G_TYPE_BOOLEAN,
- 3,
- G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
-
- /**
- * AGENTOrgBluezAgent1::handle-request-passkey:
- * @object: A #AGENTOrgBluezAgent1.
- * @invocation: A #GDBusMethodInvocation.
- * @arg_device: Argument passed by remote caller.
- *
- * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Agent1.RequestPasskey">RequestPasskey()</link> D-Bus method.
- *
- * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call agent_org_bluez_agent1_complete_request_passkey() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
- *
- * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
- */
- g_signal_new ("handle-request-passkey",
- G_TYPE_FROM_INTERFACE (iface),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (AGENTOrgBluezAgent1Iface, handle_request_passkey),
- g_signal_accumulator_true_handled,
- NULL,
- g_cclosure_marshal_generic,
- G_TYPE_BOOLEAN,
- 2,
- G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
-
- /**
- * AGENTOrgBluezAgent1::handle-display-passkey:
- * @object: A #AGENTOrgBluezAgent1.
- * @invocation: A #GDBusMethodInvocation.
- * @arg_device: Argument passed by remote caller.
- * @arg_passkey: Argument passed by remote caller.
- * @arg_entered: Argument passed by remote caller.
- *
- * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Agent1.DisplayPasskey">DisplayPasskey()</link> D-Bus method.
- *
- * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call agent_org_bluez_agent1_complete_display_passkey() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
- *
- * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
- */
- g_signal_new ("handle-display-passkey",
- G_TYPE_FROM_INTERFACE (iface),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (AGENTOrgBluezAgent1Iface, handle_display_passkey),
- g_signal_accumulator_true_handled,
- NULL,
- g_cclosure_marshal_generic,
- G_TYPE_BOOLEAN,
- 4,
- G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_UINT);
-
- /**
- * AGENTOrgBluezAgent1::handle-request-confirmation:
- * @object: A #AGENTOrgBluezAgent1.
- * @invocation: A #GDBusMethodInvocation.
- * @arg_device: Argument passed by remote caller.
- * @arg_passkey: Argument passed by remote caller.
- *
- * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Agent1.RequestConfirmation">RequestConfirmation()</link> D-Bus method.
- *
- * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call agent_org_bluez_agent1_complete_request_confirmation() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
- *
- * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
- */
- g_signal_new ("handle-request-confirmation",
- G_TYPE_FROM_INTERFACE (iface),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (AGENTOrgBluezAgent1Iface, handle_request_confirmation),
- g_signal_accumulator_true_handled,
- NULL,
- g_cclosure_marshal_generic,
- G_TYPE_BOOLEAN,
- 3,
- G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_UINT);
-
- /**
- * AGENTOrgBluezAgent1::handle-request-authorization:
- * @object: A #AGENTOrgBluezAgent1.
- * @invocation: A #GDBusMethodInvocation.
- * @arg_device: Argument passed by remote caller.
- *
- * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Agent1.RequestAuthorization">RequestAuthorization()</link> D-Bus method.
- *
- * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call agent_org_bluez_agent1_complete_request_authorization() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
- *
- * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
- */
- g_signal_new ("handle-request-authorization",
- G_TYPE_FROM_INTERFACE (iface),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (AGENTOrgBluezAgent1Iface, handle_request_authorization),
- g_signal_accumulator_true_handled,
- NULL,
- g_cclosure_marshal_generic,
- G_TYPE_BOOLEAN,
- 2,
- G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
-
- /**
- * AGENTOrgBluezAgent1::handle-authorize-service:
- * @object: A #AGENTOrgBluezAgent1.
- * @invocation: A #GDBusMethodInvocation.
- * @arg_device: Argument passed by remote caller.
- * @arg_uuid: Argument passed by remote caller.
- *
- * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Agent1.AuthorizeService">AuthorizeService()</link> D-Bus method.
- *
- * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call agent_org_bluez_agent1_complete_authorize_service() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
- *
- * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
- */
- g_signal_new ("handle-authorize-service",
- G_TYPE_FROM_INTERFACE (iface),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (AGENTOrgBluezAgent1Iface, handle_authorize_service),
- g_signal_accumulator_true_handled,
- NULL,
- g_cclosure_marshal_generic,
- G_TYPE_BOOLEAN,
- 3,
- G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
-
- /**
- * AGENTOrgBluezAgent1::handle-cancel:
- * @object: A #AGENTOrgBluezAgent1.
- * @invocation: A #GDBusMethodInvocation.
- *
- * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Agent1.Cancel">Cancel()</link> D-Bus method.
- *
- * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call agent_org_bluez_agent1_complete_cancel() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
- *
- * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
- */
- g_signal_new ("handle-cancel",
- G_TYPE_FROM_INTERFACE (iface),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (AGENTOrgBluezAgent1Iface, handle_cancel),
- g_signal_accumulator_true_handled,
- NULL,
- g_cclosure_marshal_generic,
- G_TYPE_BOOLEAN,
- 1,
- G_TYPE_DBUS_METHOD_INVOCATION);
-
-}
-
-/**
- * agent_org_bluez_agent1_call_release:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
- * @user_data: User data to pass to @callback.
- *
- * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Agent1.Release">Release()</link> D-Bus method on @proxy.
- * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
- * You can then call agent_org_bluez_agent1_call_release_finish() to get the result of the operation.
- *
- * See agent_org_bluez_agent1_call_release_sync() for the synchronous, blocking version of this method.
- */
-void
-agent_org_bluez_agent1_call_release (
- AGENTOrgBluezAgent1 *proxy,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- g_dbus_proxy_call (G_DBUS_PROXY (proxy),
- "Release",
- g_variant_new ("()"),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- cancellable,
- callback,
- user_data);
-}
-
-/**
- * agent_org_bluez_agent1_call_release_finish:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to agent_org_bluez_agent1_call_release().
- * @error: Return location for error or %NULL.
- *
- * Finishes an operation started with agent_org_bluez_agent1_call_release().
- *
- * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
- */
-gboolean
-agent_org_bluez_agent1_call_release_finish (
- AGENTOrgBluezAgent1 *proxy,
- GAsyncResult *res,
- GError **error)
-{
- GVariant *_ret;
- _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
- if (_ret == NULL)
- goto _out;
- g_variant_get (_ret,
- "()");
- g_variant_unref (_ret);
-_out:
- return _ret != NULL;
-}
-
-/**
- * agent_org_bluez_agent1_call_release_sync:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @error: Return location for error or %NULL.
- *
- * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Agent1.Release">Release()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
- *
- * See agent_org_bluez_agent1_call_release() for the asynchronous version of this method.
- *
- * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
- */
-gboolean
-agent_org_bluez_agent1_call_release_sync (
- AGENTOrgBluezAgent1 *proxy,
- GCancellable *cancellable,
- GError **error)
-{
- GVariant *_ret;
- _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
- "Release",
- g_variant_new ("()"),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- cancellable,
- error);
- if (_ret == NULL)
- goto _out;
- g_variant_get (_ret,
- "()");
- g_variant_unref (_ret);
-_out:
- return _ret != NULL;
-}
-
-/**
- * agent_org_bluez_agent1_call_request_pin_code:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @arg_device: Argument to pass with the method invocation.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
- * @user_data: User data to pass to @callback.
- *
- * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Agent1.RequestPinCode">RequestPinCode()</link> D-Bus method on @proxy.
- * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
- * You can then call agent_org_bluez_agent1_call_request_pin_code_finish() to get the result of the operation.
- *
- * See agent_org_bluez_agent1_call_request_pin_code_sync() for the synchronous, blocking version of this method.
- */
-void
-agent_org_bluez_agent1_call_request_pin_code (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- g_dbus_proxy_call (G_DBUS_PROXY (proxy),
- "RequestPinCode",
- g_variant_new ("(o)",
- arg_device),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- cancellable,
- callback,
- user_data);
-}
-
-/**
- * agent_org_bluez_agent1_call_request_pin_code_finish:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @out_pincode: (out): Return location for return parameter or %NULL to ignore.
- * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to agent_org_bluez_agent1_call_request_pin_code().
- * @error: Return location for error or %NULL.
- *
- * Finishes an operation started with agent_org_bluez_agent1_call_request_pin_code().
- *
- * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
- */
-gboolean
-agent_org_bluez_agent1_call_request_pin_code_finish (
- AGENTOrgBluezAgent1 *proxy,
- gchar **out_pincode,
- GAsyncResult *res,
- GError **error)
-{
- GVariant *_ret;
- _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
- if (_ret == NULL)
- goto _out;
- g_variant_get (_ret,
- "(s)",
- out_pincode);
- g_variant_unref (_ret);
-_out:
- return _ret != NULL;
-}
-
-/**
- * agent_org_bluez_agent1_call_request_pin_code_sync:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @arg_device: Argument to pass with the method invocation.
- * @out_pincode: (out): Return location for return parameter or %NULL to ignore.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @error: Return location for error or %NULL.
- *
- * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Agent1.RequestPinCode">RequestPinCode()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
- *
- * See agent_org_bluez_agent1_call_request_pin_code() for the asynchronous version of this method.
- *
- * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
- */
-gboolean
-agent_org_bluez_agent1_call_request_pin_code_sync (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- gchar **out_pincode,
- GCancellable *cancellable,
- GError **error)
-{
- GVariant *_ret;
- _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
- "RequestPinCode",
- g_variant_new ("(o)",
- arg_device),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- cancellable,
- error);
- if (_ret == NULL)
- goto _out;
- g_variant_get (_ret,
- "(s)",
- out_pincode);
- g_variant_unref (_ret);
-_out:
- return _ret != NULL;
-}
-
-/**
- * agent_org_bluez_agent1_call_display_pin_code:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @arg_device: Argument to pass with the method invocation.
- * @arg_pincode: Argument to pass with the method invocation.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
- * @user_data: User data to pass to @callback.
- *
- * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Agent1.DisplayPinCode">DisplayPinCode()</link> D-Bus method on @proxy.
- * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
- * You can then call agent_org_bluez_agent1_call_display_pin_code_finish() to get the result of the operation.
- *
- * See agent_org_bluez_agent1_call_display_pin_code_sync() for the synchronous, blocking version of this method.
- */
-void
-agent_org_bluez_agent1_call_display_pin_code (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- const gchar *arg_pincode,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- g_dbus_proxy_call (G_DBUS_PROXY (proxy),
- "DisplayPinCode",
- g_variant_new ("(os)",
- arg_device,
- arg_pincode),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- cancellable,
- callback,
- user_data);
-}
-
-/**
- * agent_org_bluez_agent1_call_display_pin_code_finish:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to agent_org_bluez_agent1_call_display_pin_code().
- * @error: Return location for error or %NULL.
- *
- * Finishes an operation started with agent_org_bluez_agent1_call_display_pin_code().
- *
- * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
- */
-gboolean
-agent_org_bluez_agent1_call_display_pin_code_finish (
- AGENTOrgBluezAgent1 *proxy,
- GAsyncResult *res,
- GError **error)
-{
- GVariant *_ret;
- _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
- if (_ret == NULL)
- goto _out;
- g_variant_get (_ret,
- "()");
- g_variant_unref (_ret);
-_out:
- return _ret != NULL;
-}
-
-/**
- * agent_org_bluez_agent1_call_display_pin_code_sync:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @arg_device: Argument to pass with the method invocation.
- * @arg_pincode: Argument to pass with the method invocation.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @error: Return location for error or %NULL.
- *
- * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Agent1.DisplayPinCode">DisplayPinCode()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
- *
- * See agent_org_bluez_agent1_call_display_pin_code() for the asynchronous version of this method.
- *
- * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
- */
-gboolean
-agent_org_bluez_agent1_call_display_pin_code_sync (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- const gchar *arg_pincode,
- GCancellable *cancellable,
- GError **error)
-{
- GVariant *_ret;
- _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
- "DisplayPinCode",
- g_variant_new ("(os)",
- arg_device,
- arg_pincode),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- cancellable,
- error);
- if (_ret == NULL)
- goto _out;
- g_variant_get (_ret,
- "()");
- g_variant_unref (_ret);
-_out:
- return _ret != NULL;
-}
-
-/**
- * agent_org_bluez_agent1_call_request_passkey:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @arg_device: Argument to pass with the method invocation.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
- * @user_data: User data to pass to @callback.
- *
- * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Agent1.RequestPasskey">RequestPasskey()</link> D-Bus method on @proxy.
- * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
- * You can then call agent_org_bluez_agent1_call_request_passkey_finish() to get the result of the operation.
- *
- * See agent_org_bluez_agent1_call_request_passkey_sync() for the synchronous, blocking version of this method.
- */
-void
-agent_org_bluez_agent1_call_request_passkey (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- g_dbus_proxy_call (G_DBUS_PROXY (proxy),
- "RequestPasskey",
- g_variant_new ("(o)",
- arg_device),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- cancellable,
- callback,
- user_data);
-}
-
-/**
- * agent_org_bluez_agent1_call_request_passkey_finish:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @out_passkey: (out): Return location for return parameter or %NULL to ignore.
- * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to agent_org_bluez_agent1_call_request_passkey().
- * @error: Return location for error or %NULL.
- *
- * Finishes an operation started with agent_org_bluez_agent1_call_request_passkey().
- *
- * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
- */
-gboolean
-agent_org_bluez_agent1_call_request_passkey_finish (
- AGENTOrgBluezAgent1 *proxy,
- guint *out_passkey,
- GAsyncResult *res,
- GError **error)
-{
- GVariant *_ret;
- _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
- if (_ret == NULL)
- goto _out;
- g_variant_get (_ret,
- "(u)",
- out_passkey);
- g_variant_unref (_ret);
-_out:
- return _ret != NULL;
-}
-
-/**
- * agent_org_bluez_agent1_call_request_passkey_sync:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @arg_device: Argument to pass with the method invocation.
- * @out_passkey: (out): Return location for return parameter or %NULL to ignore.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @error: Return location for error or %NULL.
- *
- * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Agent1.RequestPasskey">RequestPasskey()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
- *
- * See agent_org_bluez_agent1_call_request_passkey() for the asynchronous version of this method.
- *
- * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
- */
-gboolean
-agent_org_bluez_agent1_call_request_passkey_sync (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- guint *out_passkey,
- GCancellable *cancellable,
- GError **error)
-{
- GVariant *_ret;
- _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
- "RequestPasskey",
- g_variant_new ("(o)",
- arg_device),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- cancellable,
- error);
- if (_ret == NULL)
- goto _out;
- g_variant_get (_ret,
- "(u)",
- out_passkey);
- g_variant_unref (_ret);
-_out:
- return _ret != NULL;
-}
-
-/**
- * agent_org_bluez_agent1_call_display_passkey:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @arg_device: Argument to pass with the method invocation.
- * @arg_passkey: Argument to pass with the method invocation.
- * @arg_entered: Argument to pass with the method invocation.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
- * @user_data: User data to pass to @callback.
- *
- * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Agent1.DisplayPasskey">DisplayPasskey()</link> D-Bus method on @proxy.
- * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
- * You can then call agent_org_bluez_agent1_call_display_passkey_finish() to get the result of the operation.
- *
- * See agent_org_bluez_agent1_call_display_passkey_sync() for the synchronous, blocking version of this method.
- */
-void
-agent_org_bluez_agent1_call_display_passkey (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- guint arg_passkey,
- guint16 arg_entered,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- g_dbus_proxy_call (G_DBUS_PROXY (proxy),
- "DisplayPasskey",
- g_variant_new ("(ouq)",
- arg_device,
- arg_passkey,
- arg_entered),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- cancellable,
- callback,
- user_data);
-}
-
-/**
- * agent_org_bluez_agent1_call_display_passkey_finish:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to agent_org_bluez_agent1_call_display_passkey().
- * @error: Return location for error or %NULL.
- *
- * Finishes an operation started with agent_org_bluez_agent1_call_display_passkey().
- *
- * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
- */
-gboolean
-agent_org_bluez_agent1_call_display_passkey_finish (
- AGENTOrgBluezAgent1 *proxy,
- GAsyncResult *res,
- GError **error)
-{
- GVariant *_ret;
- _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
- if (_ret == NULL)
- goto _out;
- g_variant_get (_ret,
- "()");
- g_variant_unref (_ret);
-_out:
- return _ret != NULL;
-}
-
-/**
- * agent_org_bluez_agent1_call_display_passkey_sync:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @arg_device: Argument to pass with the method invocation.
- * @arg_passkey: Argument to pass with the method invocation.
- * @arg_entered: Argument to pass with the method invocation.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @error: Return location for error or %NULL.
- *
- * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Agent1.DisplayPasskey">DisplayPasskey()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
- *
- * See agent_org_bluez_agent1_call_display_passkey() for the asynchronous version of this method.
- *
- * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
- */
-gboolean
-agent_org_bluez_agent1_call_display_passkey_sync (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- guint arg_passkey,
- guint16 arg_entered,
- GCancellable *cancellable,
- GError **error)
-{
- GVariant *_ret;
- _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
- "DisplayPasskey",
- g_variant_new ("(ouq)",
- arg_device,
- arg_passkey,
- arg_entered),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- cancellable,
- error);
- if (_ret == NULL)
- goto _out;
- g_variant_get (_ret,
- "()");
- g_variant_unref (_ret);
-_out:
- return _ret != NULL;
-}
-
-/**
- * agent_org_bluez_agent1_call_request_confirmation:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @arg_device: Argument to pass with the method invocation.
- * @arg_passkey: Argument to pass with the method invocation.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
- * @user_data: User data to pass to @callback.
- *
- * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Agent1.RequestConfirmation">RequestConfirmation()</link> D-Bus method on @proxy.
- * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
- * You can then call agent_org_bluez_agent1_call_request_confirmation_finish() to get the result of the operation.
- *
- * See agent_org_bluez_agent1_call_request_confirmation_sync() for the synchronous, blocking version of this method.
- */
-void
-agent_org_bluez_agent1_call_request_confirmation (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- guint arg_passkey,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- g_dbus_proxy_call (G_DBUS_PROXY (proxy),
- "RequestConfirmation",
- g_variant_new ("(ou)",
- arg_device,
- arg_passkey),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- cancellable,
- callback,
- user_data);
-}
-
-/**
- * agent_org_bluez_agent1_call_request_confirmation_finish:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to agent_org_bluez_agent1_call_request_confirmation().
- * @error: Return location for error or %NULL.
- *
- * Finishes an operation started with agent_org_bluez_agent1_call_request_confirmation().
- *
- * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
- */
-gboolean
-agent_org_bluez_agent1_call_request_confirmation_finish (
- AGENTOrgBluezAgent1 *proxy,
- GAsyncResult *res,
- GError **error)
-{
- GVariant *_ret;
- _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
- if (_ret == NULL)
- goto _out;
- g_variant_get (_ret,
- "()");
- g_variant_unref (_ret);
-_out:
- return _ret != NULL;
-}
-
-/**
- * agent_org_bluez_agent1_call_request_confirmation_sync:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @arg_device: Argument to pass with the method invocation.
- * @arg_passkey: Argument to pass with the method invocation.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @error: Return location for error or %NULL.
- *
- * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Agent1.RequestConfirmation">RequestConfirmation()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
- *
- * See agent_org_bluez_agent1_call_request_confirmation() for the asynchronous version of this method.
- *
- * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
- */
-gboolean
-agent_org_bluez_agent1_call_request_confirmation_sync (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- guint arg_passkey,
- GCancellable *cancellable,
- GError **error)
-{
- GVariant *_ret;
- _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
- "RequestConfirmation",
- g_variant_new ("(ou)",
- arg_device,
- arg_passkey),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- cancellable,
- error);
- if (_ret == NULL)
- goto _out;
- g_variant_get (_ret,
- "()");
- g_variant_unref (_ret);
-_out:
- return _ret != NULL;
-}
-
-/**
- * agent_org_bluez_agent1_call_request_authorization:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @arg_device: Argument to pass with the method invocation.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
- * @user_data: User data to pass to @callback.
- *
- * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Agent1.RequestAuthorization">RequestAuthorization()</link> D-Bus method on @proxy.
- * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
- * You can then call agent_org_bluez_agent1_call_request_authorization_finish() to get the result of the operation.
- *
- * See agent_org_bluez_agent1_call_request_authorization_sync() for the synchronous, blocking version of this method.
- */
-void
-agent_org_bluez_agent1_call_request_authorization (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- g_dbus_proxy_call (G_DBUS_PROXY (proxy),
- "RequestAuthorization",
- g_variant_new ("(o)",
- arg_device),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- cancellable,
- callback,
- user_data);
-}
-
-/**
- * agent_org_bluez_agent1_call_request_authorization_finish:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to agent_org_bluez_agent1_call_request_authorization().
- * @error: Return location for error or %NULL.
- *
- * Finishes an operation started with agent_org_bluez_agent1_call_request_authorization().
- *
- * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
- */
-gboolean
-agent_org_bluez_agent1_call_request_authorization_finish (
- AGENTOrgBluezAgent1 *proxy,
- GAsyncResult *res,
- GError **error)
-{
- GVariant *_ret;
- _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
- if (_ret == NULL)
- goto _out;
- g_variant_get (_ret,
- "()");
- g_variant_unref (_ret);
-_out:
- return _ret != NULL;
-}
-
-/**
- * agent_org_bluez_agent1_call_request_authorization_sync:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @arg_device: Argument to pass with the method invocation.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @error: Return location for error or %NULL.
- *
- * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Agent1.RequestAuthorization">RequestAuthorization()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
- *
- * See agent_org_bluez_agent1_call_request_authorization() for the asynchronous version of this method.
- *
- * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
- */
-gboolean
-agent_org_bluez_agent1_call_request_authorization_sync (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- GCancellable *cancellable,
- GError **error)
-{
- GVariant *_ret;
- _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
- "RequestAuthorization",
- g_variant_new ("(o)",
- arg_device),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- cancellable,
- error);
- if (_ret == NULL)
- goto _out;
- g_variant_get (_ret,
- "()");
- g_variant_unref (_ret);
-_out:
- return _ret != NULL;
-}
-
-/**
- * agent_org_bluez_agent1_call_authorize_service:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @arg_device: Argument to pass with the method invocation.
- * @arg_uuid: Argument to pass with the method invocation.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
- * @user_data: User data to pass to @callback.
- *
- * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Agent1.AuthorizeService">AuthorizeService()</link> D-Bus method on @proxy.
- * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
- * You can then call agent_org_bluez_agent1_call_authorize_service_finish() to get the result of the operation.
- *
- * See agent_org_bluez_agent1_call_authorize_service_sync() for the synchronous, blocking version of this method.
- */
-void
-agent_org_bluez_agent1_call_authorize_service (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- const gchar *arg_uuid,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- g_dbus_proxy_call (G_DBUS_PROXY (proxy),
- "AuthorizeService",
- g_variant_new ("(os)",
- arg_device,
- arg_uuid),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- cancellable,
- callback,
- user_data);
-}
-
-/**
- * agent_org_bluez_agent1_call_authorize_service_finish:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to agent_org_bluez_agent1_call_authorize_service().
- * @error: Return location for error or %NULL.
- *
- * Finishes an operation started with agent_org_bluez_agent1_call_authorize_service().
- *
- * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
- */
-gboolean
-agent_org_bluez_agent1_call_authorize_service_finish (
- AGENTOrgBluezAgent1 *proxy,
- GAsyncResult *res,
- GError **error)
-{
- GVariant *_ret;
- _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
- if (_ret == NULL)
- goto _out;
- g_variant_get (_ret,
- "()");
- g_variant_unref (_ret);
-_out:
- return _ret != NULL;
-}
-
-/**
- * agent_org_bluez_agent1_call_authorize_service_sync:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @arg_device: Argument to pass with the method invocation.
- * @arg_uuid: Argument to pass with the method invocation.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @error: Return location for error or %NULL.
- *
- * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Agent1.AuthorizeService">AuthorizeService()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
- *
- * See agent_org_bluez_agent1_call_authorize_service() for the asynchronous version of this method.
- *
- * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
- */
-gboolean
-agent_org_bluez_agent1_call_authorize_service_sync (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- const gchar *arg_uuid,
- GCancellable *cancellable,
- GError **error)
-{
- GVariant *_ret;
- _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
- "AuthorizeService",
- g_variant_new ("(os)",
- arg_device,
- arg_uuid),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- cancellable,
- error);
- if (_ret == NULL)
- goto _out;
- g_variant_get (_ret,
- "()");
- g_variant_unref (_ret);
-_out:
- return _ret != NULL;
-}
-
-/**
- * agent_org_bluez_agent1_call_cancel:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
- * @user_data: User data to pass to @callback.
- *
- * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Agent1.Cancel">Cancel()</link> D-Bus method on @proxy.
- * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
- * You can then call agent_org_bluez_agent1_call_cancel_finish() to get the result of the operation.
- *
- * See agent_org_bluez_agent1_call_cancel_sync() for the synchronous, blocking version of this method.
- */
-void
-agent_org_bluez_agent1_call_cancel (
- AGENTOrgBluezAgent1 *proxy,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- g_dbus_proxy_call (G_DBUS_PROXY (proxy),
- "Cancel",
- g_variant_new ("()"),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- cancellable,
- callback,
- user_data);
-}
-
-/**
- * agent_org_bluez_agent1_call_cancel_finish:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to agent_org_bluez_agent1_call_cancel().
- * @error: Return location for error or %NULL.
- *
- * Finishes an operation started with agent_org_bluez_agent1_call_cancel().
- *
- * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
- */
-gboolean
-agent_org_bluez_agent1_call_cancel_finish (
- AGENTOrgBluezAgent1 *proxy,
- GAsyncResult *res,
- GError **error)
-{
- GVariant *_ret;
- _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
- if (_ret == NULL)
- goto _out;
- g_variant_get (_ret,
- "()");
- g_variant_unref (_ret);
-_out:
- return _ret != NULL;
-}
-
-/**
- * agent_org_bluez_agent1_call_cancel_sync:
- * @proxy: A #AGENTOrgBluezAgent1Proxy.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @error: Return location for error or %NULL.
- *
- * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Agent1.Cancel">Cancel()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
- *
- * See agent_org_bluez_agent1_call_cancel() for the asynchronous version of this method.
- *
- * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
- */
-gboolean
-agent_org_bluez_agent1_call_cancel_sync (
- AGENTOrgBluezAgent1 *proxy,
- GCancellable *cancellable,
- GError **error)
-{
- GVariant *_ret;
- _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
- "Cancel",
- g_variant_new ("()"),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- cancellable,
- error);
- if (_ret == NULL)
- goto _out;
- g_variant_get (_ret,
- "()");
- g_variant_unref (_ret);
-_out:
- return _ret != NULL;
-}
-
-/**
- * agent_org_bluez_agent1_complete_release:
- * @object: A #AGENTOrgBluezAgent1.
- * @invocation: (transfer full): A #GDBusMethodInvocation.
- *
- * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Agent1.Release">Release()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
- *
- * This method will free @invocation, you cannot use it afterwards.
- */
-void
-agent_org_bluez_agent1_complete_release (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation)
-{
- g_dbus_method_invocation_return_value (invocation,
- g_variant_new ("()"));
-}
-
-/**
- * agent_org_bluez_agent1_complete_request_pin_code:
- * @object: A #AGENTOrgBluezAgent1.
- * @invocation: (transfer full): A #GDBusMethodInvocation.
- * @pincode: Parameter to return.
- *
- * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Agent1.RequestPinCode">RequestPinCode()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
- *
- * This method will free @invocation, you cannot use it afterwards.
- */
-void
-agent_org_bluez_agent1_complete_request_pin_code (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation,
- const gchar *pincode)
-{
- g_dbus_method_invocation_return_value (invocation,
- g_variant_new ("(s)",
- pincode));
-}
-
-/**
- * agent_org_bluez_agent1_complete_display_pin_code:
- * @object: A #AGENTOrgBluezAgent1.
- * @invocation: (transfer full): A #GDBusMethodInvocation.
- *
- * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Agent1.DisplayPinCode">DisplayPinCode()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
- *
- * This method will free @invocation, you cannot use it afterwards.
- */
-void
-agent_org_bluez_agent1_complete_display_pin_code (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation)
-{
- g_dbus_method_invocation_return_value (invocation,
- g_variant_new ("()"));
-}
-
-/**
- * agent_org_bluez_agent1_complete_request_passkey:
- * @object: A #AGENTOrgBluezAgent1.
- * @invocation: (transfer full): A #GDBusMethodInvocation.
- * @passkey: Parameter to return.
- *
- * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Agent1.RequestPasskey">RequestPasskey()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
- *
- * This method will free @invocation, you cannot use it afterwards.
- */
-void
-agent_org_bluez_agent1_complete_request_passkey (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation,
- guint passkey)
-{
- g_dbus_method_invocation_return_value (invocation,
- g_variant_new ("(u)",
- passkey));
-}
-
-/**
- * agent_org_bluez_agent1_complete_display_passkey:
- * @object: A #AGENTOrgBluezAgent1.
- * @invocation: (transfer full): A #GDBusMethodInvocation.
- *
- * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Agent1.DisplayPasskey">DisplayPasskey()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
- *
- * This method will free @invocation, you cannot use it afterwards.
- */
-void
-agent_org_bluez_agent1_complete_display_passkey (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation)
-{
- g_dbus_method_invocation_return_value (invocation,
- g_variant_new ("()"));
-}
-
-/**
- * agent_org_bluez_agent1_complete_request_confirmation:
- * @object: A #AGENTOrgBluezAgent1.
- * @invocation: (transfer full): A #GDBusMethodInvocation.
- *
- * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Agent1.RequestConfirmation">RequestConfirmation()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
- *
- * This method will free @invocation, you cannot use it afterwards.
- */
-void
-agent_org_bluez_agent1_complete_request_confirmation (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation)
-{
- g_dbus_method_invocation_return_value (invocation,
- g_variant_new ("()"));
-}
-
-/**
- * agent_org_bluez_agent1_complete_request_authorization:
- * @object: A #AGENTOrgBluezAgent1.
- * @invocation: (transfer full): A #GDBusMethodInvocation.
- *
- * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Agent1.RequestAuthorization">RequestAuthorization()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
- *
- * This method will free @invocation, you cannot use it afterwards.
- */
-void
-agent_org_bluez_agent1_complete_request_authorization (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation)
-{
- g_dbus_method_invocation_return_value (invocation,
- g_variant_new ("()"));
-}
-
-/**
- * agent_org_bluez_agent1_complete_authorize_service:
- * @object: A #AGENTOrgBluezAgent1.
- * @invocation: (transfer full): A #GDBusMethodInvocation.
- *
- * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Agent1.AuthorizeService">AuthorizeService()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
- *
- * This method will free @invocation, you cannot use it afterwards.
- */
-void
-agent_org_bluez_agent1_complete_authorize_service (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation)
-{
- g_dbus_method_invocation_return_value (invocation,
- g_variant_new ("()"));
-}
-
-/**
- * agent_org_bluez_agent1_complete_cancel:
- * @object: A #AGENTOrgBluezAgent1.
- * @invocation: (transfer full): A #GDBusMethodInvocation.
- *
- * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Agent1.Cancel">Cancel()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
- *
- * This method will free @invocation, you cannot use it afterwards.
- */
-void
-agent_org_bluez_agent1_complete_cancel (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation)
-{
- g_dbus_method_invocation_return_value (invocation,
- g_variant_new ("()"));
-}
-
-/* ------------------------------------------------------------------------ */
-
-/**
- * AGENTOrgBluezAgent1Proxy:
- *
- * The #AGENTOrgBluezAgent1Proxy structure contains only private data and should only be accessed using the provided API.
- */
-
-/**
- * AGENTOrgBluezAgent1ProxyClass:
- * @parent_class: The parent class.
- *
- * Class structure for #AGENTOrgBluezAgent1Proxy.
- */
-
-struct _AGENTOrgBluezAgent1ProxyPrivate
-{
- GData *qdata;
-};
-
-static void agent_org_bluez_agent1_proxy_iface_init (AGENTOrgBluezAgent1Iface *iface);
-
-#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
-G_DEFINE_TYPE_WITH_CODE (AGENTOrgBluezAgent1Proxy, agent_org_bluez_agent1_proxy, G_TYPE_DBUS_PROXY,
- G_ADD_PRIVATE (AGENTOrgBluezAgent1Proxy)
- G_IMPLEMENT_INTERFACE (AGENT_TYPE_ORG_BLUEZ_AGENT1, agent_org_bluez_agent1_proxy_iface_init));
-
-#else
-G_DEFINE_TYPE_WITH_CODE (AGENTOrgBluezAgent1Proxy, agent_org_bluez_agent1_proxy, G_TYPE_DBUS_PROXY,
- G_IMPLEMENT_INTERFACE (AGENT_TYPE_ORG_BLUEZ_AGENT1, agent_org_bluez_agent1_proxy_iface_init));
-
-#endif
-static void
-agent_org_bluez_agent1_proxy_finalize (GObject *object)
-{
- AGENTOrgBluezAgent1Proxy *proxy = AGENT_ORG_BLUEZ_AGENT1_PROXY (object);
- g_datalist_clear (&proxy->priv->qdata);
- G_OBJECT_CLASS (agent_org_bluez_agent1_proxy_parent_class)->finalize (object);
-}
-
-static void
-agent_org_bluez_agent1_proxy_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec G_GNUC_UNUSED)
-{
-}
-
-static void
-agent_org_bluez_agent1_proxy_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec G_GNUC_UNUSED)
-{
-}
-
-static void
-agent_org_bluez_agent1_proxy_g_signal (GDBusProxy *proxy,
- const gchar *sender_name G_GNUC_UNUSED,
- const gchar *signal_name,
- GVariant *parameters)
-{
- _ExtendedGDBusSignalInfo *info;
- GVariantIter iter;
- GVariant *child;
- GValue *paramv;
- guint num_params;
- guint n;
- guint signal_id;
- info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_agent_org_bluez_agent1_interface_info.parent_struct, signal_name);
- if (info == NULL)
- return;
- num_params = g_variant_n_children (parameters);
- paramv = g_new0 (GValue, num_params + 1);
- g_value_init (&paramv[0], AGENT_TYPE_ORG_BLUEZ_AGENT1);
- g_value_set_object (&paramv[0], proxy);
- g_variant_iter_init (&iter, parameters);
- n = 1;
- while ((child = g_variant_iter_next_value (&iter)) != NULL)
- {
- _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
- if (arg_info->use_gvariant)
- {
- g_value_init (&paramv[n], G_TYPE_VARIANT);
- g_value_set_variant (&paramv[n], child);
- n++;
- }
- else
- g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
- g_variant_unref (child);
- }
- signal_id = g_signal_lookup (info->signal_name, AGENT_TYPE_ORG_BLUEZ_AGENT1);
- g_signal_emitv (paramv, signal_id, 0, NULL);
- for (n = 0; n < num_params + 1; n++)
- g_value_unset (&paramv[n]);
- g_free (paramv);
-}
-
-static void
-agent_org_bluez_agent1_proxy_g_properties_changed (GDBusProxy *_proxy,
- GVariant *changed_properties,
- const gchar *const *invalidated_properties)
-{
- AGENTOrgBluezAgent1Proxy *proxy = AGENT_ORG_BLUEZ_AGENT1_PROXY (_proxy);
- guint n;
- const gchar *key;
- GVariantIter *iter;
- _ExtendedGDBusPropertyInfo *info;
- g_variant_get (changed_properties, "a{sv}", &iter);
- while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
- {
- info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_agent_org_bluez_agent1_interface_info.parent_struct, key);
- g_datalist_remove_data (&proxy->priv->qdata, key);
- if (info != NULL)
- g_object_notify (G_OBJECT (proxy), info->hyphen_name);
- }
- g_variant_iter_free (iter);
- for (n = 0; invalidated_properties[n] != NULL; n++)
- {
- info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_agent_org_bluez_agent1_interface_info.parent_struct, invalidated_properties[n]);
- g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
- if (info != NULL)
- g_object_notify (G_OBJECT (proxy), info->hyphen_name);
- }
-}
-
-static void
-agent_org_bluez_agent1_proxy_init (AGENTOrgBluezAgent1Proxy *proxy)
-{
-#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
- proxy->priv = agent_org_bluez_agent1_proxy_get_instance_private (proxy);
-#else
- proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, AGENT_TYPE_ORG_BLUEZ_AGENT1_PROXY, AGENTOrgBluezAgent1ProxyPrivate);
-#endif
-
- g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), agent_org_bluez_agent1_interface_info ());
-}
-
-static void
-agent_org_bluez_agent1_proxy_class_init (AGENTOrgBluezAgent1ProxyClass *klass)
-{
- GObjectClass *gobject_class;
- GDBusProxyClass *proxy_class;
-
- gobject_class = G_OBJECT_CLASS (klass);
- gobject_class->finalize = agent_org_bluez_agent1_proxy_finalize;
- gobject_class->get_property = agent_org_bluez_agent1_proxy_get_property;
- gobject_class->set_property = agent_org_bluez_agent1_proxy_set_property;
-
- proxy_class = G_DBUS_PROXY_CLASS (klass);
- proxy_class->g_signal = agent_org_bluez_agent1_proxy_g_signal;
- proxy_class->g_properties_changed = agent_org_bluez_agent1_proxy_g_properties_changed;
-
-#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
- g_type_class_add_private (klass, sizeof (AGENTOrgBluezAgent1ProxyPrivate));
-#endif
-}
-
-static void
-agent_org_bluez_agent1_proxy_iface_init (AGENTOrgBluezAgent1Iface *iface)
-{
-}
-
-/**
- * agent_org_bluez_agent1_proxy_new:
- * @connection: A #GDBusConnection.
- * @flags: Flags from the #GDBusProxyFlags enumeration.
- * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
- * @object_path: An object path.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
- * @user_data: User data to pass to @callback.
- *
- * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Agent1.top_of_page">org.bluez.Agent1</link>. See g_dbus_proxy_new() for more details.
- *
- * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
- * You can then call agent_org_bluez_agent1_proxy_new_finish() to get the result of the operation.
- *
- * See agent_org_bluez_agent1_proxy_new_sync() for the synchronous, blocking version of this constructor.
- */
-void
-agent_org_bluez_agent1_proxy_new (
- GDBusConnection *connection,
- GDBusProxyFlags flags,
- const gchar *name,
- const gchar *object_path,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- g_async_initable_new_async (AGENT_TYPE_ORG_BLUEZ_AGENT1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.bluez.Agent1", NULL);
-}
-
-/**
- * agent_org_bluez_agent1_proxy_new_finish:
- * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to agent_org_bluez_agent1_proxy_new().
- * @error: Return location for error or %NULL
- *
- * Finishes an operation started with agent_org_bluez_agent1_proxy_new().
- *
- * Returns: (transfer full) (type AGENTOrgBluezAgent1Proxy): The constructed proxy object or %NULL if @error is set.
- */
-AGENTOrgBluezAgent1 *
-agent_org_bluez_agent1_proxy_new_finish (
- GAsyncResult *res,
- GError **error)
-{
- GObject *ret;
- GObject *source_object;
- source_object = g_async_result_get_source_object (res);
- ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
- g_object_unref (source_object);
- if (ret != NULL)
- return AGENT_ORG_BLUEZ_AGENT1 (ret);
- else
- return NULL;
-}
-
-/**
- * agent_org_bluez_agent1_proxy_new_sync:
- * @connection: A #GDBusConnection.
- * @flags: Flags from the #GDBusProxyFlags enumeration.
- * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
- * @object_path: An object path.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @error: Return location for error or %NULL
- *
- * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Agent1.top_of_page">org.bluez.Agent1</link>. See g_dbus_proxy_new_sync() for more details.
- *
- * The calling thread is blocked until a reply is received.
- *
- * See agent_org_bluez_agent1_proxy_new() for the asynchronous version of this constructor.
- *
- * Returns: (transfer full) (type AGENTOrgBluezAgent1Proxy): The constructed proxy object or %NULL if @error is set.
- */
-AGENTOrgBluezAgent1 *
-agent_org_bluez_agent1_proxy_new_sync (
- GDBusConnection *connection,
- GDBusProxyFlags flags,
- const gchar *name,
- const gchar *object_path,
- GCancellable *cancellable,
- GError **error)
-{
- GInitable *ret;
- ret = g_initable_new (AGENT_TYPE_ORG_BLUEZ_AGENT1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.bluez.Agent1", NULL);
- if (ret != NULL)
- return AGENT_ORG_BLUEZ_AGENT1 (ret);
- else
- return NULL;
-}
-
-
-/**
- * agent_org_bluez_agent1_proxy_new_for_bus:
- * @bus_type: A #GBusType.
- * @flags: Flags from the #GDBusProxyFlags enumeration.
- * @name: A bus name (well-known or unique).
- * @object_path: An object path.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
- * @user_data: User data to pass to @callback.
- *
- * Like agent_org_bluez_agent1_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
- *
- * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
- * You can then call agent_org_bluez_agent1_proxy_new_for_bus_finish() to get the result of the operation.
- *
- * See agent_org_bluez_agent1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
- */
-void
-agent_org_bluez_agent1_proxy_new_for_bus (
- GBusType bus_type,
- GDBusProxyFlags flags,
- const gchar *name,
- const gchar *object_path,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- g_async_initable_new_async (AGENT_TYPE_ORG_BLUEZ_AGENT1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.Agent1", NULL);
-}
-
-/**
- * agent_org_bluez_agent1_proxy_new_for_bus_finish:
- * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to agent_org_bluez_agent1_proxy_new_for_bus().
- * @error: Return location for error or %NULL
- *
- * Finishes an operation started with agent_org_bluez_agent1_proxy_new_for_bus().
- *
- * Returns: (transfer full) (type AGENTOrgBluezAgent1Proxy): The constructed proxy object or %NULL if @error is set.
- */
-AGENTOrgBluezAgent1 *
-agent_org_bluez_agent1_proxy_new_for_bus_finish (
- GAsyncResult *res,
- GError **error)
-{
- GObject *ret;
- GObject *source_object;
- source_object = g_async_result_get_source_object (res);
- ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
- g_object_unref (source_object);
- if (ret != NULL)
- return AGENT_ORG_BLUEZ_AGENT1 (ret);
- else
- return NULL;
-}
-
-/**
- * agent_org_bluez_agent1_proxy_new_for_bus_sync:
- * @bus_type: A #GBusType.
- * @flags: Flags from the #GDBusProxyFlags enumeration.
- * @name: A bus name (well-known or unique).
- * @object_path: An object path.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @error: Return location for error or %NULL
- *
- * Like agent_org_bluez_agent1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
- *
- * The calling thread is blocked until a reply is received.
- *
- * See agent_org_bluez_agent1_proxy_new_for_bus() for the asynchronous version of this constructor.
- *
- * Returns: (transfer full) (type AGENTOrgBluezAgent1Proxy): The constructed proxy object or %NULL if @error is set.
- */
-AGENTOrgBluezAgent1 *
-agent_org_bluez_agent1_proxy_new_for_bus_sync (
- GBusType bus_type,
- GDBusProxyFlags flags,
- const gchar *name,
- const gchar *object_path,
- GCancellable *cancellable,
- GError **error)
-{
- GInitable *ret;
- ret = g_initable_new (AGENT_TYPE_ORG_BLUEZ_AGENT1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.Agent1", NULL);
- if (ret != NULL)
- return AGENT_ORG_BLUEZ_AGENT1 (ret);
- else
- return NULL;
-}
-
-
-/* ------------------------------------------------------------------------ */
-
-/**
- * AGENTOrgBluezAgent1Skeleton:
- *
- * The #AGENTOrgBluezAgent1Skeleton structure contains only private data and should only be accessed using the provided API.
- */
-
-/**
- * AGENTOrgBluezAgent1SkeletonClass:
- * @parent_class: The parent class.
- *
- * Class structure for #AGENTOrgBluezAgent1Skeleton.
- */
-
-struct _AGENTOrgBluezAgent1SkeletonPrivate
-{
- GValue *properties;
- GList *changed_properties;
- GSource *changed_properties_idle_source;
- GMainContext *context;
- GMutex lock;
-};
-
-static void
-_agent_org_bluez_agent1_skeleton_handle_method_call (
- GDBusConnection *connection G_GNUC_UNUSED,
- const gchar *sender G_GNUC_UNUSED,
- const gchar *object_path G_GNUC_UNUSED,
- const gchar *interface_name,
- const gchar *method_name,
- GVariant *parameters,
- GDBusMethodInvocation *invocation,
- gpointer user_data)
-{
- AGENTOrgBluezAgent1Skeleton *skeleton = AGENT_ORG_BLUEZ_AGENT1_SKELETON (user_data);
- _ExtendedGDBusMethodInfo *info;
- GVariantIter iter;
- GVariant *child;
- GValue *paramv;
- guint num_params;
- guint num_extra;
- guint n;
- guint signal_id;
- GValue return_value = G_VALUE_INIT;
- info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
- g_assert (info != NULL);
- num_params = g_variant_n_children (parameters);
- num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
- n = 0;
- g_value_init (&paramv[n], AGENT_TYPE_ORG_BLUEZ_AGENT1);
- g_value_set_object (&paramv[n++], skeleton);
- g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
- g_value_set_object (&paramv[n++], invocation);
- if (info->pass_fdlist)
- {
-#ifdef G_OS_UNIX
- g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
- g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
-#else
- g_assert_not_reached ();
-#endif
- }
- g_variant_iter_init (&iter, parameters);
- while ((child = g_variant_iter_next_value (&iter)) != NULL)
- {
- _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
- if (arg_info->use_gvariant)
- {
- g_value_init (&paramv[n], G_TYPE_VARIANT);
- g_value_set_variant (&paramv[n], child);
- n++;
- }
- else
- g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
- g_variant_unref (child);
- }
- signal_id = g_signal_lookup (info->signal_name, AGENT_TYPE_ORG_BLUEZ_AGENT1);
- g_value_init (&return_value, G_TYPE_BOOLEAN);
- g_signal_emitv (paramv, signal_id, 0, &return_value);
- if (!g_value_get_boolean (&return_value))
- g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name);
- g_value_unset (&return_value);
- for (n = 0; n < num_params + num_extra; n++)
- g_value_unset (&paramv[n]);
- g_free (paramv);
-}
-
-static GVariant *
-_agent_org_bluez_agent1_skeleton_handle_get_property (
- GDBusConnection *connection G_GNUC_UNUSED,
- const gchar *sender G_GNUC_UNUSED,
- const gchar *object_path G_GNUC_UNUSED,
- const gchar *interface_name G_GNUC_UNUSED,
- const gchar *property_name,
- GError **error,
- gpointer user_data)
-{
- AGENTOrgBluezAgent1Skeleton *skeleton = AGENT_ORG_BLUEZ_AGENT1_SKELETON (user_data);
- GValue value = G_VALUE_INIT;
- GParamSpec *pspec;
- _ExtendedGDBusPropertyInfo *info;
- GVariant *ret;
- ret = NULL;
- info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_agent_org_bluez_agent1_interface_info.parent_struct, property_name);
- g_assert (info != NULL);
- pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
- if (pspec == NULL)
- {
- g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
- }
- else
- {
- g_value_init (&value, pspec->value_type);
- g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
- ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
- g_value_unset (&value);
- }
- return ret;
-}
-
-static gboolean
-_agent_org_bluez_agent1_skeleton_handle_set_property (
- GDBusConnection *connection G_GNUC_UNUSED,
- const gchar *sender G_GNUC_UNUSED,
- const gchar *object_path G_GNUC_UNUSED,
- const gchar *interface_name G_GNUC_UNUSED,
- const gchar *property_name,
- GVariant *variant,
- GError **error,
- gpointer user_data)
-{
- AGENTOrgBluezAgent1Skeleton *skeleton = AGENT_ORG_BLUEZ_AGENT1_SKELETON (user_data);
- GValue value = G_VALUE_INIT;
- GParamSpec *pspec;
- _ExtendedGDBusPropertyInfo *info;
- gboolean ret;
- ret = FALSE;
- info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_agent_org_bluez_agent1_interface_info.parent_struct, property_name);
- g_assert (info != NULL);
- pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
- if (pspec == NULL)
- {
- g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
- }
- else
- {
- if (info->use_gvariant)
- g_value_set_variant (&value, variant);
- else
- g_dbus_gvariant_to_gvalue (variant, &value);
- g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
- g_value_unset (&value);
- ret = TRUE;
- }
- return ret;
-}
-
-static const GDBusInterfaceVTable _agent_org_bluez_agent1_skeleton_vtable =
-{
- _agent_org_bluez_agent1_skeleton_handle_method_call,
- _agent_org_bluez_agent1_skeleton_handle_get_property,
- _agent_org_bluez_agent1_skeleton_handle_set_property,
- {NULL}
-};
-
-static GDBusInterfaceInfo *
-agent_org_bluez_agent1_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
-{
- return agent_org_bluez_agent1_interface_info ();
-}
-
-static GDBusInterfaceVTable *
-agent_org_bluez_agent1_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
-{
- return (GDBusInterfaceVTable *) &_agent_org_bluez_agent1_skeleton_vtable;
-}
-
-static GVariant *
-agent_org_bluez_agent1_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
-{
- AGENTOrgBluezAgent1Skeleton *skeleton = AGENT_ORG_BLUEZ_AGENT1_SKELETON (_skeleton);
-
- GVariantBuilder builder;
- guint n;
- g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
- if (_agent_org_bluez_agent1_interface_info.parent_struct.properties == NULL)
- goto out;
- for (n = 0; _agent_org_bluez_agent1_interface_info.parent_struct.properties[n] != NULL; n++)
- {
- GDBusPropertyInfo *info = _agent_org_bluez_agent1_interface_info.parent_struct.properties[n];
- if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
- {
- GVariant *value;
- value = _agent_org_bluez_agent1_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.bluez.Agent1", info->name, NULL, skeleton);
- if (value != NULL)
- {
- g_variant_take_ref (value);
- g_variant_builder_add (&builder, "{sv}", info->name, value);
- g_variant_unref (value);
- }
- }
- }
-out:
- return g_variant_builder_end (&builder);
-}
-
-static void
-agent_org_bluez_agent1_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
-{
-}
-
-static void agent_org_bluez_agent1_skeleton_iface_init (AGENTOrgBluezAgent1Iface *iface);
-#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
-G_DEFINE_TYPE_WITH_CODE (AGENTOrgBluezAgent1Skeleton, agent_org_bluez_agent1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
- G_ADD_PRIVATE (AGENTOrgBluezAgent1Skeleton)
- G_IMPLEMENT_INTERFACE (AGENT_TYPE_ORG_BLUEZ_AGENT1, agent_org_bluez_agent1_skeleton_iface_init));
-
-#else
-G_DEFINE_TYPE_WITH_CODE (AGENTOrgBluezAgent1Skeleton, agent_org_bluez_agent1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
- G_IMPLEMENT_INTERFACE (AGENT_TYPE_ORG_BLUEZ_AGENT1, agent_org_bluez_agent1_skeleton_iface_init));
-
-#endif
-static void
-agent_org_bluez_agent1_skeleton_finalize (GObject *object)
-{
- AGENTOrgBluezAgent1Skeleton *skeleton = AGENT_ORG_BLUEZ_AGENT1_SKELETON (object);
- g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
- if (skeleton->priv->changed_properties_idle_source != NULL)
- g_source_destroy (skeleton->priv->changed_properties_idle_source);
- g_main_context_unref (skeleton->priv->context);
- g_mutex_clear (&skeleton->priv->lock);
- G_OBJECT_CLASS (agent_org_bluez_agent1_skeleton_parent_class)->finalize (object);
-}
-
-static void
-agent_org_bluez_agent1_skeleton_init (AGENTOrgBluezAgent1Skeleton *skeleton)
-{
-#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
- skeleton->priv = agent_org_bluez_agent1_skeleton_get_instance_private (skeleton);
-#else
- skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, AGENT_TYPE_ORG_BLUEZ_AGENT1_SKELETON, AGENTOrgBluezAgent1SkeletonPrivate);
-#endif
-
- g_mutex_init (&skeleton->priv->lock);
- skeleton->priv->context = g_main_context_ref_thread_default ();
-}
-
-static void
-agent_org_bluez_agent1_skeleton_class_init (AGENTOrgBluezAgent1SkeletonClass *klass)
-{
- GObjectClass *gobject_class;
- GDBusInterfaceSkeletonClass *skeleton_class;
-
- gobject_class = G_OBJECT_CLASS (klass);
- gobject_class->finalize = agent_org_bluez_agent1_skeleton_finalize;
-
- skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
- skeleton_class->get_info = agent_org_bluez_agent1_skeleton_dbus_interface_get_info;
- skeleton_class->get_properties = agent_org_bluez_agent1_skeleton_dbus_interface_get_properties;
- skeleton_class->flush = agent_org_bluez_agent1_skeleton_dbus_interface_flush;
- skeleton_class->get_vtable = agent_org_bluez_agent1_skeleton_dbus_interface_get_vtable;
-
-#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
- g_type_class_add_private (klass, sizeof (AGENTOrgBluezAgent1SkeletonPrivate));
-#endif
-}
-
-static void
-agent_org_bluez_agent1_skeleton_iface_init (AGENTOrgBluezAgent1Iface *iface)
-{
-}
-
-/**
- * agent_org_bluez_agent1_skeleton_new:
- *
- * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Agent1.top_of_page">org.bluez.Agent1</link>.
- *
- * Returns: (transfer full) (type AGENTOrgBluezAgent1Skeleton): The skeleton object.
- */
-AGENTOrgBluezAgent1 *
-agent_org_bluez_agent1_skeleton_new (void)
-{
- return AGENT_ORG_BLUEZ_AGENT1 (g_object_new (AGENT_TYPE_ORG_BLUEZ_AGENT1_SKELETON, NULL));
-}
-
diff --git a/binding-bluetooth/lib_agent.h b/binding-bluetooth/lib_agent.h
deleted file mode 100644
index 0a355ee..0000000
--- a/binding-bluetooth/lib_agent.h
+++ /dev/null
@@ -1,409 +0,0 @@
-/*
- * Generated by gdbus-codegen 2.48.1. DO NOT EDIT.
- *
- * The license of this code is the same as for the source it was derived from.
- */
-
-#ifndef __LIB_AGENT_H__
-#define __LIB_AGENT_H__
-
-#include <gio/gio.h>
-
-G_BEGIN_DECLS
-
-
-/* ------------------------------------------------------------------------ */
-/* Declarations for org.bluez.Agent1 */
-
-#define AGENT_TYPE_ORG_BLUEZ_AGENT1 (agent_org_bluez_agent1_get_type ())
-#define AGENT_ORG_BLUEZ_AGENT1(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), AGENT_TYPE_ORG_BLUEZ_AGENT1, AGENTOrgBluezAgent1))
-#define AGENT_IS_ORG_BLUEZ_AGENT1(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), AGENT_TYPE_ORG_BLUEZ_AGENT1))
-#define AGENT_ORG_BLUEZ_AGENT1_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), AGENT_TYPE_ORG_BLUEZ_AGENT1, AGENTOrgBluezAgent1Iface))
-
-struct _AGENTOrgBluezAgent1;
-typedef struct _AGENTOrgBluezAgent1 AGENTOrgBluezAgent1;
-typedef struct _AGENTOrgBluezAgent1Iface AGENTOrgBluezAgent1Iface;
-
-struct _AGENTOrgBluezAgent1Iface
-{
- GTypeInterface parent_iface;
-
- gboolean (*handle_authorize_service) (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation,
- const gchar *arg_device,
- const gchar *arg_uuid);
-
- gboolean (*handle_cancel) (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation);
-
- gboolean (*handle_display_passkey) (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation,
- const gchar *arg_device,
- guint arg_passkey,
- guint16 arg_entered);
-
- gboolean (*handle_display_pin_code) (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation,
- const gchar *arg_device,
- const gchar *arg_pincode);
-
- gboolean (*handle_release) (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation);
-
- gboolean (*handle_request_authorization) (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation,
- const gchar *arg_device);
-
- gboolean (*handle_request_confirmation) (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation,
- const gchar *arg_device,
- guint arg_passkey);
-
- gboolean (*handle_request_passkey) (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation,
- const gchar *arg_device);
-
- gboolean (*handle_request_pin_code) (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation,
- const gchar *arg_device);
-
-};
-
-GType agent_org_bluez_agent1_get_type (void) G_GNUC_CONST;
-
-GDBusInterfaceInfo *agent_org_bluez_agent1_interface_info (void);
-guint agent_org_bluez_agent1_override_properties (GObjectClass *klass, guint property_id_begin);
-
-
-/* D-Bus method call completion functions: */
-void agent_org_bluez_agent1_complete_release (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation);
-
-void agent_org_bluez_agent1_complete_request_pin_code (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation,
- const gchar *pincode);
-
-void agent_org_bluez_agent1_complete_display_pin_code (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation);
-
-void agent_org_bluez_agent1_complete_request_passkey (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation,
- guint passkey);
-
-void agent_org_bluez_agent1_complete_display_passkey (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation);
-
-void agent_org_bluez_agent1_complete_request_confirmation (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation);
-
-void agent_org_bluez_agent1_complete_request_authorization (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation);
-
-void agent_org_bluez_agent1_complete_authorize_service (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation);
-
-void agent_org_bluez_agent1_complete_cancel (
- AGENTOrgBluezAgent1 *object,
- GDBusMethodInvocation *invocation);
-
-
-
-/* D-Bus method calls: */
-void agent_org_bluez_agent1_call_release (
- AGENTOrgBluezAgent1 *proxy,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-
-gboolean agent_org_bluez_agent1_call_release_finish (
- AGENTOrgBluezAgent1 *proxy,
- GAsyncResult *res,
- GError **error);
-
-gboolean agent_org_bluez_agent1_call_release_sync (
- AGENTOrgBluezAgent1 *proxy,
- GCancellable *cancellable,
- GError **error);
-
-void agent_org_bluez_agent1_call_request_pin_code (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-
-gboolean agent_org_bluez_agent1_call_request_pin_code_finish (
- AGENTOrgBluezAgent1 *proxy,
- gchar **out_pincode,
- GAsyncResult *res,
- GError **error);
-
-gboolean agent_org_bluez_agent1_call_request_pin_code_sync (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- gchar **out_pincode,
- GCancellable *cancellable,
- GError **error);
-
-void agent_org_bluez_agent1_call_display_pin_code (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- const gchar *arg_pincode,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-
-gboolean agent_org_bluez_agent1_call_display_pin_code_finish (
- AGENTOrgBluezAgent1 *proxy,
- GAsyncResult *res,
- GError **error);
-
-gboolean agent_org_bluez_agent1_call_display_pin_code_sync (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- const gchar *arg_pincode,
- GCancellable *cancellable,
- GError **error);
-
-void agent_org_bluez_agent1_call_request_passkey (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-
-gboolean agent_org_bluez_agent1_call_request_passkey_finish (
- AGENTOrgBluezAgent1 *proxy,
- guint *out_passkey,
- GAsyncResult *res,
- GError **error);
-
-gboolean agent_org_bluez_agent1_call_request_passkey_sync (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- guint *out_passkey,
- GCancellable *cancellable,
- GError **error);
-
-void agent_org_bluez_agent1_call_display_passkey (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- guint arg_passkey,
- guint16 arg_entered,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-
-gboolean agent_org_bluez_agent1_call_display_passkey_finish (
- AGENTOrgBluezAgent1 *proxy,
- GAsyncResult *res,
- GError **error);
-
-gboolean agent_org_bluez_agent1_call_display_passkey_sync (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- guint arg_passkey,
- guint16 arg_entered,
- GCancellable *cancellable,
- GError **error);
-
-void agent_org_bluez_agent1_call_request_confirmation (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- guint arg_passkey,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-
-gboolean agent_org_bluez_agent1_call_request_confirmation_finish (
- AGENTOrgBluezAgent1 *proxy,
- GAsyncResult *res,
- GError **error);
-
-gboolean agent_org_bluez_agent1_call_request_confirmation_sync (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- guint arg_passkey,
- GCancellable *cancellable,
- GError **error);
-
-void agent_org_bluez_agent1_call_request_authorization (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-
-gboolean agent_org_bluez_agent1_call_request_authorization_finish (
- AGENTOrgBluezAgent1 *proxy,
- GAsyncResult *res,
- GError **error);
-
-gboolean agent_org_bluez_agent1_call_request_authorization_sync (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- GCancellable *cancellable,
- GError **error);
-
-void agent_org_bluez_agent1_call_authorize_service (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- const gchar *arg_uuid,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-
-gboolean agent_org_bluez_agent1_call_authorize_service_finish (
- AGENTOrgBluezAgent1 *proxy,
- GAsyncResult *res,
- GError **error);
-
-gboolean agent_org_bluez_agent1_call_authorize_service_sync (
- AGENTOrgBluezAgent1 *proxy,
- const gchar *arg_device,
- const gchar *arg_uuid,
- GCancellable *cancellable,
- GError **error);
-
-void agent_org_bluez_agent1_call_cancel (
- AGENTOrgBluezAgent1 *proxy,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-
-gboolean agent_org_bluez_agent1_call_cancel_finish (
- AGENTOrgBluezAgent1 *proxy,
- GAsyncResult *res,
- GError **error);
-
-gboolean agent_org_bluez_agent1_call_cancel_sync (
- AGENTOrgBluezAgent1 *proxy,
- GCancellable *cancellable,
- GError **error);
-
-
-
-/* ---- */
-
-#define AGENT_TYPE_ORG_BLUEZ_AGENT1_PROXY (agent_org_bluez_agent1_proxy_get_type ())
-#define AGENT_ORG_BLUEZ_AGENT1_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), AGENT_TYPE_ORG_BLUEZ_AGENT1_PROXY, AGENTOrgBluezAgent1Proxy))
-#define AGENT_ORG_BLUEZ_AGENT1_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), AGENT_TYPE_ORG_BLUEZ_AGENT1_PROXY, AGENTOrgBluezAgent1ProxyClass))
-#define AGENT_ORG_BLUEZ_AGENT1_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), AGENT_TYPE_ORG_BLUEZ_AGENT1_PROXY, AGENTOrgBluezAgent1ProxyClass))
-#define AGENT_IS_ORG_BLUEZ_AGENT1_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), AGENT_TYPE_ORG_BLUEZ_AGENT1_PROXY))
-#define AGENT_IS_ORG_BLUEZ_AGENT1_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), AGENT_TYPE_ORG_BLUEZ_AGENT1_PROXY))
-
-typedef struct _AGENTOrgBluezAgent1Proxy AGENTOrgBluezAgent1Proxy;
-typedef struct _AGENTOrgBluezAgent1ProxyClass AGENTOrgBluezAgent1ProxyClass;
-typedef struct _AGENTOrgBluezAgent1ProxyPrivate AGENTOrgBluezAgent1ProxyPrivate;
-
-struct _AGENTOrgBluezAgent1Proxy
-{
- /*< private >*/
- GDBusProxy parent_instance;
- AGENTOrgBluezAgent1ProxyPrivate *priv;
-};
-
-struct _AGENTOrgBluezAgent1ProxyClass
-{
- GDBusProxyClass parent_class;
-};
-
-GType agent_org_bluez_agent1_proxy_get_type (void) G_GNUC_CONST;
-
-#if GLIB_CHECK_VERSION(2, 44, 0)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (AGENTOrgBluezAgent1Proxy, g_object_unref)
-#endif
-
-void agent_org_bluez_agent1_proxy_new (
- GDBusConnection *connection,
- GDBusProxyFlags flags,
- const gchar *name,
- const gchar *object_path,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-AGENTOrgBluezAgent1 *agent_org_bluez_agent1_proxy_new_finish (
- GAsyncResult *res,
- GError **error);
-AGENTOrgBluezAgent1 *agent_org_bluez_agent1_proxy_new_sync (
- GDBusConnection *connection,
- GDBusProxyFlags flags,
- const gchar *name,
- const gchar *object_path,
- GCancellable *cancellable,
- GError **error);
-
-void agent_org_bluez_agent1_proxy_new_for_bus (
- GBusType bus_type,
- GDBusProxyFlags flags,
- const gchar *name,
- const gchar *object_path,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-AGENTOrgBluezAgent1 *agent_org_bluez_agent1_proxy_new_for_bus_finish (
- GAsyncResult *res,
- GError **error);
-AGENTOrgBluezAgent1 *agent_org_bluez_agent1_proxy_new_for_bus_sync (
- GBusType bus_type,
- GDBusProxyFlags flags,
- const gchar *name,
- const gchar *object_path,
- GCancellable *cancellable,
- GError **error);
-
-
-/* ---- */
-
-#define AGENT_TYPE_ORG_BLUEZ_AGENT1_SKELETON (agent_org_bluez_agent1_skeleton_get_type ())
-#define AGENT_ORG_BLUEZ_AGENT1_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), AGENT_TYPE_ORG_BLUEZ_AGENT1_SKELETON, AGENTOrgBluezAgent1Skeleton))
-#define AGENT_ORG_BLUEZ_AGENT1_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), AGENT_TYPE_ORG_BLUEZ_AGENT1_SKELETON, AGENTOrgBluezAgent1SkeletonClass))
-#define AGENT_ORG_BLUEZ_AGENT1_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), AGENT_TYPE_ORG_BLUEZ_AGENT1_SKELETON, AGENTOrgBluezAgent1SkeletonClass))
-#define AGENT_IS_ORG_BLUEZ_AGENT1_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), AGENT_TYPE_ORG_BLUEZ_AGENT1_SKELETON))
-#define AGENT_IS_ORG_BLUEZ_AGENT1_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), AGENT_TYPE_ORG_BLUEZ_AGENT1_SKELETON))
-
-typedef struct _AGENTOrgBluezAgent1Skeleton AGENTOrgBluezAgent1Skeleton;
-typedef struct _AGENTOrgBluezAgent1SkeletonClass AGENTOrgBluezAgent1SkeletonClass;
-typedef struct _AGENTOrgBluezAgent1SkeletonPrivate AGENTOrgBluezAgent1SkeletonPrivate;
-
-struct _AGENTOrgBluezAgent1Skeleton
-{
- /*< private >*/
- GDBusInterfaceSkeleton parent_instance;
- AGENTOrgBluezAgent1SkeletonPrivate *priv;
-};
-
-struct _AGENTOrgBluezAgent1SkeletonClass
-{
- GDBusInterfaceSkeletonClass parent_class;
-};
-
-GType agent_org_bluez_agent1_skeleton_get_type (void) G_GNUC_CONST;
-
-#if GLIB_CHECK_VERSION(2, 44, 0)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (AGENTOrgBluezAgent1Skeleton, g_object_unref)
-#endif
-
-AGENTOrgBluezAgent1 *agent_org_bluez_agent1_skeleton_new (void);
-
-
-G_END_DECLS
-
-#endif /* __LIB_AGENT_H__ */
diff --git a/binding-bluetooth/lib_bluez.c b/binding-bluetooth/lib_bluez.c
deleted file mode 100644
index 58d844d..0000000
--- a/binding-bluetooth/lib_bluez.c
+++ /dev/null
@@ -1,630 +0,0 @@
-/*
- * Generated by gdbus-codegen 2.48.1. DO NOT EDIT.
- *
- * The license of this code is the same as for the source it was derived from.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "lib_bluez.h"
-
-#include <string.h>
-#ifdef G_OS_UNIX
-# include <gio/gunixfdlist.h>
-#endif
-
-typedef struct
-{
- GDBusArgInfo parent_struct;
- gboolean use_gvariant;
-} _ExtendedGDBusArgInfo;
-
-typedef struct
-{
- GDBusMethodInfo parent_struct;
- const gchar *signal_name;
- gboolean pass_fdlist;
-} _ExtendedGDBusMethodInfo;
-
-typedef struct
-{
- GDBusSignalInfo parent_struct;
- const gchar *signal_name;
-} _ExtendedGDBusSignalInfo;
-
-typedef struct
-{
- GDBusPropertyInfo parent_struct;
- const gchar *hyphen_name;
- gboolean use_gvariant;
-} _ExtendedGDBusPropertyInfo;
-
-typedef struct
-{
- GDBusInterfaceInfo parent_struct;
- const gchar *hyphen_name;
-} _ExtendedGDBusInterfaceInfo;
-
-typedef struct
-{
- const _ExtendedGDBusPropertyInfo *info;
- guint prop_id;
- GValue orig_value; /* the value before the change */
-} ChangedProperty;
-
-static void
-_changed_property_free (ChangedProperty *data)
-{
- g_value_unset (&data->orig_value);
- g_free (data);
-}
-
-static gboolean
-_g_strv_equal0 (gchar **a, gchar **b)
-{
- gboolean ret = FALSE;
- guint n;
- if (a == NULL && b == NULL)
- {
- ret = TRUE;
- goto out;
- }
- if (a == NULL || b == NULL)
- goto out;
- if (g_strv_length (a) != g_strv_length (b))
- goto out;
- for (n = 0; a[n] != NULL; n++)
- if (g_strcmp0 (a[n], b[n]) != 0)
- goto out;
- ret = TRUE;
-out:
- return ret;
-}
-
-static gboolean
-_g_variant_equal0 (GVariant *a, GVariant *b)
-{
- gboolean ret = FALSE;
- if (a == NULL && b == NULL)
- {
- ret = TRUE;
- goto out;
- }
- if (a == NULL || b == NULL)
- goto out;
- ret = g_variant_equal (a, b);
-out:
- return ret;
-}
-
-G_GNUC_UNUSED static gboolean
-_g_value_equal (const GValue *a, const GValue *b)
-{
- gboolean ret = FALSE;
- g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b));
- switch (G_VALUE_TYPE (a))
- {
- case G_TYPE_BOOLEAN:
- ret = (g_value_get_boolean (a) == g_value_get_boolean (b));
- break;
- case G_TYPE_UCHAR:
- ret = (g_value_get_uchar (a) == g_value_get_uchar (b));
- break;
- case G_TYPE_INT:
- ret = (g_value_get_int (a) == g_value_get_int (b));
- break;
- case G_TYPE_UINT:
- ret = (g_value_get_uint (a) == g_value_get_uint (b));
- break;
- case G_TYPE_INT64:
- ret = (g_value_get_int64 (a) == g_value_get_int64 (b));
- break;
- case G_TYPE_UINT64:
- ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b));
- break;
- case G_TYPE_DOUBLE:
- {
- /* Avoid -Wfloat-equal warnings by doing a direct bit compare */
- gdouble da = g_value_get_double (a);
- gdouble db = g_value_get_double (b);
- ret = memcmp (&da, &db, sizeof (gdouble)) == 0;
- }
- break;
- case G_TYPE_STRING:
- ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0);
- break;
- case G_TYPE_VARIANT:
- ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b));
- break;
- default:
- if (G_VALUE_TYPE (a) == G_TYPE_STRV)
- ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b));
- else
- g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a)));
- break;
- }
- return ret;
-}
-
-/* ------------------------------------------------------------------------
- * Code for Object, ObjectProxy and ObjectSkeleton
- * ------------------------------------------------------------------------
- */
-
-/**
- * SECTION:BLUEZObject
- * @title: BLUEZObject
- * @short_description: Specialized GDBusObject types
- *
- * This section contains the #BLUEZObject, #BLUEZObjectProxy, and #BLUEZObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
- */
-
-/**
- * BLUEZObject:
- *
- * The #BLUEZObject type is a specialized container of interfaces.
- */
-
-/**
- * BLUEZObjectIface:
- * @parent_iface: The parent interface.
- *
- * Virtual table for the #BLUEZObject interface.
- */
-
-typedef BLUEZObjectIface BLUEZObjectInterface;
-G_DEFINE_INTERFACE_WITH_CODE (BLUEZObject, bluez_object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
-
-static void
-bluez_object_default_init (BLUEZObjectIface *iface)
-{
-}
-
-
-
-static void
-bluez_object_notify (GDBusObject *object, GDBusInterface *interface)
-{
- _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
- /* info can be NULL if the other end is using a D-Bus interface we don't know
- * anything about, for example old generated code in this process talking to
- * newer generated code in the other process. */
- if (info != NULL)
- g_object_notify (G_OBJECT (object), info->hyphen_name);
-}
-
-/**
- * BLUEZObjectProxy:
- *
- * The #BLUEZObjectProxy structure contains only private data and should only be accessed using the provided API.
- */
-
-/**
- * BLUEZObjectProxyClass:
- * @parent_class: The parent class.
- *
- * Class structure for #BLUEZObjectProxy.
- */
-
-static void
-bluez_object_proxy__bluez_object_iface_init (BLUEZObjectIface *iface G_GNUC_UNUSED)
-{
-}
-
-static void
-bluez_object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
-{
- iface->interface_added = bluez_object_notify;
- iface->interface_removed = bluez_object_notify;
-}
-
-
-G_DEFINE_TYPE_WITH_CODE (BLUEZObjectProxy, bluez_object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
- G_IMPLEMENT_INTERFACE (BLUEZ_TYPE_OBJECT, bluez_object_proxy__bluez_object_iface_init)
- G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, bluez_object_proxy__g_dbus_object_iface_init));
-
-static void
-bluez_object_proxy_init (BLUEZObjectProxy *object G_GNUC_UNUSED)
-{
-}
-
-static void
-bluez_object_proxy_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value G_GNUC_UNUSED,
- GParamSpec *pspec)
-{
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
-}
-
-static void
-bluez_object_proxy_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- BLUEZObjectProxy *object = BLUEZ_OBJECT_PROXY (gobject);
- GDBusInterface *interface;
-
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-bluez_object_proxy_class_init (BLUEZObjectProxyClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- gobject_class->set_property = bluez_object_proxy_set_property;
- gobject_class->get_property = bluez_object_proxy_get_property;
-
-}
-
-/**
- * bluez_object_proxy_new:
- * @connection: A #GDBusConnection.
- * @object_path: An object path.
- *
- * Creates a new proxy object.
- *
- * Returns: (transfer full): The proxy object.
- */
-BLUEZObjectProxy *
-bluez_object_proxy_new (GDBusConnection *connection,
- const gchar *object_path)
-{
- g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
- g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
- return BLUEZ_OBJECT_PROXY (g_object_new (BLUEZ_TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
-}
-
-/**
- * BLUEZObjectSkeleton:
- *
- * The #BLUEZObjectSkeleton structure contains only private data and should only be accessed using the provided API.
- */
-
-/**
- * BLUEZObjectSkeletonClass:
- * @parent_class: The parent class.
- *
- * Class structure for #BLUEZObjectSkeleton.
- */
-
-static void
-bluez_object_skeleton__bluez_object_iface_init (BLUEZObjectIface *iface G_GNUC_UNUSED)
-{
-}
-
-
-static void
-bluez_object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
-{
- iface->interface_added = bluez_object_notify;
- iface->interface_removed = bluez_object_notify;
-}
-
-G_DEFINE_TYPE_WITH_CODE (BLUEZObjectSkeleton, bluez_object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
- G_IMPLEMENT_INTERFACE (BLUEZ_TYPE_OBJECT, bluez_object_skeleton__bluez_object_iface_init)
- G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, bluez_object_skeleton__g_dbus_object_iface_init));
-
-static void
-bluez_object_skeleton_init (BLUEZObjectSkeleton *object G_GNUC_UNUSED)
-{
-}
-
-static void
-bluez_object_skeleton_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- BLUEZObjectSkeleton *object = BLUEZ_OBJECT_SKELETON (gobject);
- GDBusInterfaceSkeleton *interface;
-
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-bluez_object_skeleton_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- BLUEZObjectSkeleton *object = BLUEZ_OBJECT_SKELETON (gobject);
- GDBusInterface *interface;
-
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-bluez_object_skeleton_class_init (BLUEZObjectSkeletonClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- gobject_class->set_property = bluez_object_skeleton_set_property;
- gobject_class->get_property = bluez_object_skeleton_get_property;
-
-}
-
-/**
- * bluez_object_skeleton_new:
- * @object_path: An object path.
- *
- * Creates a new skeleton object.
- *
- * Returns: (transfer full): The skeleton object.
- */
-BLUEZObjectSkeleton *
-bluez_object_skeleton_new (const gchar *object_path)
-{
- g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
- return BLUEZ_OBJECT_SKELETON (g_object_new (BLUEZ_TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
-}
-
-
-/* ------------------------------------------------------------------------
- * Code for ObjectManager client
- * ------------------------------------------------------------------------
- */
-
-/**
- * SECTION:BLUEZObjectManagerClient
- * @title: BLUEZObjectManagerClient
- * @short_description: Generated GDBusObjectManagerClient type
- *
- * This section contains a #GDBusObjectManagerClient that uses bluez_object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
- */
-
-/**
- * BLUEZObjectManagerClient:
- *
- * The #BLUEZObjectManagerClient structure contains only private data and should only be accessed using the provided API.
- */
-
-/**
- * BLUEZObjectManagerClientClass:
- * @parent_class: The parent class.
- *
- * Class structure for #BLUEZObjectManagerClient.
- */
-
-G_DEFINE_TYPE (BLUEZObjectManagerClient, bluez_object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
-
-static void
-bluez_object_manager_client_init (BLUEZObjectManagerClient *manager G_GNUC_UNUSED)
-{
-}
-
-static void
-bluez_object_manager_client_class_init (BLUEZObjectManagerClientClass *klass G_GNUC_UNUSED)
-{
-}
-
-/**
- * bluez_object_manager_client_get_proxy_type:
- * @manager: A #GDBusObjectManagerClient.
- * @object_path: The object path of the remote object (unused).
- * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
- * @user_data: User data (unused).
- *
- * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
- *
- * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #BLUEZObjectProxy.
- */
-GType
-bluez_object_manager_client_get_proxy_type (GDBusObjectManagerClient *manager G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name, gpointer user_data G_GNUC_UNUSED)
-{
- static gsize once_init_value = 0;
- static GHashTable *lookup_hash;
- GType ret;
-
- if (interface_name == NULL)
- return BLUEZ_TYPE_OBJECT_PROXY;
- if (g_once_init_enter (&once_init_value))
- {
- lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
- g_once_init_leave (&once_init_value, 1);
- }
- ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
- if (ret == (GType) 0)
- ret = G_TYPE_DBUS_PROXY;
- return ret;
-}
-
-/**
- * bluez_object_manager_client_new:
- * @connection: A #GDBusConnection.
- * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
- * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
- * @object_path: An object path.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
- * @user_data: User data to pass to @callback.
- *
- * Asynchronously creates #GDBusObjectManagerClient using bluez_object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
- *
- * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
- * You can then call bluez_object_manager_client_new_finish() to get the result of the operation.
- *
- * See bluez_object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
- */
-void
-bluez_object_manager_client_new (
- GDBusConnection *connection,
- GDBusObjectManagerClientFlags flags,
- const gchar *name,
- const gchar *object_path,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- g_async_initable_new_async (BLUEZ_TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", bluez_object_manager_client_get_proxy_type, NULL);
-}
-
-/**
- * bluez_object_manager_client_new_finish:
- * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_object_manager_client_new().
- * @error: Return location for error or %NULL
- *
- * Finishes an operation started with bluez_object_manager_client_new().
- *
- * Returns: (transfer full) (type BLUEZObjectManagerClient): The constructed object manager client or %NULL if @error is set.
- */
-GDBusObjectManager *
-bluez_object_manager_client_new_finish (
- GAsyncResult *res,
- GError **error)
-{
- GObject *ret;
- GObject *source_object;
- source_object = g_async_result_get_source_object (res);
- ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
- g_object_unref (source_object);
- if (ret != NULL)
- return G_DBUS_OBJECT_MANAGER (ret);
- else
- return NULL;
-}
-
-/**
- * bluez_object_manager_client_new_sync:
- * @connection: A #GDBusConnection.
- * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
- * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
- * @object_path: An object path.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @error: Return location for error or %NULL
- *
- * Synchronously creates #GDBusObjectManagerClient using bluez_object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
- *
- * The calling thread is blocked until a reply is received.
- *
- * See bluez_object_manager_client_new() for the asynchronous version of this constructor.
- *
- * Returns: (transfer full) (type BLUEZObjectManagerClient): The constructed object manager client or %NULL if @error is set.
- */
-GDBusObjectManager *
-bluez_object_manager_client_new_sync (
- GDBusConnection *connection,
- GDBusObjectManagerClientFlags flags,
- const gchar *name,
- const gchar *object_path,
- GCancellable *cancellable,
- GError **error)
-{
- GInitable *ret;
- ret = g_initable_new (BLUEZ_TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", bluez_object_manager_client_get_proxy_type, NULL);
- if (ret != NULL)
- return G_DBUS_OBJECT_MANAGER (ret);
- else
- return NULL;
-}
-
-
-/**
- * bluez_object_manager_client_new_for_bus:
- * @bus_type: A #GBusType.
- * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
- * @name: A bus name (well-known or unique).
- * @object_path: An object path.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
- * @user_data: User data to pass to @callback.
- *
- * Like bluez_object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
- *
- * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
- * You can then call bluez_object_manager_client_new_for_bus_finish() to get the result of the operation.
- *
- * See bluez_object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
- */
-void
-bluez_object_manager_client_new_for_bus (
- GBusType bus_type,
- GDBusObjectManagerClientFlags flags,
- const gchar *name,
- const gchar *object_path,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- g_async_initable_new_async (BLUEZ_TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", bluez_object_manager_client_get_proxy_type, NULL);
-}
-
-/**
- * bluez_object_manager_client_new_for_bus_finish:
- * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_object_manager_client_new_for_bus().
- * @error: Return location for error or %NULL
- *
- * Finishes an operation started with bluez_object_manager_client_new_for_bus().
- *
- * Returns: (transfer full) (type BLUEZObjectManagerClient): The constructed object manager client or %NULL if @error is set.
- */
-GDBusObjectManager *
-bluez_object_manager_client_new_for_bus_finish (
- GAsyncResult *res,
- GError **error)
-{
- GObject *ret;
- GObject *source_object;
- source_object = g_async_result_get_source_object (res);
- ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
- g_object_unref (source_object);
- if (ret != NULL)
- return G_DBUS_OBJECT_MANAGER (ret);
- else
- return NULL;
-}
-
-/**
- * bluez_object_manager_client_new_for_bus_sync:
- * @bus_type: A #GBusType.
- * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
- * @name: A bus name (well-known or unique).
- * @object_path: An object path.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @error: Return location for error or %NULL
- *
- * Like bluez_object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
- *
- * The calling thread is blocked until a reply is received.
- *
- * See bluez_object_manager_client_new_for_bus() for the asynchronous version of this constructor.
- *
- * Returns: (transfer full) (type BLUEZObjectManagerClient): The constructed object manager client or %NULL if @error is set.
- */
-GDBusObjectManager *
-bluez_object_manager_client_new_for_bus_sync (
- GBusType bus_type,
- GDBusObjectManagerClientFlags flags,
- const gchar *name,
- const gchar *object_path,
- GCancellable *cancellable,
- GError **error)
-{
- GInitable *ret;
- ret = g_initable_new (BLUEZ_TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", bluez_object_manager_client_get_proxy_type, NULL);
- if (ret != NULL)
- return G_DBUS_OBJECT_MANAGER (ret);
- else
- return NULL;
-}
-
-
diff --git a/binding-bluetooth/lib_bluez.h b/binding-bluetooth/lib_bluez.h
deleted file mode 100644
index 1408bb2..0000000
--- a/binding-bluetooth/lib_bluez.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Generated by gdbus-codegen 2.48.1. DO NOT EDIT.
- *
- * The license of this code is the same as for the source it was derived from.
- */
-
-#ifndef __LIB_BLUEZ_H__
-#define __LIB_BLUEZ_H__
-
-#include <gio/gio.h>
-
-G_BEGIN_DECLS
-
-
-/* ---- */
-
-#define BLUEZ_TYPE_OBJECT (bluez_object_get_type ())
-#define BLUEZ_OBJECT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), BLUEZ_TYPE_OBJECT, BLUEZObject))
-#define BLUEZ_IS_OBJECT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), BLUEZ_TYPE_OBJECT))
-#define BLUEZ_OBJECT_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), BLUEZ_TYPE_OBJECT, BLUEZObject))
-
-struct _BLUEZObject;
-typedef struct _BLUEZObject BLUEZObject;
-typedef struct _BLUEZObjectIface BLUEZObjectIface;
-
-struct _BLUEZObjectIface
-{
- GTypeInterface parent_iface;
-};
-
-GType bluez_object_get_type (void) G_GNUC_CONST;
-
-
-#define BLUEZ_TYPE_OBJECT_PROXY (bluez_object_proxy_get_type ())
-#define BLUEZ_OBJECT_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), BLUEZ_TYPE_OBJECT_PROXY, BLUEZObjectProxy))
-#define BLUEZ_OBJECT_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), BLUEZ_TYPE_OBJECT_PROXY, BLUEZObjectProxyClass))
-#define BLUEZ_OBJECT_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), BLUEZ_TYPE_OBJECT_PROXY, BLUEZObjectProxyClass))
-#define BLUEZ_IS_OBJECT_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), BLUEZ_TYPE_OBJECT_PROXY))
-#define BLUEZ_IS_OBJECT_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), BLUEZ_TYPE_OBJECT_PROXY))
-
-typedef struct _BLUEZObjectProxy BLUEZObjectProxy;
-typedef struct _BLUEZObjectProxyClass BLUEZObjectProxyClass;
-typedef struct _BLUEZObjectProxyPrivate BLUEZObjectProxyPrivate;
-
-struct _BLUEZObjectProxy
-{
- /*< private >*/
- GDBusObjectProxy parent_instance;
- BLUEZObjectProxyPrivate *priv;
-};
-
-struct _BLUEZObjectProxyClass
-{
- GDBusObjectProxyClass parent_class;
-};
-
-GType bluez_object_proxy_get_type (void) G_GNUC_CONST;
-
-#if GLIB_CHECK_VERSION(2, 44, 0)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (BLUEZObjectProxy, g_object_unref)
-#endif
-
-BLUEZObjectProxy *bluez_object_proxy_new (GDBusConnection *connection, const gchar *object_path);
-
-#define BLUEZ_TYPE_OBJECT_SKELETON (bluez_object_skeleton_get_type ())
-#define BLUEZ_OBJECT_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), BLUEZ_TYPE_OBJECT_SKELETON, BLUEZObjectSkeleton))
-#define BLUEZ_OBJECT_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), BLUEZ_TYPE_OBJECT_SKELETON, BLUEZObjectSkeletonClass))
-#define BLUEZ_OBJECT_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), BLUEZ_TYPE_OBJECT_SKELETON, BLUEZObjectSkeletonClass))
-#define BLUEZ_IS_OBJECT_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), BLUEZ_TYPE_OBJECT_SKELETON))
-#define BLUEZ_IS_OBJECT_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), BLUEZ_TYPE_OBJECT_SKELETON))
-
-typedef struct _BLUEZObjectSkeleton BLUEZObjectSkeleton;
-typedef struct _BLUEZObjectSkeletonClass BLUEZObjectSkeletonClass;
-typedef struct _BLUEZObjectSkeletonPrivate BLUEZObjectSkeletonPrivate;
-
-struct _BLUEZObjectSkeleton
-{
- /*< private >*/
- GDBusObjectSkeleton parent_instance;
- BLUEZObjectSkeletonPrivate *priv;
-};
-
-struct _BLUEZObjectSkeletonClass
-{
- GDBusObjectSkeletonClass parent_class;
-};
-
-GType bluez_object_skeleton_get_type (void) G_GNUC_CONST;
-
-#if GLIB_CHECK_VERSION(2, 44, 0)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (BLUEZObjectSkeleton, g_object_unref)
-#endif
-
-BLUEZObjectSkeleton *bluez_object_skeleton_new (const gchar *object_path);
-
-/* ---- */
-
-#define BLUEZ_TYPE_OBJECT_MANAGER_CLIENT (bluez_object_manager_client_get_type ())
-#define BLUEZ_OBJECT_MANAGER_CLIENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), BLUEZ_TYPE_OBJECT_MANAGER_CLIENT, BLUEZObjectManagerClient))
-#define BLUEZ_OBJECT_MANAGER_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), BLUEZ_TYPE_OBJECT_MANAGER_CLIENT, BLUEZObjectManagerClientClass))
-#define BLUEZ_OBJECT_MANAGER_CLIENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), BLUEZ_TYPE_OBJECT_MANAGER_CLIENT, BLUEZObjectManagerClientClass))
-#define BLUEZ_IS_OBJECT_MANAGER_CLIENT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), BLUEZ_TYPE_OBJECT_MANAGER_CLIENT))
-#define BLUEZ_IS_OBJECT_MANAGER_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), BLUEZ_TYPE_OBJECT_MANAGER_CLIENT))
-
-typedef struct _BLUEZObjectManagerClient BLUEZObjectManagerClient;
-typedef struct _BLUEZObjectManagerClientClass BLUEZObjectManagerClientClass;
-typedef struct _BLUEZObjectManagerClientPrivate BLUEZObjectManagerClientPrivate;
-
-struct _BLUEZObjectManagerClient
-{
- /*< private >*/
- GDBusObjectManagerClient parent_instance;
- BLUEZObjectManagerClientPrivate *priv;
-};
-
-struct _BLUEZObjectManagerClientClass
-{
- GDBusObjectManagerClientClass parent_class;
-};
-
-#if GLIB_CHECK_VERSION(2, 44, 0)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (BLUEZObjectManagerClient, g_object_unref)
-#endif
-
-GType bluez_object_manager_client_get_type (void) G_GNUC_CONST;
-
-GType bluez_object_manager_client_get_proxy_type (GDBusObjectManagerClient *manager, const gchar *object_path, const gchar *interface_name, gpointer user_data);
-
-void bluez_object_manager_client_new (
- GDBusConnection *connection,
- GDBusObjectManagerClientFlags flags,
- const gchar *name,
- const gchar *object_path,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-GDBusObjectManager *bluez_object_manager_client_new_finish (
- GAsyncResult *res,
- GError **error);
-GDBusObjectManager *bluez_object_manager_client_new_sync (
- GDBusConnection *connection,
- GDBusObjectManagerClientFlags flags,
- const gchar *name,
- const gchar *object_path,
- GCancellable *cancellable,
- GError **error);
-
-void bluez_object_manager_client_new_for_bus (
- GBusType bus_type,
- GDBusObjectManagerClientFlags flags,
- const gchar *name,
- const gchar *object_path,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-GDBusObjectManager *bluez_object_manager_client_new_for_bus_finish (
- GAsyncResult *res,
- GError **error);
-GDBusObjectManager *bluez_object_manager_client_new_for_bus_sync (
- GBusType bus_type,
- GDBusObjectManagerClientFlags flags,
- const gchar *name,
- const gchar *object_path,
- GCancellable *cancellable,
- GError **error);
-
-
-G_END_DECLS
-
-#endif /* __LIB_BLUEZ_H__ */