I'm currently doing some testing with bluetooth to communicate between android and raspberry pi. In Android, I am using BlueTerm app as my terminal.
With the help of this video (https://www.youtube.com/watch?v=GSMThZINNsc), this are the exact functions i need:
Basically what the 3 commands does above is to:
Code: Select all
sudo rfcomm listen hci0& echo "heyyyy" > /dev/rfcomm0 cat /dev/rfcomm0
1) Listen and accept connection
2) Send message ("heyyy") to display on android via bluetooth
3) Display message sent by android in RPi
However I'm met with several problems:
1) When I run and compile the server script, I am able to listen and accept connection. However, whenever I just typed 1 character in BlueTerm app, nothing appears on the BlueTerm console and RPi echos "received [x]" which is correct based on the code, however this is not how I wanted it to be:
I want it to be like just the linux command above, whereby when i am typing a character, it appears on BlueTerm console but NOT AT RPi unless I hit the enter/nextline button on android. I am not sure how to achieve this as no matter how I change the code it listens and prints every character i type instead of waiting for the newline/enter key, and nothing is displayed in BlueTerm console.
2) When I run and compile the client script, put the CHANNEL as 8 (this time round I use BT-Term app in android which opens a BluetoothInsecure channel 8), I am able to receive the message sent by RPi via the C code. However when I set the channel as 1 and using BlueTerm app, I am not able to receive the message with "Connection refused".
I'm not sure why my server script works when i specify channel 1 but my client script don't work when I'm using channel 1.Service Name: AV Remote Control Target
Service Name: Advanced Audio
Service Name: Headset Gateway
Service Name: Handsfree Gateway
Service Name: Sim Access Server
Service Name: Android Network Access Point
Service Name: Android Network User
Service Name: OBEX Phonebook Access Server
Service Name: SMS/MMS Message Access
Service Name: Email Message Access
Service Name: OBEX Object Push
Any guidance here would be appreciated. Thanks!!