Serial Connection to Bluesmirf Bluetooth Dongle - Android Software Development

Hi, I'm working on an app which needs to send serial output to a bluesmirf bluetooth dongle connected to a Smartfusion eval board.
So far I have been trying to make the connection in the same way done through the BluetoothChat example app, but have had no luck. It appears that this is in some way related to a failure from the fact that the bluesmirf doesn't have the same UUID. This is the Logcat message I get right before it the connection attempt stops:
04-12 03:28:32.670: DEBUG/BluetoothService(92): Cleaning up failed UUID channel lookup: 00:06:66:04:AA:EA 8ce255c0-200a-11e0-ac64-0800200c9a66
I've been Googling any and every combination of "bluesmirf," "android," and "bluetooth" but can't find any sort of guide or help for having an app connect to anything but the same app on another phone.
Any sort of insight would be greatly appreciated.

Found Solution
Ok so following links through stackoverflow lead me to an answer that was obnoxiously simple.
If anyone else ever finds this thread for the same issue:
There is a set UUID for serial devices, and you just need to set your apps UUID to this value:
00001101-0000-1000-8000-00805F9B34FB

Related

Cannot oper/register serial port for Bluetooth

I'm developing, for XDAII and in eVC4/Win32, an application that opens a serial port for incoming Bluetooth. The Bluetooth Manager sets COM4 as active port number, but my call:
CreateFile(TEXT("COM4:"),GENERIC_READ | GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);
fails with error message "The specified network resource or device is no longer available".
When I then try to call:
RegisterDevice(TEXT("COM"),4,TEXT("ASIC5_BTUR.Dll"),0))
also this call fails.
What am I doing wrong ? When I look in the Register [HKEY_LOCAL_MACHINE\Drivers\Active] I find no COM4 active so there is no obvious reason why this call should not work. Have the BTHTools1100 patch installed !
Hello, I am experiencing similiar problems. Have you resolved yours ? If yes, could you show me how you open your ports etc.?
read this :
http://forum.xda-developers.com/viewtopic.php?t=1263&highlight=
I am not sure how your link to COM1 prolems regaqrding signals sould help me. My problems are with opening Bluetooth SPP ports, those that show up as the Inbound and Outbound COM ports.Though I would think that both are active, üsing CreateFile() I can open only the Incoming one (COM4) while I receive an INVALID_HANDLE_VALUE for the other one (COM5).
I just saw some info on com ports being inactive as well as a test program so I thought I'd mention it. Didn't mean to provide a solution, sorry
I tried to get the Bluetooth working and also had trouble. I think the inbound and outbound comm ports is to do with if you are using your SPP device as a client or server. It is not as a lot of people think that TX and RX data are on different Comm ports.
I cound not get Bluetooth working at all using my original XDAII rom of 1.60. I downloaded Pocket Bluetooth Tools http://www.bluetooth.jazztel.es/ and then it worked easy on Comm7.
I recently upgraded my XDAII Rom to 1.72 and I tried the Bluetooth support again. This time the XDAII even said I am connecting to a serial SPP device and automatically allocated the Comm port. But I must say my program could still not transfer data correctly using it. It all got stuck in some initilisation sequence. Now that may of been my software so I don't want to blame the XDAII.
All I know is I installed Pocket Bluetooth tools again onto my 1.72 XDAII and all worked fine again on Comm7.
A friend of mine has a new XDAIIs and the inbuilt bluetooth support on that worked 100% first time, no need for the Pocket Bluetooth Tools on that. So I think the problem is with the XDAII and it's built in SPP support.
Had the same problem, resolved it:
Strange but true, but on XDA2 etc, in order to receive COM Bluetooth, you have to open the outgoing port as shown in the Systems Bluetooth settings (You have to tick it there, too, of course), not the incoming.
Then, as it is blocking, you have to create a thread that listens on the port.
You cannot use RegisterDevice for a port number (in your case COM4)that is already used and open.
Phil
OOPS.... and you have to call OpenFile(), not CreateFile() !!!!!!!!!!!

Restarting Bluetooth programmatically?

