4

Is it possible to connect a windows phone application created in C# (or any other language) to raspberry pi through Bluetooth?

I know that C# has Bluetooth library, thus you can make Bluetooth connection using C#, But I have never actually seen a Windows phone application connecting to Raspberry pi through Bluetooth.

  • You can try doing a server client in C# and run it on Mono on the Pi. Problem is that you have to compile Mono for best results..and it takes hours. :( But works well! Windows Universal Apps coming to Pi soon! – Piotr Kula Mar 1 '15 at 22:02
3

I don't know anything about programming Windows Phones : but here's a bit of a "poor man's" Bluetooth experiment to try:

I'm assuming the Pi's Bluetooth adapter is up and running here and has previously been paired with your phone.

Install 'obexpushd':

$ sudo apt-get install obexpushd

Now check your adapter has a Bluetooth Address - and make a note of the device name (probably hci0):

$ hcitool dev
Devices:
    hci0: xx:xx:xx:xx:xx:xx

$ mkdir bluetooth
$ cd bluetooth
$ obexpushd -d -n -B hci0

Now send a 'note' or 'contact' (or other files, including images in fact) from your phone to the Pi - obexpushd should respond with some messages like:

[...]
0.1: got 3 bytes of streamed data
0.1: Sending response code 0
0.1: OBEX_EV_STREAMAVAIL, OBEX_CMD_CONNECT
0.1: got 0 bytes of streamed data
0.1: Sending response code 0
0.1: OBEX_EV_REQ, OBEX_CMD_PUT
0.1: Sending response code 0
0.1: OBEX_EV_REQDONE, OBEX_CMD_PUT
0.1: OBEX_EV_REQHINT, OBEX_CMD_DISCONNECT
0.1: Sending response code 0
0.1: Sending response code 0
0.1: OBEX_EV_REQ, OBEX_CMD_DISCONNECT
0.1: OBEX_EV_REQDONE, OBEX_CMD_DISCONNECT

You can then kill (ctrl-c) obexpushd. There should be a text (or whatever type you sent) file in the directory with the content.

You can call obexpushd with the '-s' flag - which hands control over to a script to do whatever you want with it.

To go the other way - you can use 'obexftp' like this:

/usr/bin/obexftp --nopath --noconn --uuid none --bluetooth $DEVICE --channel 9 -p $FILE

(Where $DEVICE is the BT address of your phone [which you 'hcitool scan' for], and $FILE is just a filename).

http://manpages.ubuntu.com/manpages/natty/man1/obexpushd.1.html

| improve this answer | |
  • okay thanks, i ordered raspberry pi 2 and should be here in 2 weeks, i'll let you know if it works then – Lynob Mar 1 '15 at 12:04
  • Hope you have success - you will need to purchase a Bluetooth adapter for the pi of course - the cheap (~£3) ones will do but are a pain to pair I have found (legacy pairing only) , the more expensive newer ones (I have a Belkin) are easier to pair, but this is a whole other topic ! – monojohnny Mar 1 '15 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.