Mercurial > audlegacy-plugins
annotate src/bluetooth/bluetooth.c @ 2838:22a2ffe86750
added passkey agent and basic pairing functionality
| author | Paula Stanciu <paula.stanciu@gmail.com> |
|---|---|
| date | Wed, 16 Jul 2008 20:48:09 +0300 |
| parents | d3d71539d675 |
| children | 22a5075fc7f7 |
| rev | line source |
|---|---|
| 2644 | 1 #include "bluetooth.h" |
|
2646
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
2 #include "marshal.h" |
|
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
3 #include "gui.h" |
| 2728 | 4 #include "scan_gui.h" |
|
2838
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
5 #include "agent.h" |
| 2644 | 6 #define DEBUG 1 |
| 7 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
|
8 GList * current_device = NULL; |
| 2728 | 9 gint config = 0; |
| 10 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
|
11 GStaticMutex mutex = G_STATIC_MUTEX_INIT; |
| 2644 | 12 |
| 13 void bluetooth_init ( void ); | |
| 14 void bluetooth_cleanup ( void ); | |
| 15 void bt_cfg(void); | |
| 16 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
|
17 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
|
18 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
|
19 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
|
20 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
|
21 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
|
22 void discover_devices(void); |
| 2728 | 23 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
|
24 |
|
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
25 |
| 2644 | 26 GeneralPlugin bluetooth_gp = |
| 27 { | |
|
2649
d891ba4be5a5
fixed crash when prefs window was closed while scanning
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2648
diff
changeset
|
28 .description = "Bluetooth audio support", |
| 2644 | 29 .init = bluetooth_init, |
| 30 .about = bt_about, | |
| 31 .configure = bt_cfg, | |
| 32 .cleanup = bluetooth_cleanup | |
| 33 }; | |
| 34 GeneralPlugin *bluetooth_gplist[] = { &bluetooth_gp, NULL }; | |
| 35 DECLARE_PLUGIN(bluetooth_gp, NULL, NULL, NULL, NULL, NULL, bluetooth_gplist, NULL, NULL) | |
| 2728 | 36 |
| 2644 | 37 void bluetooth_init ( void ) |
| 38 { | |
|
2646
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
39 audio_devices = NULL; |
|
2838
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
40 bus = NULL; |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
41 obj = NULL; |
|
2646
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
42 discover_devices(); |
| 2644 | 43 } |
| 44 | |
| 45 void bluetooth_cleanup ( void ) | |
| 46 { | |
|
2646
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
47 printf("bluetooth: exit\n"); |
|
2732
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
48 if (config ==1 ){ |
|
2756
d3d71539d675
rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2734
diff
changeset
|
49 close_window(); |
|
2732
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
50 config =0; |
|
2649
d891ba4be5a5
fixed crash when prefs window was closed while scanning
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2648
diff
changeset
|
51 } |
|
2732
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
52 if(discover_finish == 2) { |
|
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
53 dbus_g_connection_flush (bus); |
| 2734 | 54 dbus_g_connection_unref(bus); |
|
2732
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
55 disconnect_dbus_signals(); |
| 2644 | 56 |
|
2732
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
57 } |
| 2734 | 58 } |
|
2732
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
59 |
| 2734 | 60 void bt_about( void ) |
| 61 { | |
| 62 printf("about call\n"); | |
|
2838
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
63 run_agent(); |
| 2734 | 64 } |
| 2728 | 65 |
| 2734 | 66 void bt_cfg(void) |
| 67 { | |
| 68 printf("bt_cfg\n"); | |
| 69 config =1; | |
| 70 if(discover_finish == 2){ | |
| 71 if (devices_no == 0){ | |
| 72 printf("no devs!\n"); | |
| 73 show_scan(); | |
| 74 show_no_devices(); | |
| 75 }else | |
| 76 results_ui(); | |
| 2728 | 77 } |
| 2734 | 78 else show_scan(); |
| 79 printf("end of bt_cfg\n"); | |
| 80 } | |
| 2728 | 81 |
| 2734 | 82 void disconnect_dbus_signals() |
| 83 { | |
| 84 dbus_g_proxy_disconnect_signal(obj, "RemoteDeviceFound", G_CALLBACK(remote_device_found), bus); | |
| 85 dbus_g_proxy_disconnect_signal(obj, "DiscoveryStarted", G_CALLBACK(discovery_started), bus); | |
| 86 dbus_g_proxy_disconnect_signal(obj, "DiscoveryCompleted", G_CALLBACK(discovery_completed), bus); | |
| 87 dbus_g_proxy_disconnect_signal(obj, "RemoteNameUpdated", G_CALLBACK(remote_name_updated), NULL); | |
| 2644 | 88 |
| 2734 | 89 } |
| 2644 | 90 |
|
2756
d3d71539d675
rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2734
diff
changeset
|
91 void clean_devices_list(){ |
|
d3d71539d675
rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2734
diff
changeset
|
92 g_list_free(audio_devices); |
|
d3d71539d675
rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2734
diff
changeset
|
93 dbus_g_connection_flush (bus); |
|
d3d71539d675
rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2734
diff
changeset
|
94 dbus_g_connection_unref(bus); |
|
d3d71539d675
rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2734
diff
changeset
|
95 audio_devices = NULL; |
|
d3d71539d675
rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2734
diff
changeset
|
96 //g_list_free(current_device); |
|
d3d71539d675
rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2734
diff
changeset
|
97 } |
| 2644 | 98 |
| 2734 | 99 void refresh_call(void) |
| 100 { | |
| 101 printf("refresh function called\n"); | |
| 102 disconnect_dbus_signals(); | |
|
2756
d3d71539d675
rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2734
diff
changeset
|
103 clean_devices_list(); |
| 2734 | 104 if(discover_finish == 0 ||discover_finish== 2){ |
| 105 discover_finish = 0; | |
|
2756
d3d71539d675
rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2734
diff
changeset
|
106 |
| 2734 | 107 discover_devices(); |
|
2756
d3d71539d675
rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2734
diff
changeset
|
108 close_window(); |
|
d3d71539d675
rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2734
diff
changeset
|
109 show_scan(); |
| 2728 | 110 } |
| 2734 | 111 else |
| 112 printf("Scanning please wait!\n"); | |
| 113 } | |
| 2644 | 114 |
|
2838
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
115 void bounding_created(gchar* address) |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
116 { |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
117 printf("Signal BoundingCreated : %s\n",address); |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
118 |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
119 } |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
120 |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
121 void bounding_removed(gchar* address) |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
122 { |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
123 printf("Signal: BoundingRemoved: %s\n",address); |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
124 |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
125 } |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
126 |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
127 |
| 2734 | 128 void connect_call(void) |
| 129 { | |
|
2838
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
130 |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
131 //I will have to enable the audio service if necessary |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
132 |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
133 /* 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); |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
134 dbus_g_proxy_add_signal(obj, "BondingCreated", G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INT, G_TYPE_INVALID); |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
135 dbus_g_proxy_connect_signal(obj, "BondingCreated", G_CALLBACK(bounding_created), bus, NULL); |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
136 |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
137 dbus_g_proxy_add_signal(obj, "BondingRemoved", G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INT, G_TYPE_INVALID); |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
138 dbus_g_proxy_connect_signal(obj, "BondingRemoved", G_CALLBACK(bounding_removed), bus, NULL); |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
139 */ |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
140 dbus_g_proxy_call(obj,"CreateBonding",NULL,G_TYPE_STRING,"00:0D:3C:B1:1C:7A",G_TYPE_INVALID,G_TYPE_INVALID); |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
141 |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
142 |
|
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2756
diff
changeset
|
143 |
| 2734 | 144 } |
|
2646
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
145 |
|
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
146 |
| 2734 | 147 static void remote_device_found(DBusGProxy *object, char *address, const unsigned int class, const int rssi, gpointer user_data) |
| 148 { | |
| 149 int found_in_list=FALSE; | |
| 150 g_static_mutex_lock(&mutex); | |
| 151 current_device = audio_devices; | |
| 152 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
|
153 { |
|
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
154 while(current_device != NULL) |
|
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
155 { |
|
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
156 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
|
157 { |
| 2734 | 158 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
|
159 break; |
|
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
160 } |
|
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
161 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
|
162 } |
| 2734 | 163 if(!found_in_list) |
| 164 { | |
| 165 DeviceData *dev= g_new0(DeviceData, 1); | |
| 166 dev->class = class; | |
| 167 dev->address = g_strdup(address); | |
| 168 dev->name = NULL; | |
| 169 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
|
170 } |
|
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
171 } |
| 2734 | 172 g_static_mutex_unlock(&mutex); |
| 173 } | |
| 174 | |
| 175 static void discovery_started(DBusGProxy *object, gpointer user_data) | |
| 176 { | |
| 177 g_print("Signal: DiscoveryStarted()\n"); | |
| 178 discover_finish = 1; | |
| 179 } | |
| 180 | |
| 181 static void remote_name_updated(DBusGProxy *object, const char *address, char *name, gpointer user_data) | |
| 182 { | |
| 183 g_static_mutex_lock(&mutex); | |
| 184 current_device=audio_devices; | |
| 185 while(current_device != NULL) | |
| 186 { | |
| 187 if(g_str_equal(address,((DeviceData*)(current_device->data))->address)) | |
| 188 { | |
| 189 ((DeviceData*)(current_device->data))->name=g_strdup(name); | |
| 190 break; | |
| 191 } | |
| 192 current_device=g_list_next(current_device); | |
| 193 } | |
| 194 g_static_mutex_unlock(&mutex); | |
| 195 } | |
| 196 | |
| 197 static void print_results() | |
| 198 { | |
| 199 int i=0; | |
| 200 g_print("Final Scan results:\n"); | |
| 201 devices_no = g_list_length(audio_devices); | |
| 202 g_print("Number of audio devices: %d \n",devices_no); | |
| 203 if(devices_no==0 ) { | |
| 204 if(config ==1) show_no_devices(); | |
| 205 } else { | |
| 206 current_device=audio_devices; | |
| 207 while(current_device != NULL) | |
| 208 { | |
| 209 g_print("Device %d: Name: %s, Class: 0x%x, Address: %s\n",++i, | |
| 210 ((DeviceData*)(current_device->data))-> name, | |
| 211 ((DeviceData*)(current_device->data))-> class, | |
| 212 ((DeviceData*)(current_device->data))-> address); | |
| 213 current_device=g_list_next(current_device); | |
| 214 } | |
| 215 destroy_scan_window(); | |
| 216 if(config==1) { | |
| 217 destroy_scan_window(); | |
| 218 results_ui(); | |
| 219 } | |
| 220 // refresh_tree(); | |
| 221 } | |
| 222 } | |
|
2646
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
223 |
|
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
224 |
|
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
225 |
| 2734 | 226 static void discovery_completed(DBusGProxy *object, gpointer user_data) |
| 227 { | |
| 228 g_print("Signal: DiscoveryCompleted()\n"); | |
| 229 discover_finish =2; | |
| 230 print_results(); | |
| 231 } | |
|
2646
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
232 |
|
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
233 |
| 2728 | 234 |
| 2734 | 235 void discover_devices(void) |
| 236 { | |
| 237 GError *error = NULL; | |
| 238 // g_type_init(); | |
| 239 g_log_set_always_fatal (G_LOG_LEVEL_WARNING); | |
| 240 bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error); | |
| 241 if (error != NULL) | |
| 242 { | |
| 243 g_printerr("Connecting to system bus failed: %s\n", error->message); | |
| 244 g_error_free(error); | |
| 245 } | |
| 246 obj = dbus_g_proxy_new_for_name(bus, "org.bluez", "/org/bluez/hci0", "org.bluez.Adapter"); | |
| 247 printf("bluetooth plugin - start discovery \n"); | |
| 248 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
|
249 |
| 2734 | 250 dbus_g_proxy_add_signal(obj, "RemoteDeviceFound", G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INT, G_TYPE_INVALID); |
| 251 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
|
252 |
| 2734 | 253 dbus_g_proxy_add_signal(obj, "DiscoveryStarted", G_TYPE_INVALID); |
| 254 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
|
255 |
| 2734 | 256 dbus_g_proxy_add_signal(obj, "DiscoveryCompleted", G_TYPE_INVALID); |
| 257 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
|
258 |
| 2734 | 259 dbus_g_object_register_marshaller(marshal_VOID__STRING_STRING, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); |
| 2728 | 260 |
| 2734 | 261 dbus_g_proxy_add_signal(obj, "RemoteNameUpdated", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); |
| 262 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
|
263 |
| 2734 | 264 dbus_g_proxy_call(obj, "DiscoverDevices", &error, G_TYPE_INVALID, G_TYPE_INVALID); |
| 265 if (error != NULL) | |
| 266 { | |
| 267 g_printerr("Failed to discover devices: %s\n", error->message); | |
| 268 g_error_free(error); | |
| 269 } | |
| 2728 | 270 |
| 2734 | 271 } |
