Iphone & BLE disconnects

JoaoLopesF
Posts: 59
Joined: Thu Aug 17, 2017 5:40 pm

Re: Iphone & BLE disconnects

Postby JoaoLopesF » Fri Jun 08, 2018 5:10 pm

Hi,

The Ble support large messages by changing the MTU, and iOS change it automatically to 185 (in iOS 11 and iOS 10).

You can try, instead to send one message each 50ms, send one message each second with last 20 values.

chegewara
Posts: 2378
Joined: Wed Jun 14, 2017 9:00 pm

Re: Iphone & BLE disconnects

Postby chegewara » Sat Jun 09, 2018 2:43 am

Quick question, do you have SM(encryption and/or bonding) implemented in your project?

Fugazi
Posts: 42
Joined: Wed Apr 26, 2017 9:05 pm

Re: Iphone & BLE disconnects

Postby Fugazi » Sun Jun 10, 2018 8:41 pm

No I dont, is this required on IOS ?

Thanks

chegewara
Posts: 2378
Joined: Wed Jun 14, 2017 9:00 pm

Re: Iphone & BLE disconnects

Postby chegewara » Mon Jun 11, 2018 4:19 am

Its yours right to think like that, but trying costs not much. For example i had hid app issue with windows 10, but adding SM solved problem. Also i know esp32 solutions where BLE application works fine with iPhone, its not my app because i dont work with it.

Fugazi
Posts: 42
Joined: Wed Apr 26, 2017 9:05 pm

Re: Iphone & BLE disconnects

Postby Fugazi » Mon Jun 11, 2018 7:23 am

True,

But I am trying to copy the HM-10 BLE module, the iphone just connects to this and works forever, no disconnects

So it is possible, could be just a setting in the BLE characteristics I am missing ....

If you just connect with the Iphone with the esp32 and then dont send any notifications it stays connected, soon as you start sending, it disconnects itself.

Find it quite strange no one is using the Iphone and the esp32 for BLE and theres examples out there ??!?!!

Anyone ! :)

Fugazi
Posts: 42
Joined: Wed Apr 26, 2017 9:05 pm

Re: Iphone & BLE disconnects

Postby Fugazi » Mon Jun 11, 2018 12:44 pm

HM10 characteristics are here....


Do you think that if I try and all all of these it might work perhaps ?

