{"action":"created","issue":{"url":"https://api.github.com/repos/sandeepmistry/noble/issues/229","repository_url":"https://api.github.com/repos/sandeepmistry/noble","labels_url":"https://api.github.com/repos/sandeepmistry/noble/issues/229/labels{/name}","comments_url":"https://api.github.com/repos/sandeepmistry/noble/issues/229/comments","events_url":"https://api.github.com/repos/sandeepmistry/noble/issues/229/events","html_url":"https://github.com/sandeepmistry/noble/issues/229","id":100869239,"number":229,"title":"Cancel a connection","user":{"login":"carlst","id":857385,"avatar_url":"https://avatars.githubusercontent.com/u/857385?v=3","gravatar_id":"","url":"https://api.github.com/users/carlst","html_url":"https://github.com/carlst","followers_url":"https://api.github.com/users/carlst/followers","following_url":"https://api.github.com/users/carlst/following{/other_user}","gists_url":"https://api.github.com/users/carlst/gists{/gist_id}","starred_url":"https://api.github.com/users/carlst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlst/subscriptions","organizations_url":"https://api.github.com/users/carlst/orgs","repos_url":"https://api.github.com/users/carlst/repos","events_url":"https://api.github.com/users/carlst/events{/privacy}","received_events_url":"https://api.github.com/users/carlst/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sandeepmistry/noble/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-08-13T21:04:05Z","updated_at":"2016-05-02T01:01:11Z","closed_at":null,"body":"Would it make sense to add `peripheral.cancel` (presumably invoking a lower-level `cancelLeConn()`)?\r\n\r\nI am calling `peripheral.connect` but the device does not respond, and the call does not timeout.\r\n\r\nCalling `peripheral.disconnect` (e.g. after a connection timer expires) does not work, presumably because there is no connection to disconnect.\r\n\r\nFWIW, I did a quick mod, calling `cancelLeConn` after a connection timer expires, and it seems to work fine. After calling it, an `onconnect` event occurs and `peripheral.state` is `error` (no subsequent `ondisconnect` event occurs, as expected).\r\n\r\n**Note:** above tested only on Windows (WinUSB), which is great work(!) by the way, for those of us using that platform.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/sandeepmistry/noble/issues/comments/216086728","html_url":"https://github.com/sandeepmistry/noble/issues/229#issuecomment-216086728","issue_url":"https://api.github.com/repos/sandeepmistry/noble/issues/229","id":216086728,"user":{"login":"chumager","id":775491,"avatar_url":"https://avatars.githubusercontent.com/u/775491?v=3","gravatar_id":"","url":"https://api.github.com/users/chumager","html_url":"https://github.com/chumager","followers_url":"https://api.github.com/users/chumager/followers","following_url":"https://api.github.com/users/chumager/following{/other_user}","gists_url":"https://api.github.com/users/chumager/gists{/gist_id}","starred_url":"https://api.github.com/users/chumager/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chumager/subscriptions","organizations_url":"https://api.github.com/users/chumager/orgs","repos_url":"https://api.github.com/users/chumager/repos","events_url":"https://api.github.com/users/chumager/events{/privacy}","received_events_url":"https://api.github.com/users/chumager/received_events","type":"User","site_admin":false},"created_at":"2016-05-02T01:01:11Z","updated_at":"2016-05-02T01:01:11Z","body":"I used the patch from @carlst, I need to work with dozens of BLEs, so, to avoid problems I used a Async Queue, with one process at the time, with this I avoid the problem of trying to connect a BLE while other is doing the same, my HCI dump shows correctness in the process, I don't know if some of my code will help you to do it better.\r\n\r\nIn the mean time I can tell you I use the patch before I start scanning to avoid the HCI state of trying to connect after mi code stops and stay doing it, I can stop the HCI to trying. "}}