Description
I'm trying to run Bleno on Angstrom, and I'm making a pretty simple program to test Bleno's capacity, but I've hit my first real snag. I'm connecting with an Android device (which I'm sure is working correctly). The GATT is formed correctly (it only has one service and characteristic), but once I try to read, it stalls out, disconnects, and fails the read. Most of the time it throws an error that looks like this:
[75674.595250] Bluetooth: hci0 link tx timeout.
The code running Bleno:
var isOn = false;
bleno.on('stateChange', (state) => {
console.log(state);
if (state == "poweredOn" && !isOn) {
bleno.startAdvertising("Muh-Mac", 0, (err) => {
if (err) console.log("Well, we tried...");
});
}
});
bleno.on('advertisingStart', (err) => {
console.log("Started Advertising");
fs.readFile('./sampleGATT.json', "utf8", (err, data) => {
if (err) console.log(err);
console.log(data);
let sampleGATT = JSON.parse(data);
gg.makeGatt(sampleGATT).then(function(res, rej) {
console.log(res);
console.log(rej);
bleno.setServices(res, (err) => {
if (err) console.log(err);
});
});
});
});
bleno.on('advertisingStartError', (err) => {
console.log(err);
});
bleno.on('advertisingStop', () => {
console.log("Advertising Stopped");
});
bleno.on('servicesSet', (err) => {
console.log("Set Services");
});
bleno.on('servicesSetError', (err) => {
console.log(err);
});
bleno.on('accept', (clientAddress) => {
console.log(clientAddress);
});
bleno.on('disconnect', (clientAddress) => {
console.log("Disconnected From: " + clientAddress);
});
bleno.on('rssiUpdate', (rssi) => {
console.log("This Number is Virtually Meaningless: " + rssi);
});
On Read Request for the CO2 characteristic:
_onReadRequest(offset, callback) {
console.log("Read Requested");
var data = new Buffer(1);
callback(this.RESULT_SUCCESS, data);
}
The times that it doesn't give me [75674.595250] Bluetooth: hci0 link tx timeout, it waits for about 10 seconds, then my android tells me that there was an error reading and the connection fails on what seems like the Bleno side.
I've attached the DEBUG file from a crash giving the [75674.595250] Bluetooth: hci0 link tx timeout error. Any idea what's happening here?
EDIT: Angstrom version:
Angstrom v2016.12 (Core edition)
Built from branch: default
Revision: 2e132efa2f985f72c3b6c5402747d0b0e1fc540a
Target system: arm-angstrom-linux-gnueabi