I'm having a problem where my phone's (XPERIA X1i) A2DP connection doesn't properly reconnect to my car's receiver most of the time. I've found that if I go into the Bluetooth settings, uncheck "Wireless Stereo" on the appropriate device, save, then recheck it, and save again, everything works well. Obviously, this is a lot of trouble, so I'd like to automate it.
I've found where the enable bits are in the registry, but I can't tell how to do the equivalent of the "save" button in the settings. I'm happy to write my own program to do this if someone can point me to the right API call. Thanks!
- Scott
PS: Although I've found A2DPToggle to be a help elsewhere, it doesn't solve my problem of reconnecting the device.

how to detect a bluetooth connection

hello,
i search a solution to detect a bluetooth connection, device is equal.
all what i found is getBondedDevices() from BluetoothAdapter, but pairing this is not a connection...
thanks 4 help
Solved!
i use ACTION_ACL_CONNECTED and ACTION_ACL_DICONNECTED from class BluetoothDevice.
Code:
getApplicationContext().registerReceiver(receiver,
new IntentFilter(BluetoothDevice.ACTION_ACL_CONNECTED));
getApplicationContext().registerReceiver(receiver,
new IntentFilter(BluetoothDevice.ACTION_ACL_DISCONNECTED));
Android-Wireless
Helo Sir,
How to switch On Bluetooth and Wireless programatically? Even i can't switch on bluetooth and wireless manually in android.
Emulator shows error.
dineshsubramanian said:
Helo Sir,
How to switch On Bluetooth and Wireless programatically? Even i can't switch on bluetooth and wireless manually in android.
Emulator shows error.
Click to expand...
Click to collapse
Emulator actualy dosn't support Bluetooth, WLan and GPS!
CodeFlatter said:
i use ACTION_ACL_CONNECTED and ACTION_ACL_DICONNECTED from class BluetoothDevice.
Code:
getApplicationContext().registerReceiver(receiver,
new IntentFilter(BluetoothDevice.ACTION_ACL_CONNECTED));
getApplicationContext().registerReceiver(receiver,
new IntentFilter(BluetoothDevice.ACTION_ACL_DISCONNECTED));
Click to expand...
Click to collapse
This only works if the device isn't yet connected. If the device is ALREADY connected when your app starts, how do you detect that, without starting a discovery?
been searching for a few days for an answer to this. Anyone got one?
Thanks
Scott
No one has any ideas on this? A month of searching has so far proven futile, but I can't believe it's not possible...
On the Google android developers site there is a complete example (a bluetooth chat).
http://developer.android.com/intl/de/resources
Hi!
I'm trying to connect my phone (HTC desire running Opendesire last update or HTC stock 2.2) to a serial to bluetooth converter module.
It seems to me that BluetoothChat sample is a good point to start as this application sends bytes over bluetooth.
That's just what i want to do: send some bytes from phone, receive some bytes from the module
I tried to run the Bluetoothchat sample on my phone:
Discovering and pairing the module is ok, but I'm unable to open a connection.
Anyone ever tried (and get success) to do same things as me?
Thank you.
Delvorak said:
This only works if the device isn't yet connected. If the device is ALREADY connected when your app starts, how do you detect that, without starting a discovery?
been searching for a few days for an answer to this. Anyone got one?
Thanks
Scott
Click to expand...
Click to collapse
Take a look at my SpeakerProximity Project => http://code.google.com/p/speakerproximity/
I faced the same problem and the solution that fitted the best was using BT connect/disconnect receivers that always get triggered and update a shared preference.
Hi,
I'm still having some issue with the bluetoothchat sample from sdk and bluetooth to serial converter module.
Now it works fine with AOSP rom but i'm still unable to make connection with HTC stock rom.
I've tried with a friend to run the application on a galaxy spica and we had the same issue. First the application didn't even start on spica and we had to change permissions to avoid Force Close.
Somebody knows what's wrong with bluetooth and HTC or Samsung?
Thank you
detecting bluetooth STATE_ON
in your OnStart() use :
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (mBluetoothAdapter != null) //if null device does not support bluetooth
{
if (mBluetoothAdapter.getState()==BluetoothAdapter.STATE_ON) {
//do stuff
}
}
I use a bluetooth listener for the STATUS_CHANGED event to check if BT is switched on.
If so, i enable my scanning avtivities, else i disable them.
Greetz,
Mike
STATE_ON is not the same as connected, though. (I think).
Personally, I've be having trouble figuring out the disconnect event to listen for, but I think the ACL one is what I need. Will try to remember to post back if I get it working. Damn WiFi process always interupts my transfers epecially when email decides it's time to sync.
Anyways, one tip for those having trouble with the BluetoothChat example is that for some reason you dont want to be listening for a connection at the same time as trying to make one. If you try the BluetoothChat example it actually almost always fails to connect. But if you make sure only one device is using listenforRfcomm... and the other is connecting, you'll connect fine.
The Spica thing is some bug with that phone specifically, though I think some people have solved it with some type of strange method reflection. Check stackoverflow for spica/bluetooth.
Just an update for my problem the ACL braodcasts were just what I was looking for though the diconnect broadcast is sometimes very slow to trigger.

