{"action":"created","issue":{"url":"https://api.github.com/repos/don/BluetoothSerial/issues/199","repository_url":"https://api.github.com/repos/don/BluetoothSerial","labels_url":"https://api.github.com/repos/don/BluetoothSerial/issues/199/labels{/name}","comments_url":"https://api.github.com/repos/don/BluetoothSerial/issues/199/comments","events_url":"https://api.github.com/repos/don/BluetoothSerial/issues/199/events","html_url":"https://github.com/don/BluetoothSerial/issues/199","id":133984967,"number":199,"title":"subscribeRawData does not return anything","user":{"login":"mikecunneen","id":6695739,"avatar_url":"https://avatars.githubusercontent.com/u/6695739?v=3","gravatar_id":"","url":"https://api.github.com/users/mikecunneen","html_url":"https://github.com/mikecunneen","followers_url":"https://api.github.com/users/mikecunneen/followers","following_url":"https://api.github.com/users/mikecunneen/following{/other_user}","gists_url":"https://api.github.com/users/mikecunneen/gists{/gist_id}","starred_url":"https://api.github.com/users/mikecunneen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikecunneen/subscriptions","organizations_url":"https://api.github.com/users/mikecunneen/orgs","repos_url":"https://api.github.com/users/mikecunneen/repos","events_url":"https://api.github.com/users/mikecunneen/events{/privacy}","received_events_url":"https://api.github.com/users/mikecunneen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-16T13:42:59Z","updated_at":"2016-02-17T17:09:09Z","closed_at":null,"body":"I'm using v. 0.4.5 of the plugin on an Ionic 1 App. My device sends back binary data so I am trying to use subscribeRawData() but it refuses to return any data. \r\n\r\nAll the other functions work fine and my device tells me I am subscribed successfully. The regular subscribe() functions returns data but it's a string and I can't seem to parse it into anything else.\r\n\r\nThe attached screenshot is the data from the read function and as you can see it's unreadable.\r\n\r\nI'm really stuck with this and would really appreciate some advice.\r\n\r\nThanks for an awesome plugin :)\r\n\r\nMike\r\n![screenshot_2015-10-24-23-24-12](https://cloud.githubusercontent.com/assets/6695739/13077832/2d73054a-d4b3-11e5-8203-ac8303196d06.png)\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/don/BluetoothSerial/issues/comments/185303119","html_url":"https://github.com/don/BluetoothSerial/issues/199#issuecomment-185303119","issue_url":"https://api.github.com/repos/don/BluetoothSerial/issues/199","id":185303119,"user":{"login":"don","id":3133,"avatar_url":"https://avatars.githubusercontent.com/u/3133?v=3","gravatar_id":"","url":"https://api.github.com/users/don","html_url":"https://github.com/don","followers_url":"https://api.github.com/users/don/followers","following_url":"https://api.github.com/users/don/following{/other_user}","gists_url":"https://api.github.com/users/don/gists{/gist_id}","starred_url":"https://api.github.com/users/don/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/don/subscriptions","organizations_url":"https://api.github.com/users/don/orgs","repos_url":"https://api.github.com/users/don/repos","events_url":"https://api.github.com/users/don/events{/privacy}","received_events_url":"https://api.github.com/users/don/received_events","type":"User","site_admin":false},"created_at":"2016-02-17T17:09:08Z","updated_at":"2016-02-17T17:09:08Z","body":"@mikecunneen I modified the [Counter example](https://github.com/don/BluetoothSerial/tree/master/examples/Counter) to print the subscribed data and the raw data. Everything seemed to work OK.\r\n\r\nCan you try on your machine?\r\n\r\nAdd a div to the HTML for the raw data to index.html\r\n\r\n        <div id=\"rawDataDiv\"></div>\r\n\r\nReplace index.js from the example with https://gist.github.com/don/a8fb0b9b11a4393e4b9b. Be sure to update the mac address var to match your hardware.\r\n\r\nThe change subscribe for raw data in onConnect\r\n\r\n    bluetoothSerial.subscribeRawData(app.onRawData, app.subscribeFailed);\r\n\r\nAnd add a function to handle the raw data callbacks\r\n\r\n    onRawData: function(data) {\r\n        rawDataDiv.innerHTML = new Uint8Array(data);\r\n    },\r\n\r\nI was using an Arduino with the [Counter sketch](https://github.com/don/BluetoothSerial/blob/master/examples/Counter/Arduino/Counter/Counter.ino) but you should be able to use your existing device, since the UI just prints out the data it receives.\r\n\r\nThe data comes back as an ArrayBuffer, so you need to create a typed array before you can use it. If it's bytes, I usually use a Uint8Array. If you're expecting different data use what makes sense for your data e.g. Float32Array. "}}