bleno cant send 256 bytes on dynamic read and notify
See original GitHub issueWhen i try to send 256 bytes using dynamic read or notification using bleno, the other end (Android or noble) receives only 22 bytes. See code below.
However, when 256 bytes are sent using a static readonly characteristic, all 256 bytes are received properly.
The BLE spec says characteristic values can be 512 bytes.
Is this a bug?
Environment: bleno: Macbook pro with Mavericks. Node v0.10.24 noble: Ubuntu 13 desktop with Node v0.10.24 android: API 19, Nexus 4
var chars = [];
for(var i = 0; i < 256; i++) {
chars.push('a');
}
var StaticReadOnlyCharacteristic = function() {
StaticReadOnlyCharacteristic.super_.call(this, {
uuid: 'fffffffffffffffffffffffffffffff1',
properties: ['read'],
value: new Buffer(chars.join('')),
descriptors: [
new Descriptor({
uuid: '2901',
value: 'user description'
})
]
});
};
util.inherits(StaticReadOnlyCharacteristic, Characteristic);
var DynamicReadOnlyCharacteristic = function() {
DynamicReadOnlyCharacteristic.super_.call(this, {
uuid: 'fffffffffffffffffffffffffffffff2',
properties: ['read']
});
};
util.inherits(DynamicReadOnlyCharacteristic, Characteristic);
DynamicReadOnlyCharacteristic.prototype.onReadRequest = function(offset, callback) {
console.log("on -> readRequest");
var result = this.RESULT_SUCCESS;
var data = new Buffer(chars.join(''));
if (offset > data.length) {
result = this.RESULT_INVALID_OFFSET;
data = null;
}
callback(result, data);
};
Issue Analytics
- State:
- Created 10 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Android BLE client only returns 600 byte of data in ...
The MTU is adjusted to 256 bytes. Which I reflected on the server when reading the list. The call itself works fine and...
Read more >bleno
A Node.js module for implementing BLE (Bluetooth Low Energy) peripherals. Latest version: 0.5.0, last published: 5 years ago.
Read more >How to Use Node.js to Speed Up BLE App Development
You can use bleno, a Node.js module, to mock out a BLE peripheral and get ... to send on read and notify events...
Read more >BreakMi: Reversing, Exploiting and Fixing Xiaomi ... - HexHive
The client sends read, write, and notification requests to the server. The server answers accordingly to the request type and the availability ...
Read more >Untitled
R1390 rodenstock, Download malwarebytes premium. ... Omar douglas vs frank de alba, Ocz technology vertex 4 256gb, Jeff grabarkiewicz, Keyrouz number, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
MTU negotiation is handled by CoreBluetooth/blued on OS X, it’s always 23 from what I’ve seen. We’re stuck with this for unless Apple makes some changes.
Looks like CoreBluetooth/blued doesn’t handle long read characteristics. Typically, if the read response is the MTU size, the central would do another read with an offset to check if there is remaining data. I can look at having a
bleno.mtu
property or passing the MTU as an argument to theonReadRequest
callback - but I don’t think either will help you. What stack are you using for your central?@aravindanr closing for now, please re-open if you have more info.