{"action":"created","issue":{"url":"https://api.github.com/repos/randdusing/BluetoothLE/issues/74","labels_url":"https://api.github.com/repos/randdusing/BluetoothLE/issues/74/labels{/name}","comments_url":"https://api.github.com/repos/randdusing/BluetoothLE/issues/74/comments","events_url":"https://api.github.com/repos/randdusing/BluetoothLE/issues/74/events","html_url":"https://github.com/randdusing/BluetoothLE/issues/74","id":40970248,"number":74,"title":"Android performance on peridodically writing | Command queuing","user":{"login":"pfried","id":1744875,"avatar_url":"https://avatars.githubusercontent.com/u/1744875?v=3","gravatar_id":"","url":"https://api.github.com/users/pfried","html_url":"https://github.com/pfried","followers_url":"https://api.github.com/users/pfried/followers","following_url":"https://api.github.com/users/pfried/following{/other_user}","gists_url":"https://api.github.com/users/pfried/gists{/gist_id}","starred_url":"https://api.github.com/users/pfried/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfried/subscriptions","organizations_url":"https://api.github.com/users/pfried/orgs","repos_url":"https://api.github.com/users/pfried/repos","events_url":"https://api.github.com/users/pfried/events{/privacy}","received_events_url":"https://api.github.com/users/pfried/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/randdusing/BluetoothLE/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2014-08-23T08:06:21Z","updated_at":"2015-02-07T17:18:51Z","closed_at":null,"body":"Hey Rand,\r\n\r\ni saw some talk about queues in #32 where you said something about plans to implement a queue.\r\n\r\nI wanted to share some experience with my current project. Maybe i can present it somewhere on the internet when my university allows to do so (documents are all in german, but code is not).\r\n\r\nI do have a remote controlled car which is run by a Atmel XMega128A1 with a nRF8001 by Nordic Semiconductor.\r\n\r\nI think the chip does a good job and i was able to port the driver from Nordic's Arduino Implementation to the XMega with C. Altough my chip should be able to deal with about 122 connections per second with 1-2 transmissions per connection in comes down to a much much smaller transmission rate on android. My Controller should be able to handle a data rate of about 2,75 KB/s.\r\n\r\nI already had to stuff some characteristics into one because it increases performance if you do not have to handle 23 Characteristics as i had in my first draft (now its 5).\r\n\r\nI do control steering and acceleration of the car by transmitting them periodically to the car. I do this with a timeout of 175ms in javascript which results in a 180ms timeout on the native GATT. As i do transmit 6 Bytes per transmission this is **freaking bad** performance. Practically i would want to transmit at least each 50ms.\r\n\r\nIf i try to lower the timeout it will start to act weird (queuing on the native implementation) which results in the car executing one command after another but time shifted as the transmission cant handle more than these 5-6 transmissions per second. This also happens for bad signal strengths.\r\n\r\nOn the beginning of the project i hoped to get a good transmission speed via BtLE but as it turns out Android is not able to handle many transmissions with cordova and your plugin. I haven't tried to implement this in Java as i do not have time currently but i guess the result will be not much better. I looked into the docs for Android and there is not much to improve.\r\n\r\nI implemented a queue once and this was even worse that fire & forget as it was not applicable for my remote controlled car.\r\n\r\nBut back to the queue: I think it is a good idea to have a queue as it could help to avoid common problems. Even i have some timeout calls in my code to sequence the notification subscriptions on startup. In case of the driving the car i do fire the write commands each 175ms and hope it works out.\r\n\r\nDo you have some experience with writing to a single characteristics periodically or somebody else?"},"comment":{"url":"https://api.github.com/repos/randdusing/BluetoothLE/issues/comments/73373173","html_url":"https://github.com/randdusing/BluetoothLE/issues/74#issuecomment-73373173","issue_url":"https://api.github.com/repos/randdusing/BluetoothLE/issues/74","id":73373173,"user":{"login":"randdusing","id":6188656,"avatar_url":"https://avatars.githubusercontent.com/u/6188656?v=3","gravatar_id":"","url":"https://api.github.com/users/randdusing","html_url":"https://github.com/randdusing","followers_url":"https://api.github.com/users/randdusing/followers","following_url":"https://api.github.com/users/randdusing/following{/other_user}","gists_url":"https://api.github.com/users/randdusing/gists{/gist_id}","starred_url":"https://api.github.com/users/randdusing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/randdusing/subscriptions","organizations_url":"https://api.github.com/users/randdusing/orgs","repos_url":"https://api.github.com/users/randdusing/repos","events_url":"https://api.github.com/users/randdusing/events{/privacy}","received_events_url":"https://api.github.com/users/randdusing/received_events","type":"User","site_admin":false},"created_at":"2015-02-07T17:18:51Z","updated_at":"2015-02-07T17:18:51Z","body":"Thanks for the information. I'm happy to find out it wasn't something I did incorrectly :)"}}