V 09:09:56.411 Connecting to 7C:EC:79:EB:44:D8...
D 09:09:56.411 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE)
D 09:09:56.770 [Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
I 09:09:56.770 Connected to 7C:EC:79:EB:44:D8
D 09:09:56.779 [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
V 09:09:56.781 Discovering services...
D 09:09:56.781 gatt.discoverServices()
D 09:09:57.554 [Callback] Services discovered with status: 0
I 09:09:57.554 Services discovered
V 09:09:57.576 Generic Access (0x1800)
- Device Name [R] (0x2A00)
- Appearance [R] (0x2A01)
- Peripheral Privacy Flag [R W] (0x2A02)
- Reconnection Address [W] (0x2A03)
- Peripheral Preferred Connection Parameters [R] (0x2A04)
Generic Attribute (0x1801)
- Service Changed (0x2A05)
Client Characteristic Configuration (0x2902)
Device Information (0x180A)
- System ID [R] (0x2A23)
- Model Number String [R] (0x2A24)
- Serial Number String [R] (0x2A25)
- Firmware Revision String [R] (0x2A26)
- Hardware Revision String [R] (0x2A27)
- Software Revision String [R] (0x2A28)
- Manufacturer Name String [R] (0x2A29)
- IEEE 11073-20601 Regulatory Certification Data List [R] (0x2A2A)
- PnP ID [R] (0x2A50)
Unknown Service (0000ffe0-0000-1000-8000-00805f9b34fb)
- Unknown Characteristic [N R W WNR] (0000ffe1-0000-1000-8000-00805f9b34fb)
Client Characteristic Configuration (0x2902)
Characteristic User Description (0x2901)
D 09:09:57.576 gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
D 09:09:57.578 gatt.setCharacteristicNotification(0000ffe1-0000-1000-8000-00805f9b34fb, true)
V 09:10:07.297 Refreshing device cache...
D 09:10:07.297 gatt.refresh() (hidden)
I 09:10:07.301 Cache refreshed
V 09:10:07.302 Discovering services...
D 09:10:07.302 gatt.discoverServices()
D 09:10:08.017 [Callback] Services discovered with status: 0
I 09:10:08.018 Services discovered
V 09:10:08.042 Generic Access (0x1800)
- Device Name [R] (0x2A00)
- Appearance [R] (0x2A01)
- Peripheral Privacy Flag [R W] (0x2A02)
- Reconnection Address [W] (0x2A03)
- Peripheral Preferred Connection Parameters [R] (0x2A04)
Generic Attribute (0x1801)
- Service Changed (0x2A05)
Client Characteristic Configuration (0x2902)
Device Information (0x180A)
- System ID [R] (0x2A23)
- Model Number String [R] (0x2A24)
- Serial Number String [R] (0x2A25)
- Firmware Revision String [R] (0x2A26)
- Hardware Revision String [R] (0x2A27)
- Software Revision String [R] (0x2A28)
- Manufacturer Name String [R] (0x2A29)
- IEEE 11073-20601 Regulatory Certification Data List [R] (0x2A2A)
- PnP ID [R] (0x2A50)
Unknown Service (0000ffe0-0000-1000-8000-00805f9b34fb)
- Unknown Characteristic [N R W WNR] (0000ffe1-0000-1000-8000-00805f9b34fb)
Client Characteristic Configuration (0x2902)
Characteristic User Description (0x2901)
D 09:10:08.042 gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
D 09:10:08.044 gatt.setCharacteristicNotification(0000ffe1-0000-1000-8000-00805f9b34fb, true)
V 09:10:23.647 Reading all characteristics...
V 09:10:23.647 Reading characteristic 00002a00-0000-1000-8000-00805f9b34fb
D 09:10:23.647 gatt.readCharacteristic(00002a00-0000-1000-8000-00805f9b34fb)
V 09:10:23.718 Reading characteristic 00002a01-0000-1000-8000-00805f9b34fb
D 09:10:23.718 gatt.readCharacteristic(00002a01-0000-1000-8000-00805f9b34fb)
I 09:10:23.721 Read Response received from 00002a00-0000-1000-8000-00805f9b34fb, value: (0x) 41-69-72-57-68-65-72-65, "AirWhere"
A 09:10:23.721 "AirWhere" received
V 09:10:23.818 Reading characteristic 00002a02-0000-1000-8000-00805f9b34fb
D 09:10:23.818 gatt.readCharacteristic(00002a02-0000-1000-8000-00805f9b34fb)
I 09:10:23.824 Read Response received from 00002a01-0000-1000-8000-00805f9b34fb, value: (0x) 00-00
A 09:10:23.824 "[0] Unknown" received
V 09:10:23.918 Reading characteristic 00002a04-0000-1000-8000-00805f9b34fb
D 09:10:23.918 gatt.readCharacteristic(00002a04-0000-1000-8000-00805f9b34fb)
I 09:10:23.918 Read Response received from 00002a02-0000-1000-8000-00805f9b34fb, value: (0x) 00
A 09:10:23.918 "Privacy is disabled in this device" received
I 09:10:24.019 Read Response received from 00002a04-0000-1000-8000-00805f9b34fb, value: (0x) 50-00-A0-00-00-00-E8-03
A 09:10:24.019 "Connection Interval: 100.00ms - 200.00ms,
Slave Latency: 0,
Supervision Timeout Multiplier: 1000" received
V 09:10:24.019 Reading characteristic 00002a23-0000-1000-8000-00805f9b34fb
D 09:10:24.019 gatt.readCharacteristic(00002a23-0000-1000-8000-00805f9b34fb)
V 09:10:24.118 Reading characteristic 00002a24-0000-1000-8000-00805f9b34fb
D 09:10:24.118 gatt.readCharacteristic(00002a24-0000-1000-8000-00805f9b34fb)
I 09:10:24.118 Read Response received from 00002a23-0000-1000-8000-00805f9b34fb, value: (0x) 41-47-00-00-00-83-15-00
A 09:10:24.118 "(0x) 41-47-00-00-00-83-15-00" received
I 09:10:24.218 Read Response received from 00002a24-0000-1000-8000-00805f9b34fb, value: (0x) 4D-6F-64-65-6C-20-4E-75-6D-62-65-72-00
A 09:10:24.218 "Model Number " received
V 09:10:24.219 Reading characteristic 00002a25-0000-1000-8000-00805f9b34fb
D 09:10:24.219 gatt.readCharacteristic(00002a25-0000-1000-8000-00805f9b34fb)
I 09:10:24.320 Read Response received from 00002a25-0000-1000-8000-00805f9b34fb, value: (0x) 53-65-72-69-61-6C-20-4E-75-6D-62-65-72-00
A 09:10:24.320 "Serial Number " received
V 09:10:24.320 Reading characteristic 00002a26-0000-1000-8000-00805f9b34fb
D 09:10:24.320 gatt.readCharacteristic(00002a26-0000-1000-8000-00805f9b34fb)
V 09:10:24.420 Reading characteristic 00002a27-0000-1000-8000-00805f9b34fb
D 09:10:24.420 gatt.readCharacteristic(00002a27-0000-1000-8000-00805f9b34fb)
I 09:10:24.420 Read Response received from 00002a26-0000-1000-8000-00805f9b34fb, value: (0x) 46-69-72-6D-77-61-72-65-20-52-65-76-69-73-69-6F-6E-00
A 09:10:24.420 "Firmware Revision " received
I 09:10:24.518 Read Response received from 00002a27-0000-1000-8000-00805f9b34fb, value: (0x) 48-61-72-64-77-61-72-65-20-52-65-76-69-73-69-6F-6E-00
V 09:10:24.518 Reading characteristic 00002a28-0000-1000-8000-00805f9b34fb
A 09:10:24.518 "Hardware Revision " received
D 09:10:24.518 gatt.readCharacteristic(00002a28-0000-1000-8000-00805f9b34fb)
V 09:10:24.618 Reading characteristic 00002a29-0000-1000-8000-00805f9b34fb
D 09:10:24.618 gatt.readCharacteristic(00002a29-0000-1000-8000-00805f9b34fb)
I 09:10:24.618 Read Response received from 00002a28-0000-1000-8000-00805f9b34fb, value: (0x) 53-6F-66-74-77-61-72-65-20-52-65-76-69-73-69-6F-6E-00
A 09:10:24.618 "Software Revision " received
V 09:10:24.718 Reading characteristic 00002a2a-0000-1000-8000-00805f9b34fb
D 09:10:24.718 gatt.readCharacteristic(00002a2a-0000-1000-8000-00805f9b34fb)
I 09:10:24.718 Read Response received from 00002a29-0000-1000-8000-00805f9b34fb, value: (0x) 4D-61-6E-75-66-61-63-74-75-72-65-72-20-4E-61-6D-65-00
A 09:10:24.718 "Manufacturer Name " received
V 09:10:24.818 Reading characteristic 00002a50-0000-1000-8000-00805f9b34fb
D 09:10:24.818 gatt.readCharacteristic(00002a50-0000-1000-8000-00805f9b34fb)
I 09:10:24.818 Read Response received from 00002a2a-0000-1000-8000-00805f9b34fb, value: (0x) FE-00-65-78-70-65-72-69-6D-65-6E-74-61-6C
A 09:10:24.818 "(0x) FE-00-65-78-70-65-72-69-6D-65-6E-74-61-6C" received
V 09:10:24.918 Reading characteristic 0000ffe1-0000-1000-8000-00805f9b34fb
D 09:10:24.918 gatt.readCharacteristic(0000ffe1-0000-1000-8000-00805f9b34fb)
I 09:10:24.919 Read Response received from 00002a50-0000-1000-8000-00805f9b34fb, value: (0x) 01-0D-00-00-00-10-01
A 09:10:24.919 "Bluetooth SIG Company: Texas Instruments Inc. <0x000D>
Product Id: 0
Product Version: 272" received

JoaoLopesF
Posts: 59
Joined: Thu Aug 17, 2017 5:40 pm

Re: Iphone & BLE disconnects

Postby JoaoLopesF » Mon Jun 11, 2018 9:39 pm

Hi, Fugazi
Find it quite strange no one is using the Iphone and the esp32 for BLE and theres examples out there ??!?!!
I not agree that, I use with success esp32 BLE with iPhone and iPad, iOS versions 10 and 11, much estable for my app :-)

What is the interval of time you send messages to iOS?
Have you tried the solution to send wide messages every second?

Fugazi
Posts: 42
Joined: Wed Apr 26, 2017 9:05 pm

Re: Iphone & BLE disconnects

Postby Fugazi » Thu Jun 14, 2018 8:42 am

Hi

Do you have your app code online, would be good to try?

I havent tried wide messages yet as I need to maintain compatibility with Android and the HM10 works fine so theres an setting with the esp32 thats not right ....

Thanks anyway :)

