Need advice/help on what I might be doing wrong.
What I have:
Plugged in a HM-10 module to my Arduino.
-Factory Default settings except connection type:
--Using AT+TYPE3 (3:Auth and bond ).
Android LG G4, running Android 6 (Marshmallow) .
Issue:
Bluetooth HM-10 is visible to connect to in Android when searching for Bluetooth devices but when using the default pairing code "000000" "Wrong PIN or passkey. Try again?" message keeps coming up.
What I tested:
Windows 10 laptop bonds with the HM-10 device. (Verified MAC address by running AT+RADD? )
AT+TYPE0 (0:Not need PIN Code ) connects via BLE Scanner app.
Asked three different people with different Android phones for help:
-Newest Samsung phone: Bonds
-Older Samsung phone: Bonds
-OnePlus One phone: Does NOT bond
Hypothesis
Bluetooth library on the devices that cant connect might be lacking handshake protocol when talking to the HM-10 module.
I'm newer of these module HM-10,HM-16, and I meet same problem too.
Finally I found install APP "msmble" in android app store can solve this problem and do some simple test, like send word.
I guess protocol or UUID is the reason, but I don't know the detail.
There's another issue, no matter how I change the PIN setting. msmble always no need to enter PIN code.
Yu-Sheng
Related
I am facing the folowing problems when trying to pair my Androids BluetoothGattServer and BluetoothLeAdvertiser with Windows 10. My BluetothGattCharacteristics are protected with
PERMISSION_READ_ENCRYPTED_MITM / PERMISSION_WRITE_ENCRYPTED_MITM.
1) When pairing windows, the I have to insert a constant pin "000000". That seams very unsecure compared to the passkey variant that is used pairing the same device with Bluetooth Classic.
2) Android 5 introduced rotating MAC addresses. Windows fails to reconnect to the paired device somehow.
Any ideas? Thanks in advance.
EDIT
Bluetooth Manager is showing "Driver Error" and the Device Manager reports "Windows has stopped this device because it has reported problems. (Code 43)" on this device.
Just reported this Problem to Microsoft and Android.
https://answers.microsoft.com/en-us/windows/forum/windows_10-hardware/ble-pairing-with-android-and-windows-10-unsecure/df711d25-1c3e-4c7a-94f5-e5e6b8bc7a6f
https://code.google.com/p/android/issues/detail?id=250334
Lets see, if it might get solved...
I've written an app that scans for bluetooth smart devices, you can pick one from a list, connect to it and exchange some data. All went fine until Android 6.0.
First, i fixed the new permission system so the app requests the location permission at runtime to be able to scan for devices. With that the app worked like it used to, but after turning bluetooth off and back on again the app won't connect anymore but always returns disconnected state with status code 133 in the gatt callback.
I then tried several things:
rebooted the device
re-installed the app
turn off wifi, enable / disable flight mode
checked with NRF master control panel, same issue with same statuscode
This all didn't solve the problem. The only way i was able to get it working again was the option "Network Settings Reset" from the menu "Backup & reset". Both development phones available here (Moto G3 and Samsung S6) feature this option, haven't seen it before Android 6.0.
My question is: are there others experiencing this problem and is there a fix or workaround for this? This could cause a lot of troubles, it so common to turn off /on bluetooth and the problem also appears after been in flight-mode.
Ok, so after a while i tackled this. I was working with NRF ble devices and could not connect but i was still able to connect to TI sensorTag devices.
There were some differences between the advertisements of the devices, some flags were not enabled for the NRF device and also the NRF device had no device name set. After changing this, i was able to connect again. Turned out that devicename must be enabled but can be left empty.
It seems in the Android 6.0 ble stack there is a change in how the connection to a device is made, the device is not connectable anymore if not the right advertisement settings are used after bluetooth is turned off and on again.
Remember Bluetooth has 4 states, ensure to check when it's already ON and not TURNING_ON:
if (intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -1) == BluetoothAdapter.STATE_ON) {
...
}
Else you can't connect yet to the gatt server...
I'm trying to figure out how to connect two Android powered devices,
namely a smartphone (Android 4.1.2) and an android developer
board (Android 4.0.4) with apps running on each, via USB and get them
to communicate with each other.
Right now the developer board is running as the host and the phone as
an accessory. The hosts app is searching for connected devices and is
able to identify the phone as a device, but the app running on the
phone isn't able to find the host.
I've searched the web for quite a while now (!!) but I didn't come
up with anything helpful yet that solved my problem.
For my project it is crucial that I use an USB connection, so please
don't propose that I use bluetooth, WiFi, or anything else...
Regards
USB is host initiated, so it's not surprising that this is not working. Your device that is functioning as the USB device should respond to requests initiated from the USB host. You will probably have to create some sort of vendor specific protocol around this. I don't know what you are trying to do with this connection, but if the device needs to know things on the host you will need to bake this in to your protocol definition and send that information directly to the device.
What you could try doing is using both devices as a host and connecting a USB to UART bridge device between them, then you can transmit data generically in any direction by using the serial connection (through USBManager if the USB protocol is available, or some Android Java Serial class if it is not), plus you don't have to worry about the host-device connection. This would look something like this:
[Android 4.1.2 Device]<--USB Connection-->[USB to UART Bridge]<--Serial Connection-->[USB to UART Bridge]<--USB Connection-->[Android 4.0.4 Device].
Use OTG Cable to interact with your board and phone. Its easily available in the market.
I'm working on an Android application and I have to make a Bluetooth serial communication between an Android device and a Computer with Ubuntu OS. I don't know what to do and how to connect them. I'm looking for good references and someone who can help me.
I made a button which navigates to the Bluetooth settings of our Android device. I don't know what else I should do.
Pair the devices. This has nothing to do with any software, so it has to be done via the phone settings
Once paired, look at 'Bluetooth Chat' example by Google. It has drop in code for connecting two devices. A serial connection is done via Serial Port Profile that is established over RFCOMM. The UUID for SPP is well known, again, you'll find it in the Bluetooth Chat example.
I a trying to connect my Nexus One with Android version 2.2.1 with my pc and use a terminal program such as windows terminal or hyper terminal to communicate. To do this I believe I need to set up an outgoing serial com port. I have paired the devices. When I go on my PC to Bluetooth -> settings -> "add com port" the android device does not display.
What am I missing?
Does android 2.2.1 support spp? The documentation says it does.
Do I need to root the android to add spp?
Has anyone succeeded in this?
My final goal is to write an android app that communicates with an old school bluetooth device that requires com ports? Getting the android to communicate with the pc is an interim step.
I have tried everything I can think of in my android app to connect to my pc and android device but have not been successful. My android app is essentially the same as Serial over Bluetooth submitted by xCaffeniated but with fewer comments. Any suggestions?
Try beginning with the BluetoothChat sample application. You will then have to alter the UUID used to the generic SPP UUID,
00001101-0000-1000-8000-00805F9B34FB
From this point you pretty much have everything you need.
I have had issues pairing in the BluetoothChat program. So I was required to pair to my computer using the settings menu and then entering the BluetoothChat Program. In BTChat go to the menu and hit connect to a device, choose your computer. I can only speak for windows XP SP3 which is what I'm using. At this point on my machine I receive a task bar pop up asking me if I would like to allow my device to connect as a serial port. I allow it to. Now your phone is associated as the serial port profile on the computer, which you can associate with a specific com port.
Based on bluetooth spec,
http://www.bluetooth.com/SiteCollectionDocuments/SPP_SPEC_V12.pdf,
2.3 User Requirement, "... Any legacy application may be run on either device, using the virtual serial port as if there were a real serial cable connecting the two devices (with RS232 control signalling)." In 4.3 Remote Port Negotiation, "...There is a requirement to do so if the API to the RFCOMM adaptation layer exposes to those settings (e.g. baud rate, parity)... RFCOMM as such will not artificially limit the throughput based on baud rate settings,..."
In my opinion, since Android (2.2) offers no APIs to set up and open a serial port, they may not be necessary as long as you can discover the remote BT device and make a connection to it. I have tried it and it seems working with:
...
sock = device.createRfcommSocketToServiceRecord(myUUID);
sock.connect();
...
where final UUID myUUID= UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"); You may need to take care of Bluetooth Permission and Setup in your application as described in
http://developer.android.com/guide/topics/wireless/bluetooth.html
There might be some issues with the connect() call, i.e. Service is not available or connect is refused, which could be resolved by making sure:
The remote BT device be discovered, and
It must be set to use PIN code (for instance 0000), and
It must be paired successfully with your Android device
These steps must be completed prior to running your application (which has connect call).
Hope this help.
George
There is definitely some funny business regarding how the AT set is implemented on the AOS. The problem is that it is hard to know if you're actually talking directly to Modem or through several abstraction layers (more likely). For a best up-to-date review of the AT Commands available on the AOS platform, plus HW, please see the post:
"How to talk to the Modem with AT commands"
http://forum.xda-developers.com/showthread.php?t=1471241