<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Android Central connected to 2 peripherals</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/12914/android-central-connected-to-2-peripherals</link><description>I have modified the Android Blinky App to connect two peripherals (nRF52 DK) 
 Scanning and Connecting to two peripherals works.. but when i want to start sending notifications of one of the peripherals the connection is terminated. 
 in the btsnoop</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 07 Apr 2016 08:01:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/12914/android-central-connected-to-2-peripherals" /><item><title>RE: Android Central connected to 2 peripherals</title><link>https://devzone.nordicsemi.com/thread/49178?ContentTypeID=1</link><pubDate>Thu, 07 Apr 2016 08:01:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:66610634-8605-406c-be60-999284c147dc</guid><dc:creator>schoensn</dc:creator><description>&lt;p&gt;thanks for your help. i think, thats a solution to split the data from the two devices.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android Central connected to 2 peripherals</title><link>https://devzone.nordicsemi.com/thread/49177?ContentTypeID=1</link><pubDate>Thu, 07 Apr 2016 07:55:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bef513a8-c1ea-414d-98c6-a18cab37343e</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;I guess you can add more data (putExtra) about the device or the BluetoothGatt instance that send the notification in when you send broadcast. Then in the application you should be able to distinguish between the 2.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android Central connected to 2 peripherals</title><link>https://devzone.nordicsemi.com/thread/49174?ContentTypeID=1</link><pubDate>Wed, 06 Apr 2016 15:48:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a8f87c54-0abf-4dd0-b762-6493e25f1264</guid><dc:creator>schoensn</dc:creator><description>&lt;p&gt;that solution works. but now i have the problem, that I get the notifications from both devices on one broadcast reciever. is there a easy solution to recieve the data in diffrent variables?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android Central connected to 2 peripherals</title><link>https://devzone.nordicsemi.com/thread/49175?ContentTypeID=1</link><pubDate>Wed, 06 Apr 2016 15:07:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5b15c32-e724-4ca0-be10-0b0348e35261</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;What if you enable notification and receive notification from one device, and then after that you connect to second one and enable notification on that ? Make sure you use separate BluetoothGatt instance for each of them.&lt;/p&gt;
