annotate src/bluetooth/bluetooth.c @ 2854:43557eb3180f

playback
author Paula Stanciu <paula.stanciu@gmail.com>
date Wed, 30 Jul 2008 17:49:43 +0300
parents 671cdfc2d62d
children 162766a69f12
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2839
22a5075fc7f7 GPL Headers
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2838
diff changeset
1 /*
22a5075fc7f7 GPL Headers
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2838
diff changeset
2 * Audacious Bluetooth headset suport plugin
22a5075fc7f7 GPL Headers
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2838
diff changeset
3 *
22a5075fc7f7 GPL Headers
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2838
diff changeset
4 * Copyright (c) 2008 Paula Stanciu paula.stanciu@gmail.com
22a5075fc7f7 GPL Headers
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2838
diff changeset
5 *
22a5075fc7f7 GPL Headers
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2838
diff changeset
6 * This program is free software; you can redistribute it and/or modify
22a5075fc7f7 GPL Headers
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2838
diff changeset
7 * it under the terms of the GNU General Public License as published by
22a5075fc7f7 GPL Headers
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2838
diff changeset
8 * the Free Software Foundation; under version 3 of the License.
22a5075fc7f7 GPL Headers
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2838
diff changeset
9 *
22a5075fc7f7 GPL Headers
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2838
diff changeset
10 * This program is distributed in the hope that it will be useful,
22a5075fc7f7 GPL Headers
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2838
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22a5075fc7f7 GPL Headers
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2838
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22a5075fc7f7 GPL Headers
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2838
diff changeset
13 * GNU General Public License for more details.
22a5075fc7f7 GPL Headers
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2838
diff changeset
14 *
22a5075fc7f7 GPL Headers
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2838
diff changeset
15 * You should have received a copy of the GNU General Public License
22a5075fc7f7 GPL Headers
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2838
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses>.
22a5075fc7f7 GPL Headers
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2838
diff changeset
17 */
22a5075fc7f7 GPL Headers
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2838
diff changeset
18
2644
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
19 #include "bluetooth.h"
2646
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
20 #include "marshal.h"
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
21 #include "gui.h"
2728
229647ca4942 added some UI stuff
paula@crocodil
parents: 2649
diff changeset
22 #include "scan_gui.h"
2838
22a2ffe86750 added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2756
diff changeset
23 #include "agent.h"
2854
43557eb3180f playback
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2847
diff changeset
24 #include "../alsa/alsa.h"
2644
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
25 #define DEBUG 1
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
26 static gboolean plugin_active = FALSE,exiting=FALSE;
2646
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
27 GList * current_device = NULL;
2728
229647ca4942 added some UI stuff
paula@crocodil
parents: 2649
diff changeset
28 gint config = 0;
229647ca4942 added some UI stuff
paula@crocodil
parents: 2649
diff changeset
29 gint devices_no = 0;
2646
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
30 GStaticMutex mutex = G_STATIC_MUTEX_INIT;
2845
d0cbf303869b removed interface freeze while pairing
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2842
diff changeset
31 static GThread *connect_th;
2644
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
32 void bluetooth_init ( void );
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
33 void bluetooth_cleanup ( void );
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
34 void bt_cfg(void);
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
35 void bt_about(void);
2646
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
36 static void remote_device_found(DBusGProxy *object, char *address, const unsigned int class, const int rssi, gpointer user_data);
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
37 static void discovery_started(DBusGProxy *object, gpointer user_data);
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
38 static void remote_name_updated(DBusGProxy *object, const char *address, char *name, gpointer user_data);
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
39 static void print_results(void);
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
40 static void discovery_completed(DBusGProxy *object, gpointer user_data);
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
41 void discover_devices(void);
2728
229647ca4942 added some UI stuff
paula@crocodil
parents: 2649
diff changeset
42 void disconnect_dbus_signals(void);
2646
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
43
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
44
2644
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
45 GeneralPlugin bluetooth_gp =
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
46 {
2649
d891ba4be5a5 fixed crash when prefs window was closed while scanning
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2648
diff changeset
47 .description = "Bluetooth audio support",
2644
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
48 .init = bluetooth_init,
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
49 .about = bt_about,
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
50 .configure = bt_cfg,
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
51 .cleanup = bluetooth_cleanup
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
52 };
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
53 GeneralPlugin *bluetooth_gplist[] = { &bluetooth_gp, NULL };
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
54 DECLARE_PLUGIN(bluetooth_gp, NULL, NULL, NULL, NULL, NULL, bluetooth_gplist, NULL, NULL)
2728
229647ca4942 added some UI stuff
paula@crocodil
parents: 2649
diff changeset
55
2644
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
56 void bluetooth_init ( void )
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
57 {
2646
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
58 audio_devices = NULL;
2838
22a2ffe86750 added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2756
diff changeset
59 bus = NULL;
22a2ffe86750 added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2756
diff changeset
60 obj = NULL;
2646
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
61 discover_devices();
2644
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
62 }
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
63
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
64 void bluetooth_cleanup ( void )
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
65 {
2646
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
66 printf("bluetooth: exit\n");
2732
1a27c497e526 indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2728
diff changeset
67 if (config ==1 ){
2756
d3d71539d675 rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2734
diff changeset
68 close_window();
2732
1a27c497e526 indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2728
diff changeset
69 config =0;
2649
d891ba4be5a5 fixed crash when prefs window was closed while scanning
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2648
diff changeset
70 }
2732
1a27c497e526 indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2728
diff changeset
71 if(discover_finish == 2) {
1a27c497e526 indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2728
diff changeset
72 dbus_g_connection_flush (bus);
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
73 dbus_g_connection_unref(bus);
2732
1a27c497e526 indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2728
diff changeset
74 disconnect_dbus_signals();
2644
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
75
2732
1a27c497e526 indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2728
diff changeset
76 }
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
77 }
2732
1a27c497e526 indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2728
diff changeset
78
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
79 void bt_about( void )
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
80 {
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
81 printf("about call\n");
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
82 }
2728
229647ca4942 added some UI stuff
paula@crocodil
parents: 2649
diff changeset
83
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
84 void bt_cfg(void)
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
85 {
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
86 printf("bt_cfg\n");
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
87 config =1;
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
88 if(discover_finish == 2){
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
89 if (devices_no == 0){
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
90 printf("no devs!\n");
2847
671cdfc2d62d Basic pairing interface
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2846
diff changeset
91 show_scan(0);
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
92 show_no_devices();
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
93 }else
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
94 results_ui();
2728
229647ca4942 added some UI stuff
paula@crocodil
parents: 2649
diff changeset
95 }
2847
671cdfc2d62d Basic pairing interface
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2846
diff changeset
96 else show_scan(0);
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
97 printf("end of bt_cfg\n");
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
98 }
2728
229647ca4942 added some UI stuff
paula@crocodil
parents: 2649
diff changeset
99
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
100 void disconnect_dbus_signals()
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
101 {
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
102 dbus_g_proxy_disconnect_signal(obj, "RemoteDeviceFound", G_CALLBACK(remote_device_found), bus);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
103 dbus_g_proxy_disconnect_signal(obj, "DiscoveryStarted", G_CALLBACK(discovery_started), bus);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
104 dbus_g_proxy_disconnect_signal(obj, "DiscoveryCompleted", G_CALLBACK(discovery_completed), bus);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
105 dbus_g_proxy_disconnect_signal(obj, "RemoteNameUpdated", G_CALLBACK(remote_name_updated), NULL);
2644
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
106
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
107 }
2644
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
108
2756
d3d71539d675 rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2734
diff changeset
109 void clean_devices_list(){
d3d71539d675 rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2734
diff changeset
110 g_list_free(audio_devices);
d3d71539d675 rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2734
diff changeset
111 dbus_g_connection_flush (bus);
d3d71539d675 rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2734
diff changeset
112 dbus_g_connection_unref(bus);
d3d71539d675 rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2734
diff changeset
113 audio_devices = NULL;
d3d71539d675 rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2734
diff changeset
114 //g_list_free(current_device);
d3d71539d675 rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2734
diff changeset
115 }
2644
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
116
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
117 void refresh_call(void)
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
118 {
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
119 printf("refresh function called\n");
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
120 disconnect_dbus_signals();
2756
d3d71539d675 rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2734
diff changeset
121 clean_devices_list();
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
122 if(discover_finish == 0 ||discover_finish== 2){
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
123 discover_finish = 0;
2756
d3d71539d675 rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2734
diff changeset
124
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
125 discover_devices();
2756
d3d71539d675 rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2734
diff changeset
126 close_window();
2847
671cdfc2d62d Basic pairing interface
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2846
diff changeset
127 show_scan(0);
2728
229647ca4942 added some UI stuff
paula@crocodil
parents: 2649
diff changeset
128 }
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
129 else
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
130 printf("Scanning please wait!\n");
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
131 }
2644
6fd8ca4b7b17 add bluetooth plugin
Paula Stanciu <paula.stanciu@gmail.com>
parents:
diff changeset
132
2845
d0cbf303869b removed interface freeze while pairing
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2842
diff changeset
133 gpointer connect_call_th(void)
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
134 {
2841
9637eab5a3dd indentation
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2840
diff changeset
135
9637eab5a3dd indentation
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2840
diff changeset
136 //I will have to enable the audio service if necessary
2838
22a2ffe86750 added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2756
diff changeset
137
2845
d0cbf303869b removed interface freeze while pairing
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2842
diff changeset
138 dbus_g_object_register_marshaller(marshal_VOID__STRING_UINT_INT, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INT, G_TYPE_INVALID);
2841
9637eab5a3dd indentation
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2840
diff changeset
139 run_agents();
2845
d0cbf303869b removed interface freeze while pairing
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2842
diff changeset
140 dbus_g_proxy_call(obj,"CreateBonding",NULL,G_TYPE_STRING,((DeviceData*)(selected_dev->data))->address,G_TYPE_INVALID,G_TYPE_INVALID);
d0cbf303869b removed interface freeze while pairing
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2842
diff changeset
141
d0cbf303869b removed interface freeze while pairing
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2842
diff changeset
142 }
d0cbf303869b removed interface freeze while pairing
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2842
diff changeset
143 void connect_call(void)
d0cbf303869b removed interface freeze while pairing
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2842
diff changeset
144 {
2847
671cdfc2d62d Basic pairing interface
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2846
diff changeset
145 connect_th = g_thread_create((GThreadFunc)connect_call_th,NULL,TRUE,NULL) ;
671cdfc2d62d Basic pairing interface
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2846
diff changeset
146 close_call();
671cdfc2d62d Basic pairing interface
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2846
diff changeset
147 close_window();
671cdfc2d62d Basic pairing interface
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2846
diff changeset
148 show_scan(1);
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
149 }
2646
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
150
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
151
2854
43557eb3180f playback
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2847
diff changeset
152 void play_call()
43557eb3180f playback
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2847
diff changeset
153 {
43557eb3180f playback
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2847
diff changeset
154 // static GFile *asoundrc;
43557eb3180f playback
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2847
diff changeset
155
43557eb3180f playback
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2847
diff changeset
156
43557eb3180f playback
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2847
diff changeset
157
43557eb3180f playback
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2847
diff changeset
158 mcs_handle_t *cfgfile = aud_cfg_db_open();
43557eb3180f playback
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2847
diff changeset
159
43557eb3180f playback
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2847
diff changeset
160 aud_cfg_db_set_int(cfgfile, ALSA_CFGID, "buffer_time", 500);
43557eb3180f playback
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2847
diff changeset
161 aud_cfg_db_set_int(cfgfile, ALSA_CFGID, "period_time", 100);
43557eb3180f playback
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2847
diff changeset
162 aud_cfg_db_set_string(cfgfile,ALSA_CFGID,"pcm_device", "bt");
43557eb3180f playback
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2847
diff changeset
163 aud_cfg_db_set_int(cfgfile, ALSA_CFGID, "mixer_card", 0);
43557eb3180f playback
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2847
diff changeset
164 aud_cfg_db_set_string(cfgfile,ALSA_CFGID,"mixer_device", "PCM");
43557eb3180f playback
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2847
diff changeset
165 aud_cfg_db_set_int(cfgfile, ALSA_CFGID, "volume_left", 100);
43557eb3180f playback
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2847
diff changeset
166 aud_cfg_db_set_int(cfgfile, ALSA_CFGID, "volume_right", 100);
43557eb3180f playback
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2847
diff changeset
167 aud_cfg_db_close(cfgfile);
43557eb3180f playback
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2847
diff changeset
168
43557eb3180f playback
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2847
diff changeset
169 printf("play callback\n");
43557eb3180f playback
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2847
diff changeset
170
43557eb3180f playback
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2847
diff changeset
171
43557eb3180f playback
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2847
diff changeset
172 }
43557eb3180f playback
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2847
diff changeset
173
43557eb3180f playback
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2847
diff changeset
174
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
175 static void remote_device_found(DBusGProxy *object, char *address, const unsigned int class, const int rssi, gpointer user_data)
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
176 {
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
177 int found_in_list=FALSE;
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
178 g_static_mutex_lock(&mutex);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
179 current_device = audio_devices;
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
180 if((class & 0x200404)==0x200404)
2646
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
181 {
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
182 while(current_device != NULL)
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
183 {
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
184 if(g_str_equal(address,((DeviceData*)(current_device->data))->address))
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
185 {
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
186 found_in_list = TRUE;
2646
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
187 break;
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
188 }
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
189 current_device=g_list_next(current_device);
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
190 }
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
191 if(!found_in_list)
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
192 {
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
193 DeviceData *dev= g_new0(DeviceData, 1);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
194 dev->class = class;
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
195 dev->address = g_strdup(address);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
196 dev->name = NULL;
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
197 audio_devices=g_list_prepend(audio_devices, dev);
2646
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
198 }
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
199 }
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
200 g_static_mutex_unlock(&mutex);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
201 }
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
202
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
203 static void discovery_started(DBusGProxy *object, gpointer user_data)
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
204 {
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
205 g_print("Signal: DiscoveryStarted()\n");
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
206 discover_finish = 1;
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
207 }
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
208
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
209 static void remote_name_updated(DBusGProxy *object, const char *address, char *name, gpointer user_data)
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
210 {
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
211 g_static_mutex_lock(&mutex);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
212 current_device=audio_devices;
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
213 while(current_device != NULL)
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
214 {
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
215 if(g_str_equal(address,((DeviceData*)(current_device->data))->address))
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
216 {
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
217 ((DeviceData*)(current_device->data))->name=g_strdup(name);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
218 break;
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
219 }
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
220 current_device=g_list_next(current_device);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
221 }
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
222 g_static_mutex_unlock(&mutex);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
223 }
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
224
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
225 static void print_results()
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
226 {
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
227 int i=0;
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
228 g_print("Final Scan results:\n");
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
229 devices_no = g_list_length(audio_devices);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
230 g_print("Number of audio devices: %d \n",devices_no);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
231 if(devices_no==0 ) {
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
232 if(config ==1) show_no_devices();
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
233 } else {
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
234 current_device=audio_devices;
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
235 while(current_device != NULL)
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
236 {
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
237 g_print("Device %d: Name: %s, Class: 0x%x, Address: %s\n",++i,
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
238 ((DeviceData*)(current_device->data))-> name,
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
239 ((DeviceData*)(current_device->data))-> class,
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
240 ((DeviceData*)(current_device->data))-> address);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
241 current_device=g_list_next(current_device);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
242 }
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
243 destroy_scan_window();
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
244 if(config==1) {
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
245 destroy_scan_window();
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
246 results_ui();
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
247 }
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
248 // refresh_tree();
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
249 }
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
250 }
2646
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
251
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
252
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
253
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
254 static void discovery_completed(DBusGProxy *object, gpointer user_data)
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
255 {
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
256 g_print("Signal: DiscoveryCompleted()\n");
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
257 discover_finish =2;
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
258 print_results();
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
259 }
2646
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
260
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
261
2728
229647ca4942 added some UI stuff
paula@crocodil
parents: 2649
diff changeset
262
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
263 void discover_devices(void)
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
264 {
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
265 GError *error = NULL;
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
266 // g_type_init();
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
267 g_log_set_always_fatal (G_LOG_LEVEL_WARNING);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
268 bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
269 if (error != NULL)
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
270 {
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
271 g_printerr("Connecting to system bus failed: %s\n", error->message);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
272 g_error_free(error);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
273 }
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
274 obj = dbus_g_proxy_new_for_name(bus, "org.bluez", "/org/bluez/hci0", "org.bluez.Adapter");
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
275 printf("bluetooth plugin - start discovery \n");
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
276 dbus_g_object_register_marshaller(marshal_VOID__STRING_UINT_INT, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INT, G_TYPE_INVALID);
2646
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
277
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
278 dbus_g_proxy_add_signal(obj, "RemoteDeviceFound", G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INT, G_TYPE_INVALID);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
279 dbus_g_proxy_connect_signal(obj, "RemoteDeviceFound", G_CALLBACK(remote_device_found), bus, NULL);
2646
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
280
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
281 dbus_g_proxy_add_signal(obj, "DiscoveryStarted", G_TYPE_INVALID);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
282 dbus_g_proxy_connect_signal(obj, "DiscoveryStarted", G_CALLBACK(discovery_started), bus, NULL);
2646
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
283
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
284 dbus_g_proxy_add_signal(obj, "DiscoveryCompleted", G_TYPE_INVALID);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
285 dbus_g_proxy_connect_signal(obj, "DiscoveryCompleted", G_CALLBACK(discovery_completed), bus, NULL);
2646
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
286
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
287 dbus_g_object_register_marshaller(marshal_VOID__STRING_STRING, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
2728
229647ca4942 added some UI stuff
paula@crocodil
parents: 2649
diff changeset
288
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
289 dbus_g_proxy_add_signal(obj, "RemoteNameUpdated", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
290 dbus_g_proxy_connect_signal(obj, "RemoteNameUpdated", G_CALLBACK(remote_name_updated), NULL, NULL);
2646
7fbff3287a56 added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2644
diff changeset
291
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
292 dbus_g_proxy_call(obj, "DiscoverDevices", &error, G_TYPE_INVALID, G_TYPE_INVALID);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
293 if (error != NULL)
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
294 {
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
295 g_printerr("Failed to discover devices: %s\n", error->message);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
296 g_error_free(error);
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
297 }
2728
229647ca4942 added some UI stuff
paula@crocodil
parents: 2649
diff changeset
298
2734
8a102490a8c0 compilation fix
Paula Stanciu <paula.stanciu@gmail.com>
parents: 2732
diff changeset
299 }