summaryrefslogtreecommitdiff
path: root/lib/bluetooth-agent.h
blob: 4107343277a375804ac6e31688a2d4dcdba4272c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*
 *
 *  BlueZ - Bluetooth protocol stack for Linux
 *
 *  Copyright (C) 2005-2008  Marcel Holtmann <marcel@holtmann.org>
 *
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

#pragma once

#include <glib-object.h>
#include <gio/gio.h>

#define BLUETOOTH_TYPE_AGENT (bluetooth_agent_get_type())
#define BLUETOOTH_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
					BLUETOOTH_TYPE_AGENT, BluetoothAgent))
#define BLUETOOTH_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \
					BLUETOOTH_TYPE_AGENT, BluetoothAgentClass))
#define BLUETOOTH_IS_AGENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
							BLUETOOTH_TYPE_AGENT))
#define BLUETOOTH_IS_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), \
							BLUETOOTH_TYPE_AGENT))
#define BLUETOOTH_GET_AGENT_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), \
					BLUETOOTH_TYPE_AGENT, BluetoothAgentClass))

typedef struct _BluetoothAgent BluetoothAgent;
typedef struct _BluetoothAgentClass BluetoothAgentClass;

struct _BluetoothAgent {
	GObject parent;
};

struct _BluetoothAgentClass {
	GObjectClass parent_class;
};

GType bluetooth_agent_get_type(void);

BluetoothAgent *bluetooth_agent_new(const char *path);

gboolean bluetooth_agent_setup(BluetoothAgent *agent, const char *path);

gboolean bluetooth_agent_register(BluetoothAgent *agent);
gboolean bluetooth_agent_unregister(BluetoothAgent *agent);

typedef void (*BluetoothAgentPasskeyFunc) (GDBusMethodInvocation *invocation,
					   GDBusProxy            *device,
					   gpointer               data);
typedef void (*BluetoothAgentDisplayFunc) (GDBusMethodInvocation *invocation,
					   GDBusProxy            *device,
					   guint                  passkey,
					   guint                  entered,
					   gpointer               data);
typedef void (*BluetoothAgentDisplayPinCodeFunc) (GDBusMethodInvocation *invocation,
						  GDBusProxy            *device,
						  const char            *pincode,
						  gpointer               data);
typedef void (*BluetoothAgentConfirmFunc) (GDBusMethodInvocation *invocation,
					   GDBusProxy            *device,
					   guint                  passkey,
					   gpointer               data);
typedef void (*BluetoothAgentAuthorizeFunc) (GDBusMethodInvocation *invocation,
					     GDBusProxy            *device,
					     gpointer               data);
typedef void (*BluetoothAgentAuthorizeServiceFunc) (GDBusMethodInvocation *invocation,
						    GDBusProxy            *device,
						    const char            *uuid,
						    gpointer               data);
typedef gboolean (*BluetoothAgentCancelFunc) (GDBusMethodInvocation *invocation,
					      gpointer               data);

void bluetooth_agent_set_pincode_func (BluetoothAgent            *agent,
				       BluetoothAgentPasskeyFunc  func,
				       gpointer                   data);
void bluetooth_agent_set_passkey_func (BluetoothAgent            *agent,
				       BluetoothAgentPasskeyFunc  func,
				       gpointer                   data);
void bluetooth_agent_set_display_func (BluetoothAgent            *agent,
				       BluetoothAgentDisplayFunc  func,
				       gpointer                   data);
void bluetooth_agent_set_display_pincode_func (BluetoothAgent                   *agent,
					       BluetoothAgentDisplayPinCodeFunc  func,
					       gpointer                          data);
void bluetooth_agent_set_confirm_func (BluetoothAgent            *agent,
				       BluetoothAgentConfirmFunc  func,
				       gpointer                   data);
void bluetooth_agent_set_authorize_func (BluetoothAgent              *agent,
					 BluetoothAgentAuthorizeFunc  func,
					 gpointer                     data);
void bluetooth_agent_set_authorize_service_func (BluetoothAgent                     *agent,
						 BluetoothAgentAuthorizeServiceFunc  func,
						 gpointer                            data);
void bluetooth_agent_set_cancel_func (BluetoothAgent           *agent,
				      BluetoothAgentCancelFunc  func,
				      gpointer                  data);

#define AGENT_ERROR (bluetooth_agent_error_quark())
#define AGENT_ERROR_TYPE (bluetooth_agent_error_get_type())

typedef enum {
	AGENT_ERROR_REJECT
} AgentError;

GType  bluetooth_agent_error_get_type (void);
GQuark bluetooth_agent_error_quark    (void);