Android GPS module

Hi,
I am student from the Ruhr-university of Bochum, Germany, and I am working on my master thesis which is dealing with anti spoofing techniques for GPS. I already recognized, that I need to modify the Android GPS subsystem in order to be able to go on with my work as planned. So, I need more information about the GPS modules in the android devices (better: detailed information about one particular module). My aim is to get more GPS properties from the module than currently is given to the Android OS. In fact, I need to get information about the gps signals, like phase, signal strength, etc.
Can anybody help me with this? Where can I find information about any GPS module or is there any known project or hack which is able to get the signal properties?
best regards,
Tordred
I Think you are looking for this:
http://developer.android.com/guide/topics/location/strategies.html
http://developer.android.com/reference/android/location/LocationManager.html
http://developer.android.com/reference/android/location/GpsStatus.html
http://developer.android.com/reference/android/location/GpsSatellite.html
No, sorry. I am not looking for location related stuff. It is not the location I am interested in, it is the GPS signal itself. And this stuff is not supported by the original android implementation.
You can only get as much info as the GPS module is putting out.
The two protocols are NMEA-0183 and SiRF Binary protocol (if applicable).
Renate NST said:
You can only get as much info as the GPS module is putting out.
The two protocols are NMEA-0183 and SiRF Binary protocol (if applicable).
Click to expand...
Click to collapse
Thanks for your answer, I just took a deeper look on the SiRF protocol and it seems to be possible to get the data I need with this protocol. I saw that the Galaxy S2 has built in the SiRFStar IV chip. Does anybody know something about this chip? Is it a "uncut" chip in the Galaxy S2 and is it perhaps possible to "talk" to it using the protocol?
I don't do much with SiRF Binary; on a PC I use it to select the WAAS satellite.
Give it a try, just switch out of NMEA-0183 using the $PSRF100,0 message.
Renate NST said:
I don't do much with SiRF Binary; on a PC I use it to select the WAAS satellite.
Give it a try, just switch out of NMEA-0183 using the $PSRF100,0 message.
Click to expand...
Click to collapse
Now I have a Galaxy Nexus, which has also built in the sirfstarIV gps chip. I am trying to switch out of NMEA, but I am not very familiar with linux ans serial ports. I am trying to send the switch message via terminal to the gps chip, but it seems not be successful.
I already know, that the serial port is the ttyO0, as mentioned in the sirfgps.conf file. I tried to configure it with "setserial" and "stty" and I tried to send a message with "echo", but there is no response.
Can somebody explain to me how I use the serial port correctly?
First try to get the NMEA-0183 working.
The default spec baud is 4800.
You should be able to connect to the GPS chip and without issuing any commands receive NMEA sentences.
Hmm. For built-in chips you have to probably power it up somehow.
It seems the ttyO0 is not the serial port of the gps chip but the serial port of the kernel... I am getting an output using the microcom command, but I can not read it. I tried several baud rates, but it is always unreadable.
Sound like a cool project, but we cannot help you unless you specify exactly what device/model you are using. Its a Nexus I9250 or SGS2 I9100 ??? Is it branded by some other operator etc? Sometimes the best thing is to open the damn thing and see what's inside. (But the Nexus has been in some tear-downs/take-aparts, google it!)
Also have a look at:
"Accessing uart on Galaxy Nexus i9250"
Then you'll need the Service Manual with the schematics to figure out how the GPS is wired. On the I9100 its wired to the modem (BP/CP) and on the I9250 its wired to both AP and to the MUX... (You've got some reading to do...)
But you should be able to find the correct port from dmesg, logcat and the various *.rc scripts...
I tried to get a i9100 because of the sirf gps chip, but I got a i9250 with the ICS 4.04 Stock Rom, which has the same chip built in. I rooted the device using the NexusTool and installed busybox on it.
I have already read several threads to get an orientation how to get access to the serial ports and how to deal with the gps chip:
- [MOD/SETTINGS TWEAK] SiRF GPS on SGS2
- [A][SGS2][Serial] How to talk to the Modem with AT commands
- Accessing uart on Galaxy Nexus i9250
- The all-in-one Galaxy S2 Hack Pack
In order to get an output(or some kind of action in the gps chip) I wrote an app, which is trying to get a gps fix in an background service. So my phone is always trying to get a fix. When I now look into the dmesg or logcat output, there is no hint on gps. I read about those .rc scripts, but i can not find them on my device.
In the /vendor/sirfgps.conf I found the lines ...
Code:
UART_DRIVER = /dev/ttyO0
UART_BAUD_RATE = 2
...where 2 stands for 460800 Baud. I tried to connect to this port using the command
Code:
microcom -s 460800 /dev/ttyO0
with a terminal emulator app, but the output was not readable. I tried several other baud rates, but it is always unreadable.
What do you mean with "...the output was not readable.."??
Do you get anything? Can you post it.
If you get "something", then, you're either:
- using the wrong UART port
- the wrong baudrate, parity, stop bit settings etc.
- receiving data in some unknown format, possibly encrypted.
Please, post (on Pastie) your dmesg output (as it appears) immediately after bootup. And possibly a full debug logcat using the "Logcat Extereme" App, when turning on and off GPS.
Also you should not use apps for trying to read this data, as your app runs in VM which doesn't have full root FS access, regardless of SU. You first try getting data from a terminal session either from phone side (adb) or from PC (Realterm etc.) side.
Is this true?
Hello, i'm new here.
I'm wondering is it true that my Galaxy young gps module are :
1. Broadcom BC2075 (AGPS support chip)
2. Broadcom BC4751 (GPS receiver)
i'm using ES file exprorer on my rooted system and find glconfig2075.xml and glconfig4751.xml. in /etc/gps/ system folder. Nothing found in my cheap prerooted with no gps support tablet.
If this is true then there is some relief that it is kinda easy to find what my gps are in situ, rather than look out in the cloud via google.
It's still hazy to me, why is it that the same hardware but a software change from 10 minutes up to 5 seconds to receive satellite. Anywhere.
Android GPS Module
Renate NST said:
I don't do much with SiRF Binary; on a PC I use it to select the WAAS satellite.
Give it a try, just switch out of NMEA-0183 using the $PSRF100,0 message.
Click to expand...
Click to collapse
Hello
My Android phone those not have a GPS module on it and i need to install and GPS TEST
is there any APP that can help or do i need to get another phone am using a Techno W2

LED Bluetooth connect

I've bought a bluetooth RGB led strip for my car on ebay, it comes with an app that connects to it.
The thing is the app is slow, buggy and lacks options.
I dev'd previously in lua and python and nothing else but I want to try and make my own app for the strip, the problem is that it never finds it even with inbuilt phone bluetooth or other BT apps.
I have no idea what it is built on so I looked for arduino BT control, didn't find the device.
Bluetooth reader (read data sent and received) and never found the device either.
But its app? Automatically pairs up with it.
I've decompiled and source and read through it, it uses UUID which I don't know anything about so it makes me thing this is the reason it never finds the strip.
This is what I believe handles all the BT process: http://pastebin.com/0zbKZF9d
Any input is appreciated.
Hello!
The device can be seen in the Bluetooth configuration of your cell phone?
The UUID is composed by long values (like 0x12345678,0x9ABCDEF) and it's used to define an application. To work, the server and the client must use the same UUID.
If you have the UUID value, then you can do a reverse engineering to understand who the app sends the commands to the leds strip.
You can create a server Bluetooth simulating the led strip (using the same UUID) and connect the app to it.
I hope this will help

Categories

Resources