~timchen119/ubuntu/trusty/gnome-bluetooth/lp1035431

« back to all changes in this revision

Viewing changes to applet/bluetooth-applet.h

  • Committer: Bazaar Package Importer
  • Author(s): Emilio Pozuelo Monfort
  • Date: 2011-02-27 15:45:22 UTC
  • mfrom: (1.3.2 upstream)
  • mto: (2.2.3 experimental) (1.5.1)
  • mto: This revision was merged to the branch mainline in revision 53.
  • Revision ID: james.westby@ubuntu.com-20110227154522-dnnoqasv5v3mv42a
Tags: upstream-2.91.5
ImportĀ upstreamĀ versionĀ 2.91.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *
 
3
 *  BlueZ - Bluetooth protocol stack for Linux
 
4
 *
 
5
 *  Copyright (C) 2010 Giovanni Campagna <scampa.giovanni@gmail.com>
 
6
 *
 
7
 *
 
8
 *  This program is free software; you can redistribute it and/or modify
 
9
 *  it under the terms of the GNU General Public License as published by
 
10
 *  the Free Software Foundation; either version 2 of the License, or
 
11
 *  (at your option) any later version.
 
12
 *
 
13
 *  This program is distributed in the hope that it will be useful,
 
14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
 *  GNU General Public License for more details.
 
17
 *
 
18
 *  You should have received a copy of the GNU General Public License
 
19
 *  along with this program; if not, write to the Free Software
 
20
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
21
 *
 
22
 */
 
23
 
 
24
/* inclusion guard */
 
25
#ifndef __BLUETOOTH_APPLET_H__
 
26
#define __BLUETOOTH_APPLET_H__
 
27
 
 
28
#include <glib.h>
 
29
#include <glib-object.h>
 
30
#include <gio/gio.h>
 
31
#include <bluetooth-enums.h>
 
32
 
 
33
/**
 
34
 * BluetoothCapabilities:
 
35
 *
 
36
 * special actions that can be invoked on the object
 
37
 */
 
38
 
 
39
typedef enum {
 
40
  BLUETOOTH_CAPABILITIES_NONE = 0,
 
41
  BLUETOOTH_CAPABILITIES_OBEX_PUSH = 0x1,
 
42
  BLUETOOTH_CAPABILITIES_OBEX_FILE_TRANSFER = 0x2
 
43
} BluetoothCapabilities;
 
44
 
 
45
/**
 
46
 * BluetoothSimpleDevice:
 
47
 *
 
48
 * represents user visible properties of a device known to the default adapter
 
49
 */
 
50
 
 
51
typedef struct {
 
52
  char* bdaddr;
 
53
  char* device_path;
 
54
  char* alias;
 
55
  gboolean connected;
 
56
  gboolean can_connect;
 
57
  guint capabilities;
 
58
  BluetoothType type;
 
59
} BluetoothSimpleDevice;
 
60
 
 
61
#define BLUETOOTH_TYPE_SIMPLE_DEVICE    (bluetooth_simple_device_get_type ())
 
62
 
 
63
GType bluetooth_simple_device_get_type (void) G_GNUC_CONST;
 
64
 
 
65
/**
 
66
 * BluetoothKillswitchState:
 
67
 *
 
68
 * public version of that found in bluetooth-killswitch.h
 
69
 */
 
70
 
 
71
typedef enum {
 
72
  BLUETOOTH_KILLSWITCH_STATE_NO_ADAPTER = -1,
 
73
  BLUETOOTH_KILLSWITCH_STATE_SOFT_BLOCKED = 0,
 
74
  BLUETOOTH_KILLSWITCH_STATE_UNBLOCKED,
 
75
  BLUETOOTH_KILLSWITCH_STATE_HARD_BLOCKED
 
76
} BluetoothKillswitchState;
 
77
 
 
78
/*
 
79
 * Type macros.
 
80
 */
 
81
#define BLUETOOTH_TYPE_APPLET                  (bluetooth_applet_get_type ())
 
82
#define BLUETOOTH_APPLET(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), BLUETOOTH_TYPE_APPLET, BluetoothApplet))
 
83
#define BLUETOOTH_IS_APPLET(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BLUETOOTH_TYPE_APPLET))
 
84
#define BLUETOOTH_APPLET_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), BLUETOOTH_TYPE_APPLET, BluetoothAppletClass))
 
85
#define BLUETOOTH_IS_APPLET_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), BLUETOOTH_TYPE_APPLET))
 
86
#define BLUETOOTH_APPLET_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), BLUETOOTH_TYPE_APPLET, BluetoothAppletClass))
 
87
 
 
88
/* These structs are fully opaque, type is not derivable */
 
89
typedef struct _BluetoothApplet        BluetoothApplet;
 
90
typedef struct _BluetoothAppletClass   BluetoothAppletClass;
 
91
 
 
92
/* used by BLUETOOTH_TYPE_APPLET */
 
93
GType bluetooth_applet_get_type (void) G_GNUC_CONST;
 
94
 
 
95
/*
 
96
 * Method definitions.
 
97
 */
 
98
 
 
99
GList* bluetooth_applet_get_devices(BluetoothApplet* self);
 
100
 
 
101
BluetoothKillswitchState bluetooth_applet_get_killswitch_state(BluetoothApplet* self);
 
102
gboolean bluetooth_applet_set_killswitch_state(BluetoothApplet* self, BluetoothKillswitchState state);
 
103
 
 
104
gboolean bluetooth_applet_get_discoverable(BluetoothApplet* self);
 
105
void bluetooth_applet_set_discoverable(BluetoothApplet* self, gboolean visible);
 
106
 
 
107
typedef void (*BluetoothAppletConnectFunc) (BluetoothApplet *applet,
 
108
                                            gboolean success,
 
109
                                            gpointer data);
 
110
 
 
111
gboolean bluetooth_applet_connect_device(BluetoothApplet *applet,
 
112
                                          const char *device,
 
113
                                          BluetoothAppletConnectFunc func,
 
114
                                          gpointer data);
 
115
gboolean bluetooth_applet_disconnect_device (BluetoothApplet *applet,
 
116
                                              const char *device,
 
117
                                              BluetoothAppletConnectFunc func,
 
118
                                              gpointer data);
 
119
 
 
120
gboolean bluetooth_applet_browse_address_finish (BluetoothApplet *applet,
 
121
                                                 GAsyncResult *result,
 
122
                                                 GError **error);
 
123
void bluetooth_applet_browse_address (BluetoothApplet *applet,
 
124
                                      const char *address,
 
125
                                      guint timestamp,
 
126
                                      GAsyncReadyCallback callback,
 
127
                                      gpointer user_data);
 
128
void bluetooth_applet_send_to_address (BluetoothApplet *applet,
 
129
                                       const char *address,
 
130
                                       const char *alias);
 
131
 
 
132
gboolean bluetooth_applet_get_show_full_menu(BluetoothApplet* self);
 
133
 
 
134
void bluetooth_applet_agent_reply_pincode(BluetoothApplet* self, const gchar* request_key, const gchar* pincode);
 
135
void bluetooth_applet_agent_reply_passkey(BluetoothApplet* self, const gchar* request_key, gint passkey);
 
136
void bluetooth_applet_agent_reply_confirm(BluetoothApplet* self, const gchar* request_key, gboolean confirm);
 
137
void bluetooth_applet_agent_reply_auth(BluetoothApplet* self, const gchar* request_key, gboolean auth, gboolean trusted);
 
138
 
 
139
#endif /* __BLUETOOTH_APPLET_H__ */