Changeset 193
- Timestamp:
- 09/05/07 14:48:39 (15 months ago)
- Location:
- trunk/obexftp
- Files:
-
- 1 added
- 3 modified
- 1 moved
-
Makefile.am (modified) (1 diff)
-
bt_kit.c (moved) (moved from trunk/obexftp/bt_discovery.c) (5 diffs)
-
bt_kit.h (added)
-
client.c (modified) (4 diffs)
-
client.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/obexftp/Makefile.am
r180 r193 12 12 cache.c cache.h \ 13 13 uuid.h obexftp.h \ 14 bt_ discovery.c14 bt_kit.c bt_kit.h 15 15 16 16 obexftpinclude_HEADERS = obexftp.h \ -
trunk/obexftp/bt_kit.c
r186 r193 1 1 /** 2 \file obexftp/bt_ discovery.c3 B T/SDP device discovery functions.2 \file obexftp/bt_kit.c 3 Bluetooth, SDP, HCI kit for Linux, FreeBSD, NetBSD and Win32. 4 4 ObexFTP library - language bindings for OBEX file transfer. 5 5 … … 20 20 */ 21 21 22 #i nclude <common.h>23 #i fdef HAVE_BLUETOOTH24 # ifdef HAVE_SDPLIB22 #ifdef HAVE_CONFIG_H 23 #include <config.h> 24 #endif 25 25 26 26 #include <stdio.h> … … 32 32 #include <sys/socket.h> 33 33 34 #include <bluetooth/bluetooth.h> 35 #include <bluetooth/hci.h> 36 #include <bluetooth/hci_lib.h> 37 #include <bluetooth/sdp.h> 38 #include <bluetooth/sdp_lib.h> 39 40 #include "client.h" 41 42 /* Nokia OBEX PC Suite Services */ 43 /* 00005005-0000-1000-8000-0002ee000001 */ 44 /* prefer this over FTP on Series 60 devices */ 34 #include "bt_kit.h" 35 36 #include <common.h> 37 38 #ifdef HAVE_BLUETOOTH 39 #ifdef HAVE_SDPLIB /* should switch on OS here */ 40 41 /** 42 Nokia OBEX PC Suite Services. 43 binary representation of 00005005-0000-1000-8000-0002ee000001 44 \note prefer this over FTP on Series 60 devices 45 */ 45 46 #define __SVC_UUID_PCSUITE_bytes \ 46 47 { 0x00, 0x00, 0x50, 0x05, \ … … 49 50 #define SVC_UUID_PCSUITE ((const uint8_t []) __SVC_UUID_PCSUITE_bytes) 50 51 51 char **obexftp_discover_bt_src(const char *src) 52 #ifdef _WIN32 53 /** 54 Implementation of str2ba for winsock2. 55 */ 56 int str2ba(const char *straddr, BTH_ADDR *btaddr) 57 { 58 int i; 59 unsigned int aaddr[6]; 60 BTH_ADDR tmpaddr = 0; 61 62 if (sscanf(straddr, "%02x:%02x:%02x:%02x:%02x:%02x", 63 &aaddr[0], &aaddr[1], &aaddr[2], 64 &aaddr[3], &aaddr[4], &aaddr[5]) != 6) 65 return 1; 66 *btaddr = 0; 67 for (i = 0; i < 6; i++) { 68 tmpaddr = (BTH_ADDR) (aaddr[i] & 0xff); 69 *btaddr = ((*btaddr) << 8) + tmpaddr; 70 } 71 return 0; 72 } 73 #endif 74 75 76 /** 77 Discover all bluetooth devices in range. 78 \param src optional source interface address (HCI or MAC) 79 \return an array of device addresses 80 */ 81 // Win32 note: WSALookupServiceBegin for Device Inquiry 82 // see http://msdn2.microsoft.com/en-us/library/aa362913.aspx 83 char **btkit_discover(const char *src) 52 84 { 53 85 char **res; 54 inquiry_info *info = NULL; 55 bdaddr_t bdaddr, bdswap; 56 char name[248]; 57 int dev_id; 58 int num_rsp = 10; 59 int flags = 0; 60 int length = 8; 61 int dd, i; 62 63 /* Get local bluetooth address */ 64 if (src && strlen(src) == 17) 65 dev_id = hci_devid(src); 66 else if (src) 67 dev_id = atoi(src); 68 else 69 dev_id = hci_get_route(NULL); 70 DEBUG(2, "%s: Scanning ...\n", __func__); 71 flags = IREQ_CACHE_FLUSH; /* only show devices currently in range */ 72 num_rsp = hci_inquiry(dev_id, length, num_rsp, NULL, &info, flags); 73 74 if(num_rsp < 0) 75 { 76 DEBUG(1, "%s: Inquiry failed", __func__); 77 return NULL; 78 } 79 80 dd = hci_open_dev(dev_id); 81 if (dd < 0) 82 { 83 DEBUG(1, "%s: HCI device open failed", __func__); 84 free(info); 85 return NULL; 86 } 86 inquiry_info *info = NULL; 87 bdaddr_t bdswap; 88 int dev_id; 89 int num_rsp = 10; 90 int flags = 0; 91 int length = 8; 92 int dd, i; 93 94 /* Get local bluetooth address */ 95 if (src && strlen(src) == 17) 96 dev_id = hci_devid(src); 97 else if (src) 98 dev_id = atoi(src); 99 else 100 dev_id = hci_get_route(NULL); 101 DEBUG(2, "%s: Scanning ...\n", __func__); 102 flags = IREQ_CACHE_FLUSH; /* only show devices currently in range */ 103 num_rsp = hci_inquiry(dev_id, length, num_rsp, NULL, &info, flags); 104 105 if(num_rsp < 0) { 106 DEBUG(1, "%s: Inquiry failed", __func__); 107 return NULL; 108 } 109 110 dd = hci_open_dev(dev_id); 111 if (dd < 0) { 112 DEBUG(1, "%s: HCI device open failed", __func__); 113 free(info); 114 return NULL; 115 } 87 116 88 res = calloc(num_rsp + 1, sizeof(char *)); 89 for(i = 0; i < num_rsp; i++) 90 { 91 memset(name, 0, sizeof(name)); 92 baswap(&bdswap, &(info+i)->bdaddr); 93 94 if(hci_read_remote_name(dd, &(info+i)->bdaddr, sizeof(name), name, 100000) < 0) 95 { 96 strcpy(name, "No Name"); 97 } 98 99 DEBUG(2, "%s: Found\t%s\t%s\n", __func__, batostr(&bdswap), name); 100 res[i] = strdup(batostr(&bdswap)); 101 } 117 res = calloc(num_rsp + 1, sizeof(char *)); 118 for(i = 0; i < num_rsp; i++) { 119 baswap(&bdswap, &(info+i)->bdaddr); 120 res[i] = batostr(&bdswap); 121 DEBUG(2, "%s: Found\t%s\n", __func__, res[i]); 122 } 102 123 103 close(dd);104 free(info);124 hci_close_dev(dd); 125 free(info); 105 126 106 return res; 107 } 127 return res; 128 } 129 130 131 /** 132 Get the name of a bluetooth device. 133 \param src optional source interface address (HCI or MAC) 134 \param addr the bluetooth address of the device to query 135 \return the bluetooth name of the device 136 */ 137 char *btkit_getname(const char *src, const char *addr) 138 { 139 bdaddr_t bdaddr; 140 int dev_id, dd; 141 char name[248]; 142 143 return_val_if_fail(addr != NULL, NULL); 144 str2ba(addr, &bdaddr); 145 146 /* Get local bluetooth address */ 147 if (src && strlen(src) == 17) 148 dev_id = hci_devid(src); 149 else if (src) 150 dev_id = atoi(src); 151 else 152 dev_id = hci_get_route(NULL); 153 154 dd = hci_open_dev(dev_id); 155 if (dd < 0) { 156 DEBUG(1, "%s: HCI device open failed", __func__); 157 return NULL; 158 } 159 160 if(hci_read_remote_name(dd, &bdaddr, sizeof(name), name, 100000) < 0) { 161 strcpy(name, "No Name"); 162 } 163 hci_close_dev(dd); 164 165 return strdup(name); 166 } 167 108 168 109 169 static int browse_sdp_uuid(sdp_session_t *sess, uuid_t *uuid) 110 170 { 111 sdp_list_t *attrid, *search, *seq, *loop; 112 uint32_t range = SDP_ATTR_PROTO_DESC_LIST; 113 /* 0x0000ffff for SDP_ATTR_REQ_RANGE */ 114 int channel = -1; 115 116 attrid = sdp_list_append(0, &range); 117 search = sdp_list_append(0, uuid); 118 119 /* Get a linked list of services */ 120 if(sdp_service_search_attr_req(sess, search, SDP_ATTR_REQ_INDIVIDUAL, attrid, &seq) < 0) 121 { 122 DEBUG(1, "%s: SDP service search failed", __func__); 123 sdp_close(sess); 124 return -1; 125 } 126 127 sdp_list_free(attrid, 0); 128 sdp_list_free(search, 0); 129 130 /* Loop through the list of services */ 131 for(loop = seq; loop; loop = loop->next) 132 { 133 sdp_record_t *rec = (sdp_record_t *) loop->data; 134 sdp_list_t *access = NULL; 135 136 /* get the RFCOMM channel */ 137 sdp_get_access_protos(rec, &access); 138 139 if(access) 140 { 141 channel = sdp_get_proto_port(access, RFCOMM_UUID); 142 } 143 } 144 145 sdp_list_free(seq, 0); 146 147 return channel; 148 } 149 150 int obexftp_browse_bt_src(const char *src, const char *addr, int svclass) 151 { 152 int res = -1; 153 int dev_id; 154 sdp_session_t *sess; 155 uuid_t root_uuid; 156 bdaddr_t bdaddr; 157 158 if (!addr || strlen(addr) != 17) 159 return -1; 160 str2ba(addr, &bdaddr); 161 162 /* Get local bluetooth address */ 163 if (src && strlen(src) == 17) 164 dev_id = hci_devid(src); 165 else if (src) 166 dev_id = atoi(src); 167 else 168 dev_id = hci_get_route(NULL); 169 170 /* Connect to remote SDP server */ 171 sess = sdp_connect(BDADDR_ANY, &bdaddr, SDP_RETRY_IF_BUSY); 172 173 if(!sess) 174 { 175 DEBUG(1, "%s: Failed to connect to SDP server", __func__); 176 return -1; 177 } 178 // baswap(&bdswap, &bdaddr); 179 // *res_bdaddr = batostr(&bdswap); 180 // fprintf(stderr, "Browsing %s ...\n", *res_bdaddr); 181 182 /* determine the service class we're looking for */ 183 if ((svclass != IRMC_SYNC_SVCLASS_ID) && 184 (svclass != OBEX_OBJPUSH_SVCLASS_ID) && 185 (svclass != OBEX_FILETRANS_SVCLASS_ID)) 186 { 187 svclass = OBEX_FILETRANS_SVCLASS_ID; 188 /* or OBEX_FILETRANS_PROFILE_ID? */ 189 } 190 191 /* prefer PCSUITE over FTP */ 192 if (svclass == OBEX_FILETRANS_SVCLASS_ID) 193 { 194 sdp_uuid128_create(&root_uuid, &SVC_UUID_PCSUITE); 195 res = browse_sdp_uuid(sess, &root_uuid); 196 if (res > 0) return res; 197 } 198 199 /* browse for the service class */ 200 sdp_uuid16_create(&root_uuid, svclass); 201 res = browse_sdp_uuid(sess, &root_uuid); 202 203 sdp_close(sess); 204 205 return res; 206 } 171 sdp_list_t *attrid, *search, *seq, *loop; 172 uint32_t range = SDP_ATTR_PROTO_DESC_LIST; 173 /* 0x0000ffff for SDP_ATTR_REQ_RANGE */ 174 int channel = -1; 175 176 attrid = sdp_list_append(0, &range); 177 search = sdp_list_append(0, uuid); 178 179 /* Get a linked list of services */ 180 if(sdp_service_search_attr_req(sess, search, SDP_ATTR_REQ_INDIVIDUAL, attrid, &seq) < 0) { 181 DEBUG(1, "%s: SDP service search failed", __func__); 182 sdp_close(sess); 183 return -1; 184 } 185 186 sdp_list_free(attrid, 0); 187 sdp_list_free(search, 0); 188 189 /* Loop through the list of services */ 190 for(loop = seq; loop; loop = loop->next) { 191 sdp_record_t *rec = (sdp_record_t *) loop->data; 192 sdp_list_t *access = NULL; 193 194 /* get the RFCOMM channel */ 195 sdp_get_access_protos(rec, &access); 196 197 if(access) { 198 channel = sdp_get_proto_port(access, RFCOMM_UUID); 199 } 200 } 201 202 sdp_list_free(seq, 0); 203 204 return channel; 205 } 206 207 208 /** 209 Browse a bluetooth device for a given service class. 210 \param src optional source interface address (HCI or MAC) 211 \param addr the bluetooth address of the device to query 212 \return the channel on which the service runs 213 */ 214 // Win32 note: 215 // WSALookupServiceBegin for Service Discovery 216 // see http://msdn2.microsoft.com/en-us/library/aa362914.aspx 217 // WSALookupServiceBegin( WSAQUERYSET with 218 // lpServiceClassId = RFCOMM 219 // dwNameSpace = NS_BTH 220 // lpszContext = WSAAddressToString ) 221 // WSALookupServiceNext 222 // WSALookupServiceEnd 223 int btkit_browse(const char *src, const char *addr, int svclass) 224 { 225 int res = -1; 226 int dev_id; 227 sdp_session_t *sess; 228 uuid_t root_uuid; 229 bdaddr_t bdaddr; 230 231 if (!addr || strlen(addr) != 17) 232 return -1; 233 str2ba(addr, &bdaddr); 234 235 /* Get local bluetooth address */ 236 if (src && strlen(src) == 17) 237 dev_id = hci_devid(src); 238 else if (src) 239 dev_id = atoi(src); 240 else 241 dev_id = hci_get_route(NULL); 242 243 /* Connect to remote SDP server */ 244 sess = sdp_connect(BDADDR_ANY, &bdaddr, SDP_RETRY_IF_BUSY); 245 246 if(!sess) { 247 DEBUG(1, "%s: Failed to connect to SDP server", __func__); 248 return -1; 249 } 250 // baswap(&bdswap, &bdaddr); 251 // *res_bdaddr = batostr(&bdswap); 252 // fprintf(stderr, "Browsing %s ...\n", *res_bdaddr); 253 254 /* determine the service class we're looking for */ 255 if ((svclass != IRMC_SYNC_SVCLASS_ID) && 256 (svclass != OBEX_OBJPUSH_SVCLASS_ID) && 257 (svclass != OBEX_FILETRANS_SVCLASS_ID)) { 258 svclass = OBEX_FILETRANS_SVCLASS_ID; 259 /* or OBEX_FILETRANS_PROFILE_ID? */ 260 } 261 262 /* prefer PCSUITE over FTP */ 263 if (svclass == OBEX_FILETRANS_SVCLASS_ID) { 264 sdp_uuid128_create(&root_uuid, &SVC_UUID_PCSUITE); 265 res = browse_sdp_uuid(sess, &root_uuid); 266 if (res > 0) return res; 267 } 268 269 /* browse for the service class */ 270 sdp_uuid16_create(&root_uuid, svclass); 271 res = browse_sdp_uuid(sess, &root_uuid); 272 273 sdp_close(sess); 274 275 return res; 276 } 277 278 279 /** 280 Search for OBEX FTP service. 281 \return 1 if service is found and 0 otherwise 282 */ 283 static sdp_record_t *sdp_search_service(sdp_session_t *sess, uint16_t service) 284 { 285 sdp_list_t *attrid, *srch, *rsp = NULL; 286 uint32_t range = 0x0000ffff; 287 uuid_t svclass; 288 int ret; 289 290 attrid = sdp_list_append(0, &range); 291 sdp_uuid16_create(&svclass, service); 292 srch = sdp_list_append(NULL, &svclass); 293 294 ret = sdp_service_search_attr_req(sess, srch, SDP_ATTR_REQ_RANGE, attrid, &rsp); 295 sdp_list_free(attrid, 0); 296 sdp_list_free(srch, 0); 297 if (ret < 0) { 298 DEBUG(1, "Failed to search the local SDP server."); 299 return NULL; 300 } 301 302 if (sdp_list_len(rsp) == 0) { 303 DEBUG(1, "No records found on the local SDP server."); 304 return NULL; 305 } 306 return (sdp_record_t *) rsp->data; 307 } 308 309 310 /** 311 Delete a service record from the local SDP server. 312 */ 313 int btkit_unregister_service(int svclass) 314 { 315 sdp_session_t *session; 316 sdp_record_t *record; 317 318 session = sdp_connect(BDADDR_ANY, BDADDR_LOCAL, 0); 319 if (!session) { 320 DEBUG(1, "Failed to connect to the local SDP server."); 321 return -1; 322 } 323 record = sdp_search_service(session, svclass); 324 325 if (record && sdp_record_unregister(session, record)) 326 DEBUG(1, "Service record unregistration failed."); 327 328 sdp_close(session); 329 } 330 331 332 /** 333 Add a service record to the local SDP server. 334 */ 335 int btkit_register_obex(int service, int channel) 336 { 337 sdp_session_t *session; 338 sdp_record_t *record; 339 sdp_list_t *svclass, *pfseq, *apseq, *root, *aproto; 340 uuid_t root_uuid, l2cap, rfcomm, obex, obexftp; 341 sdp_profile_desc_t profile; 342 sdp_list_t *proto[3]; 343 sdp_data_t *v; 344 uint8_t channel_id = 1; /* should look for a free one */ 345 int status; 346 347 if (channel > 0) channel_id = channel; 348 349 session = sdp_connect(BDADDR_ANY, BDADDR_LOCAL, 0); 350 if (!session) { 351 DEBUG(1, "Failed to connect to the local SDP server."); 352 return -1; 353 } 354 355 record = sdp_record_alloc(); 356 if (!record) { 357 DEBUG(1, "Failed to allocate service record."); 358 sdp_close(session); 359 return -1; 360 } 361 362 /* Register to Public Browse Group */ 363 sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP); 364 root = sdp_list_append(NULL, &root_uuid); 365 sdp_set_browse_groups(record, root); 366 sdp_list_free(root, NULL); 367 368 /* Protocol Descriptor List: L2CAP */ 369 sdp_uuid16_create(&l2cap, L2CAP_UUID); 370 proto[0] = sdp_list_append(NULL, &l2cap); 371 apseq = sdp_list_append(NULL, proto[0]); 372 373 /* Protocol Descriptor List: RFCOMM */ 374 sdp_uuid16_create(&rfcomm, RFCOMM_UUID); 375 proto[1] = sdp_list_append(NULL, &rfcomm); 376 v = sdp_data_alloc(SDP_UINT8, &channel_id); 377 proto[1] = sdp_list_append(proto[1], v); 378 apseq = sdp_list_append(apseq, proto[1]); 379 380 /* Protocol Descriptor List: OBEX */ 381 sdp_uuid16_create(&obex, OBEX_UUID); 382 proto[2] = sdp_list_append(NULL, &obex); 383 apseq = sdp_list_append(apseq, proto[2]); 384 385 aproto = sdp_list_append(NULL, apseq); 386 sdp_set_access_protos(record, aproto); 387 388 sdp_list_free(proto[0], NULL); 389 sdp_list_free(proto[1], NULL); 390 sdp_list_free(proto[2], NULL); 391 sdp_list_free(apseq, NULL); 392 sdp_list_free(aproto, NULL); 393 sdp_data_free(v); 394 395 /* Service Class ID List: */ 396 sdp_uuid16_create(&obexftp, service); 397 svclass = sdp_list_append(NULL, &obexftp); 398 sdp_set_service_classes(record, svclass); 399 400 /* Profile Descriptor List: */ 401 /* profile id matches service id here */ 402 sdp_uuid16_create(&profile.uuid, service); 403 profile.version = 0x0100; 404 pfseq = sdp_list_append(NULL, &profile); 405 sdp_set_profile_descs(record, pfseq); 406 sdp_set_info_attr(record, "OBEX File Transfer", NULL, NULL); 407 408 status = sdp_device_record_register(session, BDADDR_ANY, record, SDP_RECORD_PERSIST); 409 if (status < 0) { 410 DEBUG(1, "SDP registration failed."); 411 sdp_record_free(record); record = NULL; 412 sdp_close(session); 413 return -1; 414 } 415 416 sdp_close(session); 417 return 0; 418 } 419 207 420 208 421 #else 209 #warning "no bluetooth scan available" 210 #include "client.h" 211 char **obexftp_discover_bt_src(const char *UNUSED(src)) 212 { 213 return NULL; 214 } 215 int obexftp_browse_bt_src(const char *UNUSED(src), const char *UNUSED(addr), int UNUSED(svclass)) 216 { 217 return -1; 422 #warning "no bluetooth support for this platform" 423 424 char **btkit_discover(const char *UNUSED(src)) 425 { 426 return NULL; 427 } 428 char *btkit_getname(const char *UNUSED(src), const char *UNUSED(addr)) 429 { 430 return NULL; 431 } 432 int btkit_browse(const char *UNUSED(src), const char *UNUSED(addr), int UNUSED(svclass)) 433 { 434 return -1; 435 } 436 437 int btkit_register_obex(int UNUSED(svclass), int UNUSED(channel)) 438 { 439 DEBUG(1, "SDP not supported."); 440 return -1; 441 } 442 443 int btkit_unregister_service(int UNUSED(svclass)) 444 { 218 445 } 219 446 … … 221 448 222 449 #else 223 #warning "no bluetooth discovery available" 224 #include "client.h" 225 char **obexftp_discover_bt_src(const char *src) 226 { 227 return NULL; 228 } 229 int obexftp_browse_bt_src(const char *UNUSED(src), const char *UNUSED(addr), int UNUSED(svclass)) 230 { 231 return -1; 232 } 233 450 #warning "bluetooth not available" 234 451 #endif /* HAVE_BLUETOOTH */ -
trunk/obexftp/client.c
r191 r193 40 40 41 41 #ifdef _WIN32 42 #include <winsock2.h>43 #define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT44 42 #define O_BINARY (_O_BINARY) 45 43 #define CREATE_MODE_FILE (S_IRUSR|S_IWUSR) … … 53 51 54 52 #ifdef HAVE_BLUETOOTH 55 #ifdef _WIN32 56 #include <ws2bth.h> 57 #define bdaddr_t BTH_ADDR 58 #define BDADDR_ANY (&(BTH_ADDR) {BTH_ADDR_NULL}) 59 #define bacpy(dst,src) memcpy((dst),(src),sizeof(BTH_ADDR)) 60 #else /* _WIN32 */ 61 62 #ifdef __FreeBSD__ 63 #include <sys/types.h> 64 #include <bluetooth.h> 65 #define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}}) 66 67 #else /* Linux */ 68 #include <bluetooth/bluetooth.h> 69 #include <bluetooth/rfcomm.h> 70 #include <bluetooth/hci.h> 71 #include <bluetooth/hci_lib.h> 72 #endif /* __FreeBSD__ */ 73 74 #endif /* _WIN32 */ 53 #include "bt_kit.h" 75 54 #endif /* HAVE_BLUETOOTH */ 76 55 … … 95 74 } apparam_t; 96 75 #pragma pack() 97 98 99 #ifdef _WIN32100 #ifdef HAVE_BLUETOOTH101 static int str2ba(const char *straddr, BTH_ADDR *btaddr)102 {103 int i;104 unsigned int aaddr[6];105 BTH_ADDR tmpaddr = 0;106 107 if (sscanf(straddr, "%02x:%02x:%02x:%02x:%02x:%02x",108 &aaddr[0], &aaddr[1], &aaddr[2], &aaddr[3], &aaddr[4], &aaddr[5]) != 6)109 return 1;110 *btaddr = 0;111 for (i = 0; i < 6; i++) {112 tmpaddr = (BTH_ADDR) (aaddr[i] & 0xff);113 *btaddr = ((*btaddr) << 8) + tmpaddr;114 }115 return 0;116 }117 #endif118 #endif119 76 120 77 … … 1240 1197 1241 1198 1199 char **obexftp_discover_bt_src(const char *src) 1200 { 1201 #ifdef HAVE_BLUETOOTH 1202 return btkit_discover(src); 1203 #else 1204 return NULL; 1205 #endif HAVE_BLUETOOTH 1206 } 1207 1208 1209 char *obexftp_bt_name_src(const char *addr, const char *src) 1210 { 1211 #ifdef HAVE_BLUETOOTH 1212 return btkit_getname(src, addr); 1213 #else 1214 return NULL; 1215 #endif HAVE_BLUETOOTH 1216 } 1217 1218 1219 int obexftp_browse_bt_src(const char *src, const char *addr, int svclass) 1220 { 1221 #ifdef HAVE_BLUETOOTH 1222 return btkit_browse(src, addr, svclass); 1223 #else 1224 return 0; 1225 #endif HAVE_BLUETOOTH 1226 } 1227 1228 1242 1229 /** 1243 1230 Device discovery wrapper for a named transport. -
trunk/obexftp/client.h
r186 r193 129 129 obexftp_discover_bt_src(NULL) 130 130 131 char *obexftp_bt_name_src(const char *addr, const char *src); 132 #define obexftp_bt_name(addr) \ 133 obexftp_bt_name_src(addr, NULL) 134 131 135 int obexftp_browse_bt_src(const char *src, const char *addr, int svclass); 132 136 #define obexftp_browse_bt(device, service) \