JoaoLopesF
Posts: 59
Joined: Thu Aug 17, 2017 5:40 pm

Re: Iphone & BLE disconnects

Postby JoaoLopesF » Thu Jun 14, 2018 1:00 pm

Hi Fugazi,

I will make it in future, a complete sample solution for Esp32 BLE, with Esp-Idf firmware, Android app in kotlin, iOS app in swift 4.
I need prepare all, and translate all code and apps to english.
But I dont have time now for this, but I post here when it is done.
I see this is important, because today we do not have a complete example for who is starting to work with ESP32 Ble and app mobile.

p-rimes
Posts: 89
Joined: Thu Jun 08, 2017 6:20 pm

Re: Iphone & BLE disconnects

Postby p-rimes » Mon Jun 18, 2018 3:42 pm

I have the same issue with my iPhone 5S.

In my case, I have tried the `examples/bluetooth/blufi` sample and that appears to fail in the same way. That example is supposed to work out-of-the-box without many application bluetooth tweaks.

What's more, is when testing a few months ago I did not see these issues when using an iPhone (It wasn't a 100% reliable connection, but it would run for many minutes, and not only a few seconds as it does now.)

So in my opinion this is possibly an issue within ESP-IDF, and perhaps something which has changed only recently. There is also the possibility that the latest iOS has changed something, since my phone is running the latest version.

I have no idea how to fix it, or what might have changed.

Who is online

Users browsing this forum: Baidu [Spider] and 145 guests