linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Bluez-devel] How to send file using File Transfer Protocol
@ 2006-06-08  5:13 Gloria Saripah Patara
  2006-06-08  7:21 ` [Bluez-users] " Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Gloria Saripah Patara @ 2006-06-08  5:13 UTC (permalink / raw)
  To: bluez-users, bluez-devel

Hello, guys. I want to ask you about the way to send file using File
Transfer Protocol.
Here my code :

int main(){
	bdaddr_t src,dest;
	uint8_t channel = 0;
	int mode,od;
	unsigned char *buf;
	size_t len;


	bacpy(&src,BDADDR_ANY);
	str2ba("xx:xx:xx:xx:xx:xx",&dest); //xx is my bluetooth address

	if((!channel)&&(!sdp_get_ftp_channel(&src,&dest,&channel))){
		printf("Can't retrieve RFCOMM OBEX channel\n");
		exit(1);
	}

	if((od=obex_open(&src,&dest,channel))<0){
		perror("Can't establish OBEX connection\n");
		exit(1);
	}

	mode = OBEX_FILE_TRANSFER;
	obex_connect(od,mode);
	printf("connected\n");

        obex_setpath(od, "C:/", 0x03);
	cmd_put(od,"gongli.jpeg");

	obex_disconnect(od);
	printf("disconnected\n");
	obex_close(od);

	return 0;

}

i have compiled this source code and success. no error. to compile it,
i using : gcc -o main main.c -lopenobex -lbluetooth.
And then, i want test it by running it using : run-standalone.sh ./main
But, the file didn't reach the phone's memory. i mean, there's a
confirmation that a message is coming but the confirmation will
disappear immediately. i have checked the inbox or file manager
(phone's memory), but there's none. There something error on my code?.

NB : The function used in main function has declared.

-------------------------------------------
Thanks in advance


_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Bluez-users] [Bluez-devel] How to send file using File Transfer Protocol
  2006-06-08  5:13 [Bluez-devel] How to send file using File Transfer Protocol Gloria Saripah Patara
@ 2006-06-08  7:21 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2006-06-08  7:21 UTC (permalink / raw)
  To: BlueZ development; +Cc: bluez-users

Hi Gloria,

> I want to ask you about the way to send file using File
> Transfer Protocol.
> Here my code :
> 
> int main(){
> 	bdaddr_t src,dest;
> 	uint8_t channel = 0;
> 	int mode,od;
> 	unsigned char *buf;
> 	size_t len;
> 
> 
> 	bacpy(&src,BDADDR_ANY);
> 	str2ba("xx:xx:xx:xx:xx:xx",&dest); //xx is my bluetooth address
> 
> 	if((!channel)&&(!sdp_get_ftp_channel(&src,&dest,&channel))){
> 		printf("Can't retrieve RFCOMM OBEX channel\n");
> 		exit(1);
> 	}
> 
> 	if((od=obex_open(&src,&dest,channel))<0){
> 		perror("Can't establish OBEX connection\n");
> 		exit(1);
> 	}
> 
> 	mode = OBEX_FILE_TRANSFER;
> 	obex_connect(od,mode);
> 	printf("connected\n");
> 
>         obex_setpath(od, "C:/", 0x03);

using the FTP profile you are not using Windows alike paths. This is not
how it works and all paths are mapped under a root directory. So leave
this command out and try again.

> NB : The function used in main function has declared.

And your code has do be licensed under GPL.

Regards

Marcel




_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-06-08  7:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-08  5:13 [Bluez-devel] How to send file using File Transfer Protocol Gloria Saripah Patara
2006-06-08  7:21 ` [Bluez-users] " Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).