Quantcast

Sending Image using Bluetooth

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Sending Image using Bluetooth

e.sansone
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sending Image using Bluetooth

bhamadicharef
You can inspire yourself from bt-test.c at
http://code.google.com/p/smartcam/source/browse/trunk/src/bt-test/ 

Best regards

Brahim

j
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sending Image using Bluetooth

j
In reply to this post by e.sansone
On 06/01/2012 01:57 AM, e.sansone wrote:

> Hi,
>
> I'm trying to send an image to a Bluetooth device using bluez library.
>
> I selected the proper MAC address (of a PC) and i chose the correct channel
> (the channel number of the PC is 4 and it's dedicated to OBEX File Transfer
> Service) for communicating.
>
> The problem is that i see that I send the data, but I don't receive anything
> on the device (on the PC); The PC doesn't save the file and it doesn't ask
> to me where to save the file.
>
> Here there is my code:
>
> **************************************************************************
>     struct sockaddr_rc addr = { 0 };
>      int s, status;
>      char dest[18] = "00:1A:6B:78:0A:5F";
>
>      // allocate a socket
>      s = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
>
>      // set the connection parameters (who to connect to)
>      addr.rc_family = AF_BLUETOOTH;
>      addr.rc_channel = (uint8_t) 4;
>      str2ba( dest,&addr.rc_bdaddr );
>
>      // connect to server
>      status = connect(s, (struct sockaddr *)&addr, sizeof(addr));
>
>    //  printf("%d", sizeof(void*));
>
>      FILE *file;
>      char *file_data;
>
>      // send the file
>      if( status == 0 ) {
>
>        file = fopen("/home/gumstix/Scrivania/CSC_0213.JPG", "rb");
>
> fseek(file, 0L, SEEK_END);
> int sz = ftell(file);
>
>        //Allocate memory
>        file_data=(char *)malloc(sz);
>
>        //Read file contents into buffer
>        fread(file_data, sz, 1, file);
>        fclose(file);
>
>        int sent = send(s, file_data, sz , 0);
> printf("%d\n", sent);
>      }
>
>      if( status<  0 ) perror("uh oh");
>
>      close(s);
>      free(file_data);
> *****************************************************************
>
> Thanks,
>
> Emanuele Sansone
>
> --
> View this message in context: http://gumstix.8.n6.nabble.com/Sending-Image-using-Bluetooth-tp4964493.html
> Sent from the Gumstix mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> gumstix-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gumstix-users
Have you tried manually sending the file from the command line and not
through the program? Are you sure you have everything you need on the
gumstix? Is there a pin required to connect to the machine you're trying
to send the file to? How are you seeing it is transfered, the light
blinking? Have you tried sending one from the receiving machine to the
gumstix? I would first get it sorted out properly manually from the CL
as that may show what is messing up in the program.

If there is a pin code you could do this to set it for the MAC of the device
/var/lib/bluetooth/MacOfDeviceSendingTo/pincodes then put the MAC and
pincode in that file
00:00:00:00:00:00 1234
That way you do not have to do it each time.
Make sure that PAND is enabled in */default/bluetooth

Also if I remember correctly if you are root on the overo if rfcomm0 is
not in /etc/securetty add it in there.

If I can remember more of what I did or find my notes I will post more
in case it is of help.

HTH some

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sending Image using Bluetooth

e.sansone
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sending Image using Bluetooth

bhamadicharef
Hi

Which BlueTooth specification document mentions ths split
into 3 parts of the data image ? Cannot find any detailed
explanations of this ...

Brahim
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sending Image using Bluetooth

e.sansone
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sending Image using Bluetooth

bhamadicharef
Emanuele,

I am trying to compile your code and it goes well. However I cannot seem to
send image to an iPAD2 or Samsung GT-S5570 or HTC One ...

I get into the  ...
                        else{
                                //To develop
                                printf("Device uses OBEX protocol without connection!\n");

What devices have you used ? any clues ?

Brahim
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sending Image using Bluetooth

e.sansone
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

R: Sending Image using Bluetooth

e.sansone
In reply to this post by e.sansone
CONTENTS DELETED
The author has deleted this message.
Loading...