&lt;p&gt;setCharacteristicNotification() should work, it should send the write command to the CCCD characteristic. Please check again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android Central connected to 2 peripherals</title><link>https://devzone.nordicsemi.com/thread/49176?ContentTypeID=1</link><pubDate>Wed, 06 Apr 2016 12:55:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8fa2766e-596b-47a8-ac2a-9ca0563119d2</guid><dc:creator>schoensn</dc:creator><description>&lt;p&gt;if i only connect to one device my application works.. if i connect to two devices i sometimes recieve data from one device and it also happens, that i do not recieve any data.&lt;/p&gt;
&lt;p&gt;In the meantime I have found out that, setCharacteristicNotification() only enables the notification on the android device and gatt.writeDescriptor() writes the CCCD..&lt;/p&gt;
&lt;p&gt;and gatt.writeDescriptor() is only called for one device.&lt;/p&gt;
&lt;p&gt;here is a trace of the android monitor:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    D/BluetoothGatt: connect() - device: C5:7F:B0:8E:AA:91, auto: false
D/BluetoothGatt: registerApp()
D/BluetoothGatt: registerApp() - UUID=8c2e588c-697a-4d6c-86b6-49593dc9ea78
D/BluetoothGatt: connect() - device: C5:87:1C:CC:95:68, auto: false
D/BluetoothGatt: registerApp()
D/BluetoothGatt: registerApp() - UUID=0291feac-df2d-47e3-acd4-12d533945892
D/BluetoothGatt: onClientRegistered() - status=0 clientIf=6
D/BluetoothGatt: onClientRegistered() - status=0 clientIf=7
D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=6 device=C5:7F:B0:8E:AA:91
D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=7 device=C5:87:1C:CC:95:68
D/BluetoothGatt: discoverServices() - device: C5:7F:B0:8E:AA:91
D/BluetoothGatt: onSearchComplete() = Device=C5:7F:B0:8E:AA:91 Status=0
D/DeviceC5:7F:B0:8E:AA:91: Enable Notifications initGatt() 
D/BluetoothGatt: setCharacteristicNotification() - uuid: 00002a37-0000-1000-8000-00805f9b34fb enable: true
D/BluetoothGatt: discoverServices() - device: C5:87:1C:CC:95:68
D/BluetoothGatt: onSearchComplete() = Device=C5:87:1C:CC:95:68 Status=0
D/DeviceC5:87:1C:CC:95:68: Enable Notifications initGatt() 
D/BluetoothGatt: setCharacteristicNotification() - uuid: 00002a19-0000-1000-8000-00805f9b34fb enable: true
D/BluetoothGatt: setCharacteristicNotification() - uuid: 00002a37-0000-1000-8000-00805f9b34fb enable: true
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I think the problem is, that I connect to the second device, when service discovery, enable notification, write descriptor,.. have not finished..&lt;/p&gt;
&lt;p&gt;the nRFMaster Control Panel app works fine with 2 peripherals, so i dont think it is an issue regarding the android phone...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android Central connected to 2 peripherals</title><link>https://devzone.nordicsemi.com/thread/49173?ContentTypeID=1</link><pubDate>Wed, 06 Apr 2016 11:13:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3aabd91-db47-468a-b6f6-93189e869a45</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;I don&amp;#39;t think there could be any trouble with that. But you wrote earlier that you still can receive data from one device ?&lt;/p&gt;
&lt;p&gt;My suggestion is to test by trying to write to a characteristic (by writeCharacteristic not setCharacteristicNotification ). You can test and check if it works with one device before testing with two, concurrently. You can also check if it&amp;#39;s the issue with Android phone by using our nRFMaster Control Panel app. It should work with more than 1 peripheral.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android Central connected to 2 peripherals</title><link>https://devzone.nordicsemi.com/thread/49172?ContentTypeID=1</link><pubDate>Tue, 05 Apr 2016 15:51:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9fca5d82-d9ab-4055-ae14-f80c5e2b8133</guid><dc:creator>schoensn</dc:creator><description>&lt;p&gt;the write command to enable notification has not been sent for both devices (I have checked this with the sniffer) , but on the android monitor I have seen:
&lt;code&gt;BluetoothGatt: setCharacteristicNotification() - uuid: 00002a37-0000-1000-8000-00805f9b34fb enable: true&lt;/code&gt;for both devices.&lt;/p&gt;
&lt;p&gt;at the moment i am debuggin my app to find the reason, why the descriptor is not written for both devices.&lt;/p&gt;
&lt;p&gt;is there anything I have to take care when I want to connect to multple devices? delay after connecting to a device etc.?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android Central connected to 2 peripherals</title><link>https://devzone.nordicsemi.com/thread/49169?ContentTypeID=1</link><pubDate>Tue, 05 Apr 2016 09:12:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:167d05ac-a542-405d-a2cc-dd3092317240</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@schoensn: Have you check if both of the devices got a write command to enable notification ? (Write 0x01 to the CCCD characteristic ? ). You need to do that from the app. Also you have to check if the notifications are sent from both device but for some reason the app only update the notification from one device. You can check that with a sniffer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android Central connected to 2 peripherals</title><link>https://devzone.nordicsemi.com/thread/49170?ContentTypeID=1</link><pubDate>Mon, 04 Apr 2016 14:05:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:110de9b4-6b22-479e-af82-c4e0e8377264</guid><dc:creator>schoensn</dc:creator><description>&lt;p&gt;I have modified the application. now it uses the HRS.. You can download my source code here:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.dropbox.com/s/k4l1m99b0oykqrr/HRSDemo.zip?dl=0"&gt;HRS_DEMO&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;to connect to the peripherals you have to select both devices and push the connect button.&lt;/p&gt;
&lt;p&gt;now the connection is not terminated, but i only recieve data from one device.&lt;/p&gt;
&lt;p&gt;is it possible to have a look at my code and tell me if there is a problem in my implemention?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android Central connected to 2 peripherals</title><link>https://devzone.nordicsemi.com/thread/49171?ContentTypeID=1</link><pubDate>Mon, 04 Apr 2016 08:49:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5299bdf4-fe9a-4ecc-b93d-940840fe29b7</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi schoensn,&lt;/p&gt;
&lt;p&gt;I tested with 2 peripheral pretty long ago and it worked on my phone ( was samsung galaxy S4 at that time). I haven&amp;#39;t seen how you connect and attach Bluetooth Gatt Services to each connection in the code snippet . Maybe you want to make a simple app that connect to say an peripheral example in the SDK (hrs for example) so that I can test here for you just to check if it&amp;#39;s the issue with your Android device.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>