I'm trying to demo android side service (content provider in ANCS lingo), that communicates with embedded device that supports Apple Notification Service (ANCS) notification consumer. Reason for this is, that the embedded device only supports ANCS. As the ANCS BLE side things are publiced by Apple, this should be possible and I've already added that service + associated characterics to android side gatt server. Embedded device is nordic nRF52 and SW is nordic ANCS demo. Demo works OK with iPhone and apparently with the desktop version of nRF control panel (if added with nordic supplied config and if you have windows machine, which I don't).
However I cannot seem to be able to bond the device with android, that's required before connection. The advertisement is in limited discovery mode (before bonding) so I cannot find it via regular scanning from settings. Also bonding from java code doesn't work. With mBluetoothDevice.createBond() I get ACTION_BOND_STATE_CHANGED callback with state 10 (BluetoothDevice.BOND_NONE) with old state 11(BluetoothDevice.BOND_BONDING). Apparently I would need to exchange keys here, but no idea how to do that.
Also dunno if anyone has done this same exercise before, but any other tips would also be appreciated! Thanks!
Problem was that the phone BLE stack was corrupted or in some invalid state. REboot and removing battery solved the issue with the bonding.
Related
Since many libraries are meant to be used with TCP/IP, I was wondering if it is possible to activate TCP/IP and therefore TCP/UDP for Bluetooth connections. I found some information already like that it is called Bluetooth PAN and piconet.
Furthermore, I noticed that my Android device created a network interface with an IP upon a connection with an iPhone (after I paired it and hit connect). Nevertheless, it appears that interface cannot be used right away. I don't have the option to root these devices so it needs to be activated programmatically somehow.
Any hints? Is it actually possible?
Thanks.
I need to estabilish a brief communication between a BLE master and a BLE peripherical device.
Until I have to use the mobile phone I have no problems, since I select the bluetooth device from Android, I can connect to it and then I can receive data simply writing them to HM-10.
BUT, this approach is battery expensive, since the BLE scanning is more battery expensive than the BLE advertising (right?). So I want that the mobile becames an advertisor and the HM-10 takes the ROLE of Slave.
BUT, I still don't understand if it is possible to connect to other devices: I tried AT+CONN and it always fails (AT+CONF). Is there any way to send brief data from the HM-10 to the advertisor, even without connecting?
Even my firmware looks slightly different from the readme! For example,AT+LN is present in the documentation but it appears to not exist. Does a better version of the firmware for this device exist, or, are sources available somewhere? I installed the HM-Soft V705 (lastest).
Thanks
UPDATE 1:
#ChrisStratton Ok, I have some intresting news: I was already following your idea (phone advertise sometimes, while HM-10 always scan and tries to connect to the service if it sees it, then HM-10 send some data, phone answer). I managed to make the phone visible from HM-10 (don't ask me how!). I am using the BLE Tool Android app to test everything. Now, the central problem now is that HM-10 won't connect to the android service even if the advertisor is connectable (see attached images).
I am sospicious that the AT+CO (that I discovered is a kind a replacement of AT+LN, but I am not sure) can help, but i don't know how.
I'm working with ANCS compatible android BLE app. The ANCS content consumer is nRF52-based thingie that listens for ANCS notifications and (should) also be able to adjust phone volume.
I've got the ANCS as solicitated UUID in the advertisement package and the HID device UUID in the advertisement response package.
All is well with iOS. All works and no problems. However with android the ANCS part of my system works ok, but I cannot get the volume part working. After bonding the android shows the device as input device and it's also selected for input. If I try to send volume up/down key, I get no indication from the android side.
My assumption was that I do not need to connect to nrf board as periperal (bluetoothdevice.connectGatt()), I've only got gatt server running and providing the nrf board the ANCS service. That part works just fine. I've also tried connecting it via connectGatt, and checking the services and enabling the notifications for it. However I cannot see any indication when I send the key. If I request read for characteristic or descriptor, that works OK.
Is there some fundamental flaw in my thinking? Shouldn't the android framework handle the keyboard part? Also why I cannot get any notification about the input_report change?
Ok, the keyboard now works also with Android. I'll listen to keyboard volume in the gatt callback. Problem with previous trial was that I just enabled & read the characteristics and descriptors in a loop. After I serialized the operations it works fine.
We are working on a project of developing the soft and hardware for a bluetooth LE device.
We implemented GATT services and we are able to connect to the device.
Now the next step: Implement security.
We know that there are tree methods of security:
Just Works
Passkey Entry
Out Of Band
Since our device doesn't have a display (no_input, no_output), we are doomed to use Just Works since OOB is not supported by Android and iOS yet.
So this means we have this bluetooth device with all it's services just hanging there in the open to connect by anybody.
Is this really true in BLE?
We were thinking about implementing our own security just by connecting, writing a key to a keyservice and when that key is correct, the services open themselves for writing/reading. But what would that do with certification?
So you guys are our last resort since we are still hoping we are wrong in this one. Is there anybody who can acknowledge this fact? Or are we missing a big piece of the puzzle?
You can implement Just Works, Passkey Entry and Out Of Band (NFC) on your BLE Device.
Passkey can be written on a label on the product or be hardcoded to 0000 or 1234 or whatever you choose. This works on iOS and Android if you implement correct Bluetooth Security configuration on your BLE Device. What chipset are you using?
Out of Band works fine on Android and Windows Phone with NFC. Maybe Apple iPhone 6 and 6+ will get proper NFC functionality in a more mature iOS version later. On iOS 8.1 it is still just for Apple Pay, not for industri standard NFC functionality.
First step is to set the GATT flags so your Service or Characteristic requires security.
Second step is to implement the bluetooth Security manager messages.
There are official white papers on this on BT Special Interest Group:
https://developer.bluetooth.org/DevelopmentResources/Pages/White-Papers.aspx
I want to send notification from one android device (android tv without bluetooth, telephony) to another android device (phone/tablet). Both are on same wifi network. Through the notification, I want to launch an app or open a page in phone/tablet browser.
I went through GCM messaging and also saw some options where we can have a kind of http server on the phone running but could not understand implementation.
Can someone help with idea and if possible, some piece of code as well.
As I need it for demo, so even any hack solution is fine for me :-)
Thanks for any help or reading.
Your best bet as a hacky solution is to do simple Socket connection between two devices. Since they are on same Wifi, it will be simpler and won't have any firewall restrictions.
Avoid GCM, it requires setting up a GCM Server and then complex registration. It also makes your solution dependent upon Internet connectivity & Google ofcourse.
See an example here:
http://android-er.blogspot.in/2014/02/android-sercerclient-example-client.html
Basically one device such as TV can be a socket listener. The phone/tablet can connect to that socket and then you can initiate a notification on either device based on your requirements and data exchange.