RemoteError: 0x023B: Unacceptable Connection Interval
Hi there!
I've managed to get this setup on a Docker container using the BlueZ framework but surprisingly I'm having a tricky time getting this to work using the bluegiga framework.
I fire up PyPush as normal, webUI starts, detects the device (clean container - removed previous sqlite DB from BlueZ experiments.) The problem comes when trying to pair the devices:
2017-05-28 18:48:52,590 api line:986 INFO EVT-Attribute Client Procedure Completed - Connection:0 - Result:[OK] - End Characteristic Handle:0
2017-05-28 18:48:52,614 api line:979 INFO EVT-Connection Disconnected - Connection:0 - Reason:Unacceptable Connection Interval
2017-05-28 18:48:52,614 api line:792 INFO RSP-Attribute Client Find Information: [Not Connected] (0)
2017-05-28 18:48:52,614 daemon line:62 ERROR Error calling action
Traceback (most recent call last):
File "PyPush/core/ble/daemon.py", line 60, in step
actionResult = self._callAction(uuid, cmd, args, kwargs)
File "PyPush/core/ble/daemon.py", line 130, in _callAction
for colour in mb.pair():
File "PyPush/lib/microbot/microbot.py", line 152, in pair
conn = self._bleApi.connect(self._bleMb)
File "PyPush/lib/ble/bgapi/api.py", line 51, in connect
conn._open() # pylint: disable=W0212
File "PyPush/lib/ble/bgapi/connection.py", line 267, in _open
self._bleConn = self._initBleConnection(conn)
File "PyPush/lib/ble/bgapi/connection.py", line 295, in _initBleConnection
conn.find_all_information(timeout=120)
File "PyPush/lib/ble/bgapi/libLock.py", line 43, in _wrapper_
return _realAttr(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/bgapi/module.py", line 316, in _wrapper_
return fn(self, *args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/bgapi/module.py", line 439, in find_all_information
self._api.ble_cmd_attclient_find_information(self.handle, 0x0001, 0xFFFF)
File "/usr/local/lib/python2.7/contextlib.py", line 24, in __exit__
self.gen.next()
File "/usr/local/lib/python2.7/site-packages/bgapi/module.py", line 285, in procedure_call
raise RemoteError(handle.result)
RemoteError: 0x023B: Unacceptable Connection Interval
2017-05-28 18:48:52,615 daemon line:64 ERROR Traceback (most recent call last):
File "PyPush/core/ble/daemon.py", line 60, in step
actionResult = self._callAction(uuid, cmd, args, kwargs)
File "PyPush/core/ble/daemon.py", line 130, in _callAction
for colour in mb.pair():
File "PyPush/lib/microbot/microbot.py", line 152, in pair
conn = self._bleApi.connect(self._bleMb)
File "PyPush/lib/ble/bgapi/api.py", line 51, in connect
conn._open() # pylint: disable=W0212
File "PyPush/lib/ble/bgapi/connection.py", line 267, in _open
self._bleConn = self._initBleConnection(conn)
File "PyPush/lib/ble/bgapi/connection.py", line 295, in _initBleConnection
conn.find_all_information(timeout=120)
File "PyPush/lib/ble/bgapi/libLock.py", line 43, in _wrapper_
return _realAttr(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/bgapi/module.py", line 316, in _wrapper_
return fn(self, *args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/bgapi/module.py", line 439, in find_all_information
self._api.ble_cmd_attclient_find_information(self.handle, 0x0001, 0xFFFF)
File "/usr/local/lib/python2.7/contextlib.py", line 24, in __exit__
self.gen.next()
File "/usr/local/lib/python2.7/site-packages/bgapi/module.py", line 285, in procedure_call
raise RemoteError(handle.result)
RemoteError: 0x023B: Unacceptable Connection Interval
Any ideas?
As a side note - the docker container you have does not include the fix you added for BlueZ - I had to hack that in to the container to get that setup working. Now that I have a bluegiga device though (BLED112-V1) I would prefer to get that setup working - the BlueZ setup felt a bit hacky and unpolished.
Cheers
EDIT: Also - forgot to mention - I have performed the unpairing procedure and tried to pair after that - no change sadly.
EDIT 2: I have also now flashed your firmware to the BLED112 device - same result sadly but figured it was worth a shot!
I have updated the docker container with latest code & bluez stack. Apologies for the version mismatch - this project had been idle for a long time, and somehow sprung to the action in last few weeks.
The only difference between "My" and "official" firmware is that my allows for up to 8 simultaneous ble connections while stock has three-connection limit. Considering that this is officially supported configurable parameter I'm not too sure on why stock fw has this limit.
As of the actual "unacceptable connection interval" error.
I am also getting this sometimes. Sadly, I have not found a way of fixing it yet. AFAICU from the BLE documentation, this means that the client (PyPush server) makes too many connection attempts to the server (Microbot Push) in a period of time that is too short for the server (BLE is all about power efficiency, you see).
However, I have tinkered with bgapi code a lot introducing delays in accordance to the connection settings supplied by the server, added voluntary delays of my own and the thing fails still.
IMO this might be one of reasons why official sowtware is rather unreliable and they haven't managed to fix this either.
I might try updating microbot firmware to see if this goes away on the newest release (prota hub allows you to do that, but there is no way of rolling back afterwards sadly).
I've just noticed that I had few connection interval values changes (extensions, really) laying on my local checkout. I've probably done that few months ago and forgot to commit/push them.
Can you please try pulling the code and see if it works for you?
Docker: Thanks for the container update push - I've updated to the latest one.
Firmware: I thought that was the case but figured I'd give it a shot to see if it helped.
Unacceptable Connection Interval: Sadly - despite updating the source (noticed the 120 timeouts instead of 20) I still get the following error at pairing time (I wouldn't mind if this was once in a while but I literally can't pair the device sadly - no battery, no calibration, pairing fails every time.
2017-05-29 10:31:33,033 daemon line:50 INFO Executing [u'pair', ((), {})]
2017-05-29 10:31:33,033 microbot line:150 INFO Pairing with <BgMicrobot 'Unknown Microbot (42:3B)' ('DF:91:C5:2F:42:3B')>
2017-05-29 10:31:33,059 api line:1026 INFO EVT-GAP Scan Response - RSSI:-61 - Packet Type:0 - Sender:df:91:c5:2f:42:3b - Address Type:1 - Bond:255 - Data:0319000002010605030F180A1809096D69622D70757368
2017-05-29 10:31:33,217 api line:1026 INFO EVT-GAP Scan Response - RSSI:-61 - Packet Type:0 - Sender:df:91:c5:2f:42:3b - Address Type:1 - Bond:255 - Data:0319000002010605030F180A1809096D69622D70757368
2017-05-29 10:31:33,299 api line:1026 INFO EVT-GAP Scan Response - RSSI:-61 - Packet Type:0 - Sender:df:91:c5:2f:42:3b - Address Type:1 - Bond:255 - Data:0319000002010605030F180A1809096D69622D70757368
2017-05-29 10:31:38,804 api line:852 INFO RSP-GAP End Procedure: [OK]
2017-05-29 10:31:38,805 api line:849 INFO RSP-GAP Connect Direct: [OK] (0)
2017-05-29 10:31:38,805 api line:967 INFO EVT-Connection Status - Handle:0 - Flags:05 - Address:DF91C52F423B - Address Type:1 - Interval:32 - Timeout:100 - Latency:0 - Bonding:255
2017-05-29 10:31:38,806 api line:967 INFO EVT-Connection Status - Handle:0 - Flags:09 - Address:DF91C52F423B - Address Type:1 - Interval:320 - Timeout:400 - Latency:0 - Bonding:255
2017-05-29 10:31:40,005 api line:786 INFO RSP-Attribute Client Read By Group Type - Connection:0 - [OK]
2017-05-29 10:31:40,005 api line:990 INFO EVT-Attribute Client Group Found - Connection:0 - Start Handle:1 - End Handle:7 - UUID:1800
2017-05-29 10:31:40,006 api line:990 INFO EVT-Attribute Client Group Found - Connection:0 - Start Handle:8 - End Handle:11 - UUID:1801
2017-05-29 10:31:40,006 api line:990 INFO EVT-Attribute Client Group Found - Connection:0 - Start Handle:12 - End Handle:14 - UUID:180A
2017-05-29 10:31:40,805 api line:990 INFO EVT-Attribute Client Group Found - Connection:0 - Start Handle:15 - End Handle:22 - UUID:000015301212EFDE1523785FEABCD123
2017-05-29 10:31:41,605 api line:990 INFO EVT-Attribute Client Group Found - Connection:0 - Start Handle:23 - End Handle:56 - UUID:1831
2017-05-29 10:31:41,606 api line:990 INFO EVT-Attribute Client Group Found - Connection:0 - Start Handle:57 - End Handle:65535 - UUID:1821
2017-05-29 10:31:49,204 api line:986 INFO EVT-Attribute Client Procedure Completed - Connection:0 - Result:[OK] - End Characteristic Handle:0
2017-05-29 10:31:49,231 api line:979 INFO EVT-Connection Disconnected - Connection:0 - Reason:Unacceptable Connection Interval
2017-05-29 10:31:49,231 api line:792 INFO RSP-Attribute Client Find Information: [Not Connected] (0)
2017-05-29 10:31:49,233 daemon line:62 ERROR Error calling action
Traceback (most recent call last):
File "PyPush/core/ble/daemon.py", line 60, in step
actionResult = self._callAction(uuid, cmd, args, kwargs)
File "PyPush/core/ble/daemon.py", line 130, in _callAction
for colour in mb.pair():
File "PyPush/lib/microbot/microbot.py", line 152, in pair
conn = self._bleApi.connect(self._bleMb)
File "PyPush/lib/ble/bgapi/api.py", line 51, in connect
conn._open() # pylint: disable=W0212
File "PyPush/lib/ble/bgapi/connection.py", line 267, in _open
self._bleConn = self._initBleConnection(conn)
File "PyPush/lib/ble/bgapi/connection.py", line 295, in _initBleConnection
conn.find_all_information(timeout=120)
File "PyPush/lib/ble/bgapi/libLock.py", line 43, in _wrapper_
return _realAttr(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/bgapi/module.py", line 316, in _wrapper_
return fn(self, *args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/bgapi/module.py", line 439, in find_all_information
self._api.ble_cmd_attclient_find_information(self.handle, 0x0001, 0xFFFF)
File "/usr/local/lib/python2.7/contextlib.py", line 24, in __exit__
self.gen.next()
File "/usr/local/lib/python2.7/site-packages/bgapi/module.py", line 285, in procedure_call
raise RemoteError(handle.result)
RemoteError: 0x023B: Unacceptable Connection Interval
2017-05-29 10:31:49,234 daemon line:64 ERROR Traceback (most recent call last):
File "PyPush/core/ble/daemon.py", line 60, in step
actionResult = self._callAction(uuid, cmd, args, kwargs)
File "PyPush/core/ble/daemon.py", line 130, in _callAction
for colour in mb.pair():
File "PyPush/lib/microbot/microbot.py", line 152, in pair
conn = self._bleApi.connect(self._bleMb)
File "PyPush/lib/ble/bgapi/api.py", line 51, in connect
conn._open() # pylint: disable=W0212
File "PyPush/lib/ble/bgapi/connection.py", line 267, in _open
self._bleConn = self._initBleConnection(conn)
File "PyPush/lib/ble/bgapi/connection.py", line 295, in _initBleConnection
conn.find_all_information(timeout=120)
File "PyPush/lib/ble/bgapi/libLock.py", line 43, in _wrapper_
return _realAttr(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/bgapi/module.py", line 316, in _wrapper_
return fn(self, *args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/bgapi/module.py", line 439, in find_all_information
self._api.ble_cmd_attclient_find_information(self.handle, 0x0001, 0xFFFF)
File "/usr/local/lib/python2.7/contextlib.py", line 24, in __exit__
self.gen.next()
File "/usr/local/lib/python2.7/site-packages/bgapi/module.py", line 285, in procedure_call
raise RemoteError(handle.result)
RemoteError: 0x023B: Unacceptable Connection Interval
Thanks for your help with this - much appreciated.
@VRGhost I've been fiddling with this off and on but sadly no luck no matter what I do.
As I mentioned - it worked just fine with the bluez setup I tried at first - I thought I'd switch to the bluegiga setup since it sounded like it was more reliable and can't even get it to pair! :(
I do believe my devices are running the latest firmware version (i.e. the push devices) - I paired them with the iOS app and wasn't offered a firmware update.
I may revert back to the bluez setup for now unless you have any other ideas ror